diff --git a/DEV-GUIDELINES.md b/DEV-GUIDELINES.md index b2dea69972c..2a17a8ff9e5 100644 --- a/DEV-GUIDELINES.md +++ b/DEV-GUIDELINES.md @@ -72,7 +72,7 @@ Some of these rules are enforced by checkstyle, some are checked during code rev configured (e.g. a component may expect tracing endpoint - if not defined, tracing may be disabled) 5. We have introduced `helidon-builder` module, that provides capability to generate builders that support both programmatic and configuration approach. See [helidon-builder](builder/README.md) for more details about modules, and [helidon-builder-api](builder/api/README.md) for explanation of APIs and naming rules. The `Blueprint` approach should be used for all builders (and the API of the prototype). Exceptions must be consulted with project architect (this may result in either changing the processor to support the required feature, or in removing such feature and redesigning the problem, or in an exception (documented) to the rule) -Example: [io.helidon.nima.faulttolerance.RetryConfigBlueprint](nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/RetryConfigBlueprint.java) +Example: [io.helidon.faulttolerance.RetryConfigBlueprint](nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/RetryConfigBlueprint.java) # Getters and Setters 1. We do not use the verb, e.g. when a property "port" exists, the following methods are used: diff --git a/THIRD_PARTY_LICENSES.txt b/THIRD_PARTY_LICENSES.txt index 5ff7f7d4089..3ef173a8014 100644 --- a/THIRD_PARTY_LICENSES.txt +++ b/THIRD_PARTY_LICENSES.txt @@ -51,19 +51,19 @@ Fourth Party Runtime Dependencies SLF4J Copyright (c) 2004-2019 QOS.ch The MIT License SPDX short identifier: MIT - + Further resources on the MIT License Copyright - + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR @@ -73,7 +73,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Eclipse Parsson Eclipse Foundation Eclipse Public License 2.0 + GPL v.2 with CPE -Used by: [helidon-graal-native-image-extension, helidon-lra-coordinator-server, helidon-microprofile-server, helidon-mp-graal-native-image-extension, helidon-nima-http-media-jsonp, helidon-openapi, helidon-reactive-dbclient-jsonp, helidon-reactive-dbclient-mongodb, helidon-reactive-media-jsonb, helidon-reactive-media-jsonp, helidon-security-jwt] +Used by: [helidon-graal-native-image-extension, helidon-lra-coordinator-server, helidon-microprofile-server, helidon-mp-graal-native-image-extension, helidon-http-media-jsonp, helidon-openapi, helidon-reactive-dbclient-jsonp, helidon-reactive-dbclient-mongodb, helidon-reactive-media-jsonb, helidon-reactive-media-jsonp, helidon-security-jwt] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Eclipse Parsson (org.eclipse.parsson:parsson) Copyright (c) 2011,2022 Oracle and/or its affiliates. All rights reserved. @@ -211,7 +211,7 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Eclipse Yasson Eclipse Foundation Multiple Licenses -Used by: [helidon-microprofile, helidon-nima-http-media-jsonb, helidon-openapi, helidon-reactive-media-jsonb] +Used by: [helidon-microprofile, helidon-http-media-jsonb, helidon-openapi, helidon-reactive-media-jsonb] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Eclipse Yasson org.eclipse.yasson (org.eclipse:yasson) @@ -447,7 +447,7 @@ See full text at the bottom of this document for license: Apache-2.0 "jakarta.transaction API" 2.0.0 (jakarta.transaction:jakarta.transaction-api) Copyright (c) 1997,2020 Oracle and/or its affiliates. All rights reserved. Eclipse Public License - 2.0 - GPL2 w/ CPE + GPL2 w/ CPE -------------------------------------------- See full text at the bottom of this document for license: GPLv2-CPE @@ -655,7 +655,7 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------- "ANTLR 4 Runtime" (org.antlr:antlr4-runtime) Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. @@ -683,7 +683,7 @@ 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. - + -------------------------------------------- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Google APIs Client Library for Java Google @@ -995,11 +995,11 @@ Used by: [helidon-integrations-cdi-datasource-hikaricp, helidon-reactive-dbclien =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= HikariCP (com.zaxxer:HikariCP) Copyright (C) 2013,2019 Brett Wooldridge - + 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 @@ -1017,7 +1017,7 @@ Fourth Party Runtime Dependencies The MIT License SPDX short identifier: MIT -Further resources on the MIT License Copyright +Further resources on the MIT License Copyright Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in @@ -1235,14 +1235,14 @@ The project maintains the following source code repositories: * https://github.com/eclipse-ee4j/jaf -------------------------------------------- Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - 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. @@ -1250,7 +1250,7 @@ are met: - Neither the name of the Eclipse Foundation, Inc. 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 @@ -1276,7 +1276,7 @@ Used by: [helidon-bundles-config, helidon-config, helidon-config-hocon, helidon- non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose. In addition, such Contributors are not liable for any damages, including direct, indirect, special, incidental and consequential - damages, such as lost profits. + damages, such as lost profits. 3. Any provisions of the Oracle license agreement that differ from the Eclipse Public License are offered by Oracle alone and not by any other party. @@ -1464,7 +1464,7 @@ Used by: [helidon-security-abac-policy-el, weld-se-core] non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose. In addition, such Contributors are not liable for any damages, including direct, indirect, special, incidental and consequential - damages, such as lost profits. + damages, such as lost profits. 3. Any provisions of the Oracle license agreement that differ from the Eclipse Public License are offered by Oracle alone and not by any other party. @@ -1522,7 +1522,7 @@ Used by: [helidon-microprofile-access-log, helidon-microprofile-jwt-auth, helido non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose. In addition, such Contributors are not liable for any damages, including direct, indirect, special, incidental and consequential - damages, such as lost profits. + damages, such as lost profits. 3. Any provisions of the Oracle license agreement that differ from the Eclipse Public License are offered by Oracle alone and not by any other party. ______________________________________________ @@ -1588,7 +1588,7 @@ Fourth Party Dependencies =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Jakarta JSON Binding API (JSON-B) Eclipse Foundation Eclipse Public License 2.0 + GPL v.2 with CPE -Used by: [helidon-grpc-core, helidon-microprofile, helidon-nima-http-media-jsonb] +Used by: [helidon-grpc-core, helidon-microprofile, helidon-http-media-jsonb] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 1. The follow files are available in source code form under the Eclipse Public License at: https://github.com/eclipse-ee4j/jsonb-api/api (The EPL license is reproduced below). @@ -1597,7 +1597,7 @@ Used by: [helidon-grpc-core, helidon-microprofile, helidon-nima-http-media-jsonb non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose. In addition, such Contributors are not liable for any damages, including direct, indirect, special, incidental and consequential - damages, such as lost profits. + damages, such as lost profits. 3. Any provisions of the Oracle license agreement that differ from the Eclipse Public License are offered by Oracle alone and not by any other party. __________________________________________ @@ -1651,7 +1651,7 @@ Jakarta JSON Processing API (JSON-P) (jakarta.json:jakarta.json-api) =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Jakarta Json Processing API (JSON-P) Eclipse Foundation Eclipse Public License 2.0 + GPL v.2 with CPE -Used by: [helidon-microprofile-server, helidon-nima-http-media-jsonb, helidon-nima-http-media-jsonp, helidon-nima-observe-config, helidon-nima-observe-health, helidon-nima-observe-info, helidon-openapi, helidon-reactive-media-jsonp, helidon-security-jwt] +Used by: [helidon-microprofile-server, helidon-http-media-jsonb, helidon-http-media-jsonp, helidon-webserver-observe-config, helidon-webserver-observe-health, helidon-webserver-observe-info, helidon-openapi, helidon-reactive-media-jsonp, helidon-security-jwt] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 1. The follow files are available in source code form under the Eclipse Public License at: https://github.com/eclipse-ee4j/jsonp/api (The EPL license is reproduced below). @@ -1660,7 +1660,7 @@ Used by: [helidon-microprofile-server, helidon-nima-http-media-jsonb, helidon-ni non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose. In addition, such Contributors are not liable for any damages, including direct, indirect, special, incidental and consequential - damages, such as lost profits. + damages, such as lost profits. 3. Any provisions of the Oracle license agreement that differ from the Eclipse Public License are offered by Oracle alone and not by any other party. @@ -1745,7 +1745,7 @@ Used by: [helidon-health-checks, helidon-integrations-cdi-datasource, helidon-in implied warranties or conditions of merchantability and fitness for a particular purpose. In addition, such Contributors are not liable for any damages, including direct, indirect, special, incidental and consequential damages, - such as lost profits. + such as lost profits. 3. Any provisions of the Oracle license agreement that differ from the Eclipse Public License are offered by Oracle alone and not by any other party. _____________________________________________________ @@ -1889,7 +1889,7 @@ Used by: [helidon-integrations-cdi-eclipselink, helidon-integrations-cdi-hiberna non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose. In addition, such Contributors are not liable for any damages, including direct, indirect, special, incidental and consequential - damages, such as lost profits. + damages, such as lost profits. 3. Any provisions of the Oracle license agreement that differ from the Eclipse Public License are offered by Oracle alone and not by any other party. _________________________________________________ @@ -2011,7 +2011,7 @@ Used by: [helidon-microprofile-websocket, helidon-reactive-webserver-websocket] non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose. In addition, such Contributors are not liable for any damages, including direct, indirect, special, incidental and consequential - damages, such as lost profits. + damages, such as lost profits. 3. Any provisions of the Oracle license agreement that differ from the Eclipse Public License are offered by Oracle alone and not by any other party. _______________________________________________ @@ -2203,13 +2203,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. commons-pool2-2.9.0 (Apache 2.0) See full text at the bottom of this document for license: Apache-2.0 APACHE COMMONS POOL DERIVATIVE WORKS: - + The LinkedBlockingDeque implementation is based on an implementation 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/licenses/publicdomain - - + + -- Notice file content Apache Commons Pool Copyright 2001-2021 The Apache Software Foundation @@ -2382,7 +2382,7 @@ David Chan chdavid@ca.ibm.com, Don Bourne dbourne@ca.ibm.com, Antonin Stefanutti antonin@stefanutti.fr, Arjun Sharma arjun.a.sharma@ibm.com, -Fahham Khan fahhamk@ca.ibm.com, +Fahham Khan fahhamk@ca.ibm.com, Felix Wong fmhwong@ca.ibm.com, Mike Croft mike.croft@payara.fish, Werner Keil werner@catmedia.us, @@ -2642,7 +2642,7 @@ You are receiving a copy of Narayana Transaction Processing in both source and object code in the following JAR (org.jboss.narayana.jta;cdi.jar). The terms of the Oracle license do NOT apply to the Narayana Transaction Processing program; it is licensed under the following license, separately from the Oracle programs -you receive. +you receive. _______________________________________________ Written Offer for Source Code @@ -2654,10 +2654,10 @@ http://www.oracle.com/goto/opensourcecode If the source code for the technology was not provided to you with the binary, you can also receive a copy of the source code on physical media by submitting a written request to: -Oracle America, Inc. -Attn: Associate General Counsel, -Development and Engineering Legal -500 Oracle Parkway, 10th Floor +Oracle America, Inc. +Attn: Associate General Counsel, +Development and Engineering Legal +500 Oracle Parkway, 10th Floor Redwood Shores, CA 94065 Or, you may send an email to Oracle using the form at: http://www.oracle.com/goto/opensourcecode/request @@ -2667,7 +2667,7 @@ Your request should include: • The date you received the Oracle product • Your name • Your company name (if applicable) -• Your return mailing address and email and +• Your return mailing address and email and • A telephone number in the event we need to reach you. We may charge you a fee to cover the cost of physical media and processing. Your request must be sent (i) within three (3) years of the date you received @@ -3088,8 +3088,8 @@ Spring Framework: Beans 2.5.6 (org.springframework:spring-beans) -------------------------------------------- "RabbitMQ Java Client" 4.11.3 (com.rabbitmq:amqp-client) Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. -Apache License version 2.0 - +Apache License version 2.0 + =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= classgraph Luke Hutchinson MIT @@ -3154,10 +3154,10 @@ Copyright (c) 2004-2017 QOS.ch distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -3236,7 +3236,7 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------- -"Netty" +"Netty" io.netty:netty-codec-dns io.netty:netty-codec-http io.netty:netty-handler @@ -3245,7 +3245,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Copyright (c) 2004-2011 QOS.ch Copyright (c) 2011, Joe Walnes and contributors Copyright (c) 2008-2009 Bjoern Hoehrmann - + Copyright 2014 The Netty Project The Netty Project licenses this file to you under the Apache License, @@ -3260,7 +3260,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. License for the specific language governing permissions and limitations under the License. -------------------------------------------- -"Jackson" +"Jackson" com.fasterxml.jackson.core:jackson-core com.fasterxml.jackson.core:jackson-databind com.fasterxml.jackson.core:jackson-annotations @@ -3307,7 +3307,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= gRPC-Java The gRPC Authors Apache 2.0 -Used by: [helidon-config-etcd, helidon-grpc-core, helidon-nima-grpc-webserver, io.grpc] +Used by: [helidon-config-etcd, helidon-grpc-core, helidon-webserver-grpc, io.grpc] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= grpc-java (io.grpc:grpc-*) Copyright 2014,2022 The gRPC Authors @@ -3680,7 +3680,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 4P Dependencies: -com.ibm.icu » icu4j +com.ibm.icu » icu4j COPYRIGHT: © 2016 and later: Unicode, Inc. and others. LICENSE: MIT @@ -3715,7 +3715,7 @@ PERFORMANCE OF THE DATA FILES OR SOFTWARE. --- -org.abego.treelayout.core +org.abego.treelayout.core COPYRIGHT and LICENSE: BSD 3-Clause License @@ -3749,7 +3749,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ****************************************** -antlr-runtime +antlr-runtime COPYRIGHT: Copyright (c) 2003-2008 Terence Parr. All rights reserved. Copyright (c) 2008, Yahoo! Inc. All rights reserved. @@ -3772,7 +3772,7 @@ conditions are met: in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this - software without specific prior written permission. + 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 @@ -3821,7 +3821,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ********************************* -Reactive Streams +Reactive Streams /************************************************************************ * Licensed under Public Domain (CC0) * @@ -3857,9 +3857,9 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= hibernate-core Red Hat Middleware LLC LGPL v.2.1 @@ -3871,11 +3871,11 @@ Hibernate ORM - hibernate-core (org.hibernate.orm:hibernate-core) indicated by the @author tags or express copyright attribution statements applied by the authors. All third-party contributions are distributed under license by Red Hat Inc. - + This copyrighted material is made available to anyone wishing to use, modify, copy, or redistribute it subject to the terms and conditions of the GNU Lesser General Public License, as published by the Free Software Foundation. - + 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 Lesser General Public License @@ -4508,7 +4508,7 @@ hibernate-validator Hibernate Apache 2.0 Used by: [helidon-microprofile-bean-validation] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -Hibernate Validator +Hibernate Validator Copyright 2007-2021 Red Hat, Inc. All Rights Reserved Copyright 2009 IIZUKA Software Technologies Ltd -------------------------------------------- @@ -4645,8 +4645,8 @@ Used by: [helidon-integrations-cdi-jta] >You are receiving a copy of JBoss Transaction SPI in both source and object code in the following JAR (identify the JAR jboss-transaction-spi-7.6.0.Final.jar). The terms of the Oracle license do NOT apply to the JBoss Transaction SPI program; -it is licensed under the following license, separately from the Oracle programs you receive. --------------------------------------------------------------------------------- +it is licensed under the following license, separately from the Oracle programs you receive. +-------------------------------------------------------------------------------- Written Offer for Source Code For third party technology that you receive from Oracle in binary @@ -4657,10 +4657,10 @@ http://www.oracle.com/goto/opensourcecode If the source code for the technology was not provided to you with the binary, you can also receive a copy of the source code on physical media by submitting a written request to: -Oracle America, Inc. -Attn: Associate General Counsel, -Development and Engineering Legal -500 Oracle Parkway, 10th Floor +Oracle America, Inc. +Attn: Associate General Counsel, +Development and Engineering Legal +500 Oracle Parkway, 10th Floor Redwood Shores, CA 94065 Or, you may send an email to Oracle using the form at: http://www.oracle.com/goto/opensourcecode/request @@ -4670,7 +4670,7 @@ Your request should include: • The date you received the Oracle product • Your name • Your company name (if applicable) -• Your return mailing address and email and +• Your return mailing address and email and • A telephone number in the event we need to reach you. We may charge you a fee to cover the cost of physical media and processing. Your request must be sent (i) within three (3) years of the date you received @@ -4719,7 +4719,7 @@ jersey-core-client (org.glassfish.jersey.core:jersey-client) Copyright (c) 2018,2019 Payara Foundation and/or its affiliates. Eclipse Public License 2.0 + GPL v.2 with CPE -------------------------------------------- -# Notice for Jersey +# Notice for Jersey This content is produced and maintained by the Eclipse Jersey project. * Project home: https://projects.eclipse.org/projects/ee4j.jersey @@ -4790,7 +4790,7 @@ jersey-inject-hk2 (org.glassfish.jersey.inject:jersey-hk2) Copyright (c) 2017,2022 Oracle and/or its affiliates. All rights reserved. Eclipse Public License 2.0 + GPL v.2 with CPE -------------------------------------------- -# Notice for Jersey +# Notice for Jersey This content is produced and maintained by the Eclipse Jersey project. * Project home: https://projects.eclipse.org/projects/ee4j.jersey @@ -4885,7 +4885,7 @@ Used by: [helidon-microprofile] jersey-media-json-binding (org.glassfish.jersey.media:jersey-media-json-binding) Copyright (c) 2017,2021 Oracle and/or its affiliates. All rights reserved. -------------------------------------------- -# Notice for Jersey +# Notice for Jersey This content is produced and maintained by the Eclipse Jersey project. * Project home: https://projects.eclipse.org/projects/ee4j.jersey @@ -4964,7 +4964,7 @@ Jakarta JSON Processing API (JSON-P) (jakarta.json:jakarta.json-api) Copyright (c) 2015,2022 Oracle and/or its affiliates. All rights reserved. Copyright (c) 2019,2021 Payara Foundation and/or its affiliates. All rights reserved. Copyright (c) 2019,2020 Payara Services and/or its affiliates. All rights reserved. - Eclipse Public License 2.0 or Eclipse Distribution License 1.0 + Eclipse Public License 2.0 or Eclipse Distribution License 1.0 Eclipse Distribution License - v 1.0 Copyright (c) 2007, Eclipse Foundation, Inc. and its licensors. @@ -5008,7 +5008,7 @@ jersey-media-json-processing (org.glassfish.jersey.media:jersey-media-json-proce Copyright (c) 2011,2022 Oracle and/or its affiliates. All rights reserved. Eclipse Public License 2.0 + GPL v.2 with CPE -------------------------------------------- -# Notice for Jersey +# Notice for Jersey This content is produced and maintained by the Eclipse Jersey project. * Project home: https://projects.eclipse.org/projects/ee4j.jersey @@ -5092,7 +5092,7 @@ jersey-mp-rest-client (org.glassfish.jersey.ext.microprofile:jersey-mp-rest-clie Copyright (c) 2019,2021 Payara Foundation and/or its affiliates. All rights reserved. Copyright (c) 2019,2022 Oracle and/or its affiliates. All rights reserved. -------------------------------------------- -# Notice for Jersey +# Notice for Jersey This content is produced and maintained by the Eclipse Jersey project. * Project home: https://projects.eclipse.org/projects/ee4j.jersey @@ -5321,7 +5321,7 @@ jersey-core-server (org.glassfish.jersey.core:jersey-server) Copyright (c) 2018 Payara Foundation and/or its affiliates. Copyright 2010,2013 Coda Hale and Yammer, Inc. -------------------------------------------- -# Notice for Jersey +# Notice for Jersey This content is produced and maintained by the Eclipse Jersey project. * Project home: https://projects.eclipse.org/projects/ee4j.jersey @@ -5405,7 +5405,7 @@ Used by: [helidon-microprofile-fault-tolerance, helidon-microprofile-server] jersey-ext-weld2-se (org.glassfish.jersey.ext.cdi:jersey-weld2-se) Copyright (c) 2014,2022 Oracle and/or its affiliates. All rights reserved. -------------------------------------------- -# Notice for Jersey +# Notice for Jersey This content is produced and maintained by the Eclipse Jersey project. * Project home: https://projects.eclipse.org/projects/ee4j.jersey @@ -5589,12 +5589,12 @@ This product includes software developed by Apache PureJavaCrc32C from apache-hadoop-common http://hadoop.apache.org/ (Apache 2.0 license) -This library containd statically linked libstdc++. This inclusion is allowed by -"GCC RUntime Library Exception" +This library containd statically linked libstdc++. This inclusion is allowed by +"GCC RUntime Library Exception" http://gcc.gnu.org/onlinedocs/libstdc++/manual/license.html == Contributors == - * Tatu Saloranta + * Tatu Saloranta * Providing benchmark suite * Alec Wysoker * Performance and memory usage improvement @@ -5820,7 +5820,7 @@ Fourth Party Runtime Dependencies Copyright (c) 2004-2011 QOS.ch Copyright 2012,2017 The Netty Project Copyright 2017,2021 VMware, Inc. - Apache License, Version 2.0 + Apache License, Version 2.0 ------------------------------------------------------------------------------- "HdrHistogram" (org.hdrhistogram:HdrHistogram) @@ -6473,16 +6473,16 @@ WebSocket and HTTP server, which can be obtained at: Copyright (c) 2011, Joe Walnes, Aslak Hellesøy and contributors All rights reserved. -Redistribution and use in source and binary forms, with or -without modification, are permitted provided that the +Redistribution and use in source and binary forms, with or +without modification, are permitted provided that the following conditions are met: -* Redistributions of source code must retain the above - copyright notice, this list of conditions and the +* Redistributions of source code must retain the above + copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the + copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. @@ -6491,19 +6491,19 @@ following conditions are met: 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 +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 HOLDER 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 +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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 +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. * HOMEPAGE: * https://github.com/joewalnes/webbit @@ -6513,10 +6513,10 @@ facade for Java, which can be obtained at: * LICENSE: * license/LICENSE.slf4j.txt (MIT License) -/* +/* * Copyright (c) 2004-2007 QOS.ch * All rights reserved. - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -6524,10 +6524,10 @@ facade for Java, which can be obtained at: * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -6635,8 +6635,8 @@ 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 + 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. The names of the authors may not be used to endorse or promote products @@ -6891,7 +6891,7 @@ the HTTP/2 HPACK algorithm written by Twitter. It can be obtained at: * license/LICENSE.hpack.txt (Apache License 2.0) * HOMEPAGE: * https://github.com/twitter/hpack - + This product contains a modified version of 'HPACK', a Java implementation of the HTTP/2 HPACK algorithm written by Cory Benfield. It can be obtained at: @@ -6978,14 +6978,14 @@ This private header is also used by Apple's open source * Copyright (c) 2004-2006, 2008, 2009, 2011 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ - * + * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * https://www.opensource.apple.com/apsl/ and read it before using this * file. - * + * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, @@ -6993,7 +6993,7 @@ This private header is also used by Apple's open source * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. - * + * * @APPLE_LICENSE_HEADER_END@ */ * HOMEPAGE: @@ -7807,7 +7807,7 @@ 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) +Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -8054,8 +8054,8 @@ Eclipse Public License - v 2.0 a) in the case of the initial Contributor, the initial content Distributed under this Agreement, and - b) in the case of each subsequent Contributor: - i) changes to the Program, and + b) in the case of each subsequent Contributor: + i) changes to the Program, and ii) additions to the Program; where such changes and/or additions to the Program originate from and are Distributed by that particular Contributor. A Contribution @@ -8304,8 +8304,8 @@ No third-party beneficiary rights are created under this Agreement. Exhibit A - Form of Secondary Licenses Notice -"This Source Code may also be made available under the following -Secondary Licenses when the conditions for such availability set forth +"This Source Code may also be made available under the following +Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: {name license(s), version(s), and exceptions or additional permissions here}." diff --git a/applications/nima/pom.xml b/applications/nima/pom.xml deleted file mode 100644 index db0cecc1ee3..00000000000 --- a/applications/nima/pom.xml +++ /dev/null @@ -1,88 +0,0 @@ - - - - - 4.0.0 - - io.helidon.applications - helidon-applications - 4.0.0-SNAPSHOT - ../parent/pom.xml - - helidon-nima - pom - Helidon Nima applications parent pom - Parent pom for Helidon Nima applications - - - - native-image - - - - org.graalvm.buildtools - native-maven-plugin - - - resource-config - - generateResourceConfig - - package - - - build-native-image - - compile - - package - - - - - - - - io.helidon.integrations.graal - helidon-graal-native-image-extension - - - - - jlink-image - - - - io.helidon.build-tools - helidon-maven-plugin - - - jlink-image - - jlink-image - - - - - - - - - diff --git a/applications/pom.xml b/applications/pom.xml index f6cfabc22fc..0f518329bce 100644 --- a/applications/pom.xml +++ b/applications/pom.xml @@ -34,7 +34,6 @@ parent - nima se mp diff --git a/archetypes/helidon/src/main/archetype/common/extra.xml b/archetypes/helidon/src/main/archetype/common/extra.xml index 4bee2af37f9..28ff8a4bead 100644 --- a/archetypes/helidon/src/main/archetype/common/extra.xml +++ b/archetypes/helidon/src/main/archetype/common/extra.xml @@ -48,7 +48,7 @@ io.helidon.microprofile.faulttolerance - io.helidon.common.http.Http + io.helidon.http.Http java.util.concurrent.TimeoutException diff --git a/archetypes/helidon/src/main/archetype/common/media.xml b/archetypes/helidon/src/main/archetype/common/media.xml index 66b98253ab9..cc93aa1ab66 100644 --- a/archetypes/helidon/src/main/archetype/common/media.xml +++ b/archetypes/helidon/src/main/archetype/common/media.xml @@ -39,8 +39,8 @@ jakarta.json-api - io.helidon.nima.http.media - helidon-nima-http-media-jsonp + io.helidon.http.media + helidon-http-media-jsonp @@ -103,8 +103,8 @@ runtime - io.helidon.nima.http.media - helidon-nima-http-media-jsonb + io.helidon.http.media + helidon-http-media-jsonb @@ -147,16 +147,16 @@ jersey-media-multipart - io.helidon.nima.http.media - helidon-nima-http-media-multipart + io.helidon.http.media + helidon-http-media-multipart - io.helidon.nima.http.media - helidon-nima-http-media-jsonp + io.helidon.http.media + helidon-http-media-jsonp - io.helidon.nima.webserver - helidon-nima-webserver-static-content + io.helidon.webserver + helidon-webserver-static-content jakarta.json @@ -165,17 +165,17 @@ jakarta.json - io.helidon.nima.http.media.multipart - io.helidon.nima.webserver.staticcontent + io.helidon.http.media.multipart + io.helidon.webserver.staticcontent jakarta.json jersey.media.multipart - io.helidon.common.http.Http - io.helidon.common.http.Http.Header - io.helidon.nima.webserver.staticcontent.StaticContentService + io.helidon.http.Http + io.helidon.http.Http.Header + io.helidon.webserver.staticcontent.StaticContentService { diff --git a/archetypes/helidon/src/main/archetype/mp/custom/files/src/test/java/__pkg__/TestCORS.java.mustache b/archetypes/helidon/src/main/archetype/mp/custom/files/src/test/java/__pkg__/TestCORS.java.mustache index 3a7d165a909..9da6a3dc3e4 100644 --- a/archetypes/helidon/src/main/archetype/mp/custom/files/src/test/java/__pkg__/TestCORS.java.mustache +++ b/archetypes/helidon/src/main/archetype/mp/custom/files/src/test/java/__pkg__/TestCORS.java.mustache @@ -1,6 +1,6 @@ package {{package}}; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.config.Config; import io.helidon.cors.CrossOriginConfig; import io.helidon.microprofile.tests.junit5.HelidonTest; diff --git a/archetypes/helidon/src/main/archetype/nima/common/common-nima.xml b/archetypes/helidon/src/main/archetype/nima/common/common-nima.xml index adea00efd64..f0cfa6a4ea8 100644 --- a/archetypes/helidon/src/main/archetype/nima/common/common-nima.xml +++ b/archetypes/helidon/src/main/archetype/nima/common/common-nima.xml @@ -24,11 +24,11 @@ ${package}.Main - helidon-nima + helidon-se - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver io.helidon.config @@ -45,23 +45,23 @@ test - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test io.helidon.logging.common.LogConfig io.helidon.config.Config - io.helidon.nima.webserver.WebServer - io.helidon.nima.webserver.http.HttpRouting + io.helidon.webserver.WebServer + io.helidon.webserver.http.HttpRouting - io.helidon.common.http.Http - io.helidon.nima.testing.junit5.webserver.SetUpRoute - io.helidon.nima.webclient.http1.Http1Client - io.helidon.nima.webclient.http1.Http1ClientResponse - io.helidon.nima.webserver.http.HttpRouting + io.helidon.http.Http + io.helidon.webserver.testing.junit5.SetUpRoute + io.helidon.webclient.http1.Http1Client + io.helidon.webclient.http1.Http1ClientResponse + io.helidon.webserver.http.HttpRouting org.junit.jupiter.api.Test @@ -71,8 +71,8 @@ static org.hamcrest.Matchers.is - io.helidon.nima.webserver - io.helidon.common.http + io.helidon.webserver + io.helidon.http io.helidon.config diff --git a/archetypes/helidon/src/main/archetype/nima/common/files/src/main/resources/logging.properties.mustache b/archetypes/helidon/src/main/archetype/nima/common/files/src/main/resources/logging.properties.mustache index f494a314705..5177e0d4160 100644 --- a/archetypes/helidon/src/main/archetype/nima/common/files/src/main/resources/logging.properties.mustache +++ b/archetypes/helidon/src/main/archetype/nima/common/files/src/main/resources/logging.properties.mustache @@ -2,4 +2,4 @@ handlers=java.util.logging.ConsoleHandler java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS.%1$tL %5$s%6$s%n # Global logging level. Can be overridden by specific loggers .level=INFO -io.helidon.nima.level=INFO +io.helidon.webserver.level=INFO diff --git a/archetypes/helidon/src/main/archetype/nima/common/files/src/test/java/__pkg__/MainIT.java.mustache b/archetypes/helidon/src/main/archetype/nima/common/files/src/test/java/__pkg__/MainIT.java.mustache index fd40620f90d..df82925f5c4 100644 --- a/archetypes/helidon/src/main/archetype/nima/common/files/src/test/java/__pkg__/MainIT.java.mustache +++ b/archetypes/helidon/src/main/archetype/nima/common/files/src/test/java/__pkg__/MainIT.java.mustache @@ -1,7 +1,7 @@ package {{package}}; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webserver.testing.junit5.ServerTest; @ServerTest class MainIT extends AbstractMainTest { diff --git a/archetypes/helidon/src/main/archetype/nima/common/files/src/test/java/__pkg__/MainTest.java.mustache b/archetypes/helidon/src/main/archetype/nima/common/files/src/test/java/__pkg__/MainTest.java.mustache index 5d3ce19fc5e..d511ff11ff9 100644 --- a/archetypes/helidon/src/main/archetype/nima/common/files/src/test/java/__pkg__/MainTest.java.mustache +++ b/archetypes/helidon/src/main/archetype/nima/common/files/src/test/java/__pkg__/MainTest.java.mustache @@ -1,7 +1,7 @@ package {{package}}; -import io.helidon.nima.testing.junit5.webserver.DirectClient; -import io.helidon.nima.testing.junit5.webserver.RoutingTest; +import io.helidon.webserver.testing.junit5.DirectClient; +import io.helidon.webserver.testing.junit5.RoutingTest; @RoutingTest class MainTest extends AbstractMainTest { diff --git a/archetypes/helidon/src/main/archetype/nima/custom/extra.xml b/archetypes/helidon/src/main/archetype/nima/custom/extra.xml index 28888b1a353..ab4e1c2a347 100644 --- a/archetypes/helidon/src/main/archetype/nima/custom/extra.xml +++ b/archetypes/helidon/src/main/archetype/nima/custom/extra.xml @@ -24,15 +24,15 @@ - io.helidon.nima.fault-tolerance - helidon-nima-fault-tolerance + io.helidon.fault-tolerance + helidon-fault-tolerance - io.helidon.common.http.Http - io.helidon.nima.faulttolerance.BulkheadException - io.helidon.nima.faulttolerance.CircuitBreakerOpenException - io.helidon.nima.faulttolerance.TimeoutException + io.helidon.http.Http + io.helidon.faulttolerance.BulkheadException + io.helidon.faulttolerance.CircuitBreakerOpenException + io.helidon.faulttolerance.TimeoutException - io.helidon.nima.observe.ObserveFeature + io.helidon.webserver.observe.ObserveFeature - io.helidon.nima.observe - helidon-nima-observe-health + io.helidon.webserver.observe + helidon-webserver-observe-health io.helidon.health helidon-health-checks - io.helidon.nima.observe - helidon-nima-observe-metrics + io.helidon.webserver.observe + helidon-webserver-observe-metrics io.helidon.metrics helidon-metrics - io.helidon.nima.webserver - helidon-nima-webserver-tracing + io.helidon.webserver + helidon-webserver-tracing - io.helidon.nima.http2 - helidon-nima-http2-webserver + io.helidon.webserver + helidon-webserver-http2 io.helidon.health.checks.DeadlockHealthCheck io.helidon.health.checks.DiskSpaceHealthCheck io.helidon.health.checks.HeapMemoryHealthCheck - io.helidon.nima.observe.health.HealthFeature - io.helidon.nima.observe.health.HealthObserveProvider + io.helidon.webserver.observe.health.HealthFeature + io.helidon.webserver.observe.health.HealthObserveProvider io.helidon.metrics.api.MetricsSettings - io.helidon.nima.observe.metrics.MetricsFeature - io.helidon.nima.observe.metrics.MetricsObserveProvider + io.helidon.webserver.observe.metrics.MetricsFeature + io.helidon.webserver.observe.metrics.MetricsObserveProvider - io.helidon.nima.http2.webserver.Http2Route - io.helidon.nima.webserver.http.Handler - io.helidon.nima.webserver.http.ServerRequest - io.helidon.nima.webserver.http.ServerResponse - io.helidon.nima.webserver.http1.Http1Route - io.helidon.nima.webserver.tracing.TracingFeature + io.helidon.webserver.http2.Http2Route + io.helidon.webserver.http.Handler + io.helidon.webserver.http.ServerRequest + io.helidon.webserver.http.ServerResponse + io.helidon.webserver.http1.Http1Route + io.helidon.webserver.tracing.TracingFeature io.helidon.tracing.Span io.helidon.tracing.Tracer io.helidon.tracing.TracerBuilder - static io.helidon.common.http.Http.Method.GET + static io.helidon.http.Http.Method.GET - @@ -167,13 +167,13 @@ curl -H 'Accept: application/json' -X GET http://localhost:8080/observe/metrics ]]> - io.helidon.nima.observe - io.helidon.nima.observe.health + io.helidon.webserver.observe + io.helidon.webserver.observe.health io.helidon.health.checks - io.helidon.nima.observe.metrics + io.helidon.webserver.observe.metrics io.helidon.metrics.api - io.helidon.nima.http2.webserver - io.helidon.nima.webserver.tracing + io.helidon.webserver.http2 + io.helidon.webserver.tracing io.helidon.tracing diff --git a/archetypes/helidon/src/main/archetype/nima/quickstart/files/src/main/java/__pkg__/GreetClientHttp.java.mustache b/archetypes/helidon/src/main/archetype/nima/quickstart/files/src/main/java/__pkg__/GreetClientHttp.java.mustache index 8f7b24d2bd9..878f77ab1c1 100644 --- a/archetypes/helidon/src/main/archetype/nima/quickstart/files/src/main/java/__pkg__/GreetClientHttp.java.mustache +++ b/archetypes/helidon/src/main/archetype/nima/quickstart/files/src/main/java/__pkg__/GreetClientHttp.java.mustache @@ -1,7 +1,7 @@ package {{package}}; -import io.helidon.common.http.Http; -import io.helidon.nima.webclient.api.WebClient; +import io.helidon.http.Http; +import io.helidon.webclient.api.WebClient; /** * Executable class that invokes HTTP/1 requests against the server. diff --git a/archetypes/helidon/src/main/archetype/nima/quickstart/quickstart-nima.xml b/archetypes/helidon/src/main/archetype/nima/quickstart/quickstart-nima.xml index dfa0b1591ca..d651502c632 100644 --- a/archetypes/helidon/src/main/archetype/nima/quickstart/quickstart-nima.xml +++ b/archetypes/helidon/src/main/archetype/nima/quickstart/quickstart-nima.xml @@ -60,12 +60,12 @@ curl -X GET http://localhost:8080/greet/Jose - io.helidon.nima.webclient - helidon-nima-webclient + io.helidon.webclient + helidon-webclient - io.helidon.nima.webclient + io.helidon.webclient diff --git a/bom/pom.xml b/bom/pom.xml index 84c5f8bb434..af2bdc86589 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -79,8 +79,8 @@ ${helidon.version} - io.helidon.nima.graphql - helidon-nima-graphql-server + io.helidon.webserver + helidon-webserver-graphql ${helidon.version} @@ -236,11 +236,6 @@ helidon-security-integration-webserver ${helidon.version} - - io.helidon.security.integration - helidon-security-integration-nima - ${helidon.version} - io.helidon.security helidon-security-annotations @@ -420,11 +415,6 @@ helidon-common-config ${helidon.version} - - io.helidon.common - helidon-common-http - ${helidon.version} - io.helidon.common helidon-common-reactive @@ -495,6 +485,11 @@ helidon-common-types ${helidon.version} + + io.helidon.common + helidon-common-tls + ${helidon.version} + io.helidon.common.processor helidon-common-processor @@ -1023,235 +1018,234 @@ ${helidon.version} - - io.helidon.nima.common - helidon-nima-common-tls + io.helidon.http + helidon-http ${helidon.version} - io.helidon.nima.http.encoding - helidon-nima-http-encoding + io.helidon.http + helidon-http-http2 ${helidon.version} - io.helidon.nima.http.encoding - helidon-nima-http-encoding-gzip + io.helidon.http + helidon-http-sse ${helidon.version} - io.helidon.nima.http.encoding - helidon-nima-http-encoding-deflate + io.helidon.http.encoding + helidon-http-encoding ${helidon.version} - io.helidon.nima.http.media - helidon-nima-http-media + io.helidon.http.encoding + helidon-http-encoding-gzip ${helidon.version} - io.helidon.nima.http.media - helidon-nima-http-media-jsonb + io.helidon.http.encoding + helidon-http-encoding-deflate ${helidon.version} - io.helidon.nima.http.media - helidon-nima-http-media-jackson + io.helidon.http.media + helidon-http-media ${helidon.version} - io.helidon.nima.http.media - helidon-nima-http-media-jsonp + io.helidon.http.media + helidon-http-media-jsonb ${helidon.version} - io.helidon.nima.http.media - helidon-nima-http-media-multipart + io.helidon.http.media + helidon-http-media-jackson ${helidon.version} - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.http.media + helidon-http-media-jsonp ${helidon.version} - io.helidon.nima.webserver - helidon-nima-webserver-cors + io.helidon.http.media + helidon-http-media-multipart ${helidon.version} - io.helidon.nima.webserver - helidon-nima-webserver-access-log + io.helidon.webserver + helidon-webserver ${helidon.version} - io.helidon.nima.webserver - helidon-nima-webserver-context + io.helidon.webserver + helidon-webserver-http2 ${helidon.version} - io.helidon.nima.webserver - helidon-nima-webserver-static-content + io.helidon.webserver + helidon-webserver-websocket ${helidon.version} - io.helidon.nima.webclient - helidon-nima-webclient-api + io.helidon.webserver + helidon-webserver-grpc ${helidon.version} - io.helidon.nima.webclient - helidon-nima-webclient-http1 + io.helidon.webserver + helidon-webserver-sse ${helidon.version} - io.helidon.nima.webclient - helidon-nima-webclient + io.helidon.webserver + helidon-webserver-security ${helidon.version} - io.helidon.nima.webclient.dns.resolver - helidon-nima-webclient-dns-resolver-first + io.helidon.webserver + helidon-webserver-cors ${helidon.version} - io.helidon.nima.webclient.dns.resolver - helidon-nima-webclient-dns-resolver-round-robin + io.helidon.webserver + helidon-webserver-access-log ${helidon.version} - io.helidon.nima.webclient - helidon-nima-webclient-security + io.helidon.webserver + helidon-webserver-context ${helidon.version} - io.helidon.nima.webclient - helidon-nima-webclient-tracing + io.helidon.webserver + helidon-webserver-static-content ${helidon.version} - io.helidon.nima.webclient - helidon-nima-webclient-metrics + io.helidon.webserver.observe + helidon-webserver-observe ${helidon.version} - io.helidon.nima.http2 - helidon-nima-http2 + io.helidon.webserver.observe + helidon-webserver-observe-config ${helidon.version} - io.helidon.nima.http2 - helidon-nima-http2-webclient + io.helidon.webserver.observe + helidon-webserver-observe-health ${helidon.version} - io.helidon.nima.http2 - helidon-nima-http2-webserver + io.helidon.webserver.observe + helidon-webserver-observe-metrics ${helidon.version} - io.helidon.nima.websocket - helidon-nima-websocket + io.helidon.webserver.observe + helidon-webserver-observe-info ${helidon.version} - io.helidon.nima.websocket - helidon-nima-websocket-webserver + io.helidon.webserver.observe + helidon-webserver-observe-log ${helidon.version} - io.helidon.nima.websocket - helidon-nima-websocket-client + io.helidon.webserver + helidon-webserver-tracing ${helidon.version} - io.helidon.nima.sse - helidon-nima-sse + io.helidon.webserver + helidon-webserver-service-common ${helidon.version} - io.helidon.nima.sse - helidon-nima-sse-webclient + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 ${helidon.version} - io.helidon.nima.sse - helidon-nima-sse-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5-http2 ${helidon.version} - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5-websocket ${helidon.version} - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-http2 + io.helidon.webclient + helidon-webclient-api ${helidon.version} - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-websocket + io.helidon.webclient + helidon-webclient ${helidon.version} - io.helidon.nima.grpc - helidon-nima-grpc-webserver + io.helidon.webclient + helidon-webclient-http1 ${helidon.version} - io.helidon.nima.observe - helidon-nima-observe + io.helidon.webclient + helidon-webclient-http2 ${helidon.version} - io.helidon.nima.observe - helidon-nima-observe-config + io.helidon.webclient + helidon-webclient-websocket ${helidon.version} - io.helidon.nima.observe - helidon-nima-observe-health + io.helidon.webclient + helidon-webclient-sse ${helidon.version} - io.helidon.nima.observe - helidon-nima-observe-metrics + io.helidon.webclient + helidon-webclient-security ${helidon.version} - io.helidon.nima.observe - helidon-nima-observe-info + io.helidon.webclient.dns.resolver + helidon-webclient-dns-resolver-first ${helidon.version} - io.helidon.nima.observe - helidon-nima-observe-log + io.helidon.webclient.dns.resolver + helidon-webclient-dns-resolver-round-robin ${helidon.version} - io.helidon.nima.webserver - helidon-nima-webserver-tracing + io.helidon.webclient + helidon-webclient-tracing ${helidon.version} - io.helidon.nima.service-common - helidon-nima-service-common + io.helidon.webclient + helidon-webclient-metrics ${helidon.version} - io.helidon.nima.fault-tolerance - helidon-nima-fault-tolerance + io.helidon.websocket + helidon-websocket ${helidon.version} - io.helidon.nima.fault-tolerance - helidon-nima-fault-tolerance-processor + io.helidon.fault-tolerance + helidon-fault-tolerance ${helidon.version} - io.helidon.nima.openapi - helidon-nima-openapi + io.helidon.fault-tolerance + helidon-fault-tolerance-processor ${helidon.version} diff --git a/common/configurable/etc/spotbugs/exclude.xml b/common/configurable/etc/spotbugs/exclude.xml index 73fd10a5665..6c4faead676 100644 --- a/common/configurable/etc/spotbugs/exclude.xml +++ b/common/configurable/etc/spotbugs/exclude.xml @@ -38,7 +38,7 @@ - + diff --git a/common/http/pom.xml b/common/http/pom.xml deleted file mode 100644 index 5ae13e3d451..00000000000 --- a/common/http/pom.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - - helidon-common-project - io.helidon.common - 4.0.0-SNAPSHOT - - 4.0.0 - helidon-common-http - Helidon Common HTTP - Common HTTP primitives used by both blocking and reactive servers - - - - io.helidon.common - helidon-common - - - io.helidon.common - helidon-common-configurable - - - io.helidon.common - helidon-common-buffers - - - io.helidon.common - helidon-common-mapper - - - io.helidon.common - helidon-common-media-type - - - io.helidon.common - helidon-common-uri - - - io.helidon.config - helidon-config-metadata - true - - - io.helidon.config - helidon-config-metadata-processor - true - - - io.helidon.common.testing - helidon-common-testing-junit5 - test - - - org.junit.jupiter - junit-jupiter-api - test - - - junit-jupiter-params - org.junit.jupiter - test - - - org.hamcrest - hamcrest-all - test - - - - diff --git a/common/http/src/main/java/io/helidon/common/http/UnauthorizedException.java b/common/http/src/main/java/io/helidon/common/http/UnauthorizedException.java deleted file mode 100644 index fdaf7cca473..00000000000 --- a/common/http/src/main/java/io/helidon/common/http/UnauthorizedException.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2017, 2022 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.common.http; - -import static io.helidon.common.http.Http.Status.UNAUTHORIZED_401; - -/** - * A runtime exception indicating a {@link io.helidon.common.http.Http.Status#UNAUTHORIZED_401 unauthorized}. - */ -public class UnauthorizedException extends HttpException { - - /** - * Creates {@link io.helidon.common.http.UnauthorizedException}. - * - * @param message the message - */ - public UnauthorizedException(String message) { - super(message, UNAUTHORIZED_401, null, true); - } - - /** - * Creates {@link io.helidon.common.http.UnauthorizedException}. - * - * @param message the message - * @param cause the cause of this exception - */ - public UnauthorizedException(String message, Throwable cause) { - super(message, UNAUTHORIZED_401, cause, true); - } -} diff --git a/common/http/src/main/java/io/helidon/common/http/package-info.java b/common/http/src/main/java/io/helidon/common/http/package-info.java deleted file mode 100644 index e645206fa6e..00000000000 --- a/common/http/src/main/java/io/helidon/common/http/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2018, 2021 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * HTTP APIs and implementations usable by both server and client side of the HTTP story. - */ -package io.helidon.common.http; diff --git a/common/http/src/main/java/module-info.java b/common/http/src/main/java/module-info.java deleted file mode 100644 index 3a1441aa777..00000000000 --- a/common/http/src/main/java/module-info.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2018, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Helidon Common classes for HTTP server and client. - */ -module io.helidon.common.http { - requires transitive io.helidon.common; - requires transitive io.helidon.common.configurable; - requires transitive io.helidon.common.mapper; - requires transitive io.helidon.common.buffers; - requires transitive io.helidon.common.media.type; - requires transitive io.helidon.common.uri; - requires static io.helidon.config.metadata; - - exports io.helidon.common.http; -} diff --git a/common/pom.xml b/common/pom.xml index 2236d44f07c..43472540565 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -31,25 +31,25 @@ Helidon Common Project + buffers common - reactive config configurable - key-util - http context + crypto + features + key-util mapper media-type - crypto parameters - buffers - socket - uri + processor + reactive security - testing - features + socket task + testing + tls types - processor + uri diff --git a/common/task/src/main/java/io/helidon/common/task/HelidonTaskExecutor.java b/common/task/src/main/java/io/helidon/common/task/HelidonTaskExecutor.java index 3c9131b9762..bd3c1f0e06f 100644 --- a/common/task/src/main/java/io/helidon/common/task/HelidonTaskExecutor.java +++ b/common/task/src/main/java/io/helidon/common/task/HelidonTaskExecutor.java @@ -25,7 +25,7 @@ * {@link InterruptableTask}s and can be efficiently terminated. A thread that is * waiting to read on an open connection cannot be efficiently stopped. This * executor will query the thread and interrupt it if possible. It is important - * to efficiently shut down the Nima webserver in certain environments. + * to efficiently shut down the webserver in certain environments. */ public interface HelidonTaskExecutor extends Closeable { diff --git a/common/testing/http-junit5/pom.xml b/common/testing/http-junit5/pom.xml index 6b22b66787e..ce6a38c6a3d 100644 --- a/common/testing/http-junit5/pom.xml +++ b/common/testing/http-junit5/pom.xml @@ -35,8 +35,8 @@ - io.helidon.common - helidon-common-http + io.helidon.http + helidon-http io.helidon.common.testing diff --git a/common/testing/http-junit5/src/main/java/io/helidon/common/testing/http/junit5/HttpHeaderMatcher.java b/common/testing/http-junit5/src/main/java/io/helidon/common/testing/http/junit5/HttpHeaderMatcher.java index 16405d8f3a5..9bd6d7b1f97 100644 --- a/common/testing/http-junit5/src/main/java/io/helidon/common/testing/http/junit5/HttpHeaderMatcher.java +++ b/common/testing/http-junit5/src/main/java/io/helidon/common/testing/http/junit5/HttpHeaderMatcher.java @@ -18,9 +18,9 @@ import java.util.List; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderName; +import io.helidon.http.Headers; +import io.helidon.http.Http; +import io.helidon.http.Http.HeaderName; import org.hamcrest.Description; import org.hamcrest.Matcher; @@ -28,14 +28,14 @@ import org.hamcrest.TypeSafeMatcher; /** - * Matchers for {@link io.helidon.common.http.Headers}. + * Matchers for {@link io.helidon.http.Headers}. */ public final class HttpHeaderMatcher { private HttpHeaderMatcher() { } /** - * A matcher for an {@link io.helidon.common.http.Headers} that checks that the header is not present. + * A matcher for an {@link io.helidon.http.Headers} that checks that the header is not present. *

* Usage example: *

@@ -43,14 +43,14 @@ private HttpHeaderMatcher() {
      * 
* * @param name header name - * @return matcher validating the {@link io.helidon.common.http.Headers} does not contain the provided header + * @return matcher validating the {@link io.helidon.http.Headers} does not contain the provided header */ public static Matcher noHeader(HeaderName name) { return new NoHeaderMatcher(name); } /** - * A matcher for an {@link io.helidon.common.http.Headers} that checks that the header is present, ignoring its value. + * A matcher for an {@link io.helidon.http.Headers} that checks that the header is present, ignoring its value. *

* Usage example: *

@@ -58,7 +58,7 @@ public static Matcher noHeader(HeaderName name) {
      * 
* * @param name header name - * @return matcher validating the {@link io.helidon.common.http.Headers} does contain the provided header regardless of its + * @return matcher validating the {@link io.helidon.http.Headers} does contain the provided header regardless of its * value(s) */ public static Matcher hasHeader(HeaderName name) { @@ -66,7 +66,7 @@ public static Matcher hasHeader(HeaderName name) { } /** - * A matcher for an {@link io.helidon.common.http.Headers} that checks that the header is present and has the defined + * A matcher for an {@link io.helidon.http.Headers} that checks that the header is present and has the defined * value. *

* Usage example: @@ -75,14 +75,14 @@ public static Matcher hasHeader(HeaderName name) { * * * @param header http header with values - * @return matcher validating the {@link io.helidon.common.http.Headers} does contain the provided header + * @return matcher validating the {@link io.helidon.http.Headers} does contain the provided header */ public static Matcher hasHeader(Http.Header header) { return new HasValueMatcher(header); } /** - * A matcher for an {@link io.helidon.common.http.Headers} that checks that the header is present and has the defined + * A matcher for an {@link io.helidon.http.Headers} that checks that the header is present and has the defined * value(s). *

* Usage example: @@ -92,14 +92,14 @@ public static Matcher hasHeader(Http.Header header) { * * @param name http header name * @param value value(s) of the header - * @return matcher validating the {@link io.helidon.common.http.Headers} does contain the provided header + * @return matcher validating the {@link io.helidon.http.Headers} does contain the provided header */ public static Matcher hasHeader(Http.HeaderName name, String... value) { return new HasValueMatcher(Http.Headers.create(name, value)); } /** - * A matcher for an {@link io.helidon.common.http.Headers} that checks that the header is present and values + * A matcher for an {@link io.helidon.http.Headers} that checks that the header is present and values * match the provided matcher. *

* Usage example: @@ -109,14 +109,14 @@ public static Matcher hasHeader(Http.HeaderName name, String... value) * * @param name header name * @param valuesMatcher matcher to validate the values are OK - * @return matcher validating the {@link io.helidon.common.http.Headers} does contain the expected values + * @return matcher validating the {@link io.helidon.http.Headers} does contain the expected values */ public static Matcher hasHeader(HeaderName name, Matcher> valuesMatcher) { return new HasValueMatcher(name, valuesMatcher); } /** - * A matcher for an {@link io.helidon.common.http.Headers} that checks that the header is present and its single value + * A matcher for an {@link io.helidon.http.Headers} that checks that the header is present and its single value * matches the provided matcher. *

* Usage example: @@ -126,7 +126,7 @@ public static Matcher hasHeader(HeaderName name, Matcher hasHeaderValue(HeaderName name, Matcher valueMatcher) { return new HasSingleValueMatcher(name, valueMatcher); diff --git a/common/testing/http-junit5/src/main/java/io/helidon/common/testing/http/junit5/SocketHttpClient.java b/common/testing/http-junit5/src/main/java/io/helidon/common/testing/http/junit5/SocketHttpClient.java index cc0c4fbdcc9..c004bf956c0 100644 --- a/common/testing/http-junit5/src/main/java/io/helidon/common/testing/http/junit5/SocketHttpClient.java +++ b/common/testing/http-junit5/src/main/java/io/helidon/common/testing/http/junit5/SocketHttpClient.java @@ -33,9 +33,9 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import io.helidon.common.http.ClientResponseHeaders; -import io.helidon.common.http.Http; -import io.helidon.common.http.WritableHeaders; +import io.helidon.http.ClientResponseHeaders; +import io.helidon.http.Http; +import io.helidon.http.WritableHeaders; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.notNullValue; diff --git a/common/testing/http-junit5/src/main/java/module-info.java b/common/testing/http-junit5/src/main/java/module-info.java index 4c2bf0edf91..c488d84b289 100644 --- a/common/testing/http-junit5/src/main/java/module-info.java +++ b/common/testing/http-junit5/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022 Oracle and/or its affiliates. + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ */ module io.helidon.common.testing.http.junit5 { requires transitive io.helidon.common.testing.junit5; - requires io.helidon.common.http; + requires io.helidon.http; requires hamcrest.all; requires org.junit.jupiter.api; diff --git a/common/tls/etc/spotbugs/exclude.xml b/common/tls/etc/spotbugs/exclude.xml new file mode 100644 index 00000000000..20e7eb6e33c --- /dev/null +++ b/common/tls/etc/spotbugs/exclude.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + diff --git a/common/tls/pom.xml b/common/tls/pom.xml new file mode 100644 index 00000000000..55e293986b9 --- /dev/null +++ b/common/tls/pom.xml @@ -0,0 +1,100 @@ + + + + + 4.0.0 + + io.helidon.common + helidon-common-project + 4.0.0-SNAPSHOT + + + helidon-common-tls + Helidon Common TLS + + + etc/spotbugs/exclude.xml + + + + + io.helidon.common + helidon-common + + + io.helidon.config + helidon-config + + + io.helidon.common + helidon-common-key-util + + + io.helidon.common + helidon-common-config + + + io.helidon.config + helidon-config-metadata + true + + + io.helidon.builder + helidon-builder-api + true + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + io.helidon.builder + helidon-builder-processor + ${helidon.version} + + + io.helidon.common.processor + helidon-common-processor-helidon-copyright + ${helidon.version} + + + + + + io.helidon.builder + helidon-builder-processor + ${helidon.version} + + + io.helidon.common.processor + helidon-common-processor-helidon-copyright + ${helidon.version} + + + + + + diff --git a/nima/common/tls/src/main/java/io/helidon/nima/common/tls/ReloadableX509KeyManager.java b/common/tls/src/main/java/io/helidon/common/tls/ReloadableX509KeyManager.java similarity index 98% rename from nima/common/tls/src/main/java/io/helidon/nima/common/tls/ReloadableX509KeyManager.java rename to common/tls/src/main/java/io/helidon/common/tls/ReloadableX509KeyManager.java index 70ce6c68492..1bd03aecf83 100644 --- a/nima/common/tls/src/main/java/io/helidon/nima/common/tls/ReloadableX509KeyManager.java +++ b/common/tls/src/main/java/io/helidon/common/tls/ReloadableX509KeyManager.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.common.tls; +package io.helidon.common.tls; import java.net.Socket; import java.security.Principal; diff --git a/nima/common/tls/src/main/java/io/helidon/nima/common/tls/ReloadableX509TrustManager.java b/common/tls/src/main/java/io/helidon/common/tls/ReloadableX509TrustManager.java similarity index 98% rename from nima/common/tls/src/main/java/io/helidon/nima/common/tls/ReloadableX509TrustManager.java rename to common/tls/src/main/java/io/helidon/common/tls/ReloadableX509TrustManager.java index f5f12552b4f..4e73dfeedea 100644 --- a/nima/common/tls/src/main/java/io/helidon/nima/common/tls/ReloadableX509TrustManager.java +++ b/common/tls/src/main/java/io/helidon/common/tls/ReloadableX509TrustManager.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.common.tls; +package io.helidon.common.tls; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; diff --git a/nima/common/tls/src/main/java/io/helidon/nima/common/tls/Tls.java b/common/tls/src/main/java/io/helidon/common/tls/Tls.java similarity index 99% rename from nima/common/tls/src/main/java/io/helidon/nima/common/tls/Tls.java rename to common/tls/src/main/java/io/helidon/common/tls/Tls.java index 791eed61b1c..ceea42c7ad5 100644 --- a/nima/common/tls/src/main/java/io/helidon/nima/common/tls/Tls.java +++ b/common/tls/src/main/java/io/helidon/common/tls/Tls.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.common.tls; +package io.helidon.common.tls; import java.io.IOException; import java.io.UncheckedIOException; diff --git a/nima/common/tls/src/main/java/io/helidon/nima/common/tls/TlsClientAuth.java b/common/tls/src/main/java/io/helidon/common/tls/TlsClientAuth.java similarity index 94% rename from nima/common/tls/src/main/java/io/helidon/nima/common/tls/TlsClientAuth.java rename to common/tls/src/main/java/io/helidon/common/tls/TlsClientAuth.java index b6cd714e894..4074558892f 100644 --- a/nima/common/tls/src/main/java/io/helidon/nima/common/tls/TlsClientAuth.java +++ b/common/tls/src/main/java/io/helidon/common/tls/TlsClientAuth.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.common.tls; +package io.helidon.common.tls; /** * Type of client authentication. diff --git a/nima/common/tls/src/main/java/io/helidon/nima/common/tls/TlsConfigBlueprint.java b/common/tls/src/main/java/io/helidon/common/tls/TlsConfigBlueprint.java similarity index 99% rename from nima/common/tls/src/main/java/io/helidon/nima/common/tls/TlsConfigBlueprint.java rename to common/tls/src/main/java/io/helidon/common/tls/TlsConfigBlueprint.java index 5ff8deb11d6..eecb956c90b 100644 --- a/nima/common/tls/src/main/java/io/helidon/nima/common/tls/TlsConfigBlueprint.java +++ b/common/tls/src/main/java/io/helidon/common/tls/TlsConfigBlueprint.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.common.tls; +package io.helidon.common.tls; import java.security.PrivateKey; import java.security.SecureRandom; diff --git a/nima/common/tls/src/main/java/io/helidon/nima/common/tls/TlsConfigDecorator.java b/common/tls/src/main/java/io/helidon/common/tls/TlsConfigDecorator.java similarity index 99% rename from nima/common/tls/src/main/java/io/helidon/nima/common/tls/TlsConfigDecorator.java rename to common/tls/src/main/java/io/helidon/common/tls/TlsConfigDecorator.java index 1790df386c2..c16ef0f3642 100644 --- a/nima/common/tls/src/main/java/io/helidon/nima/common/tls/TlsConfigDecorator.java +++ b/common/tls/src/main/java/io/helidon/common/tls/TlsConfigDecorator.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.common.tls; +package io.helidon.common.tls; import java.io.IOException; import java.security.GeneralSecurityException; diff --git a/nima/common/tls/src/main/java/io/helidon/nima/common/tls/TlsInternalInfo.java b/common/tls/src/main/java/io/helidon/common/tls/TlsInternalInfo.java similarity index 96% rename from nima/common/tls/src/main/java/io/helidon/nima/common/tls/TlsInternalInfo.java rename to common/tls/src/main/java/io/helidon/common/tls/TlsInternalInfo.java index 6b428d8db7e..f4d80e741f3 100644 --- a/nima/common/tls/src/main/java/io/helidon/nima/common/tls/TlsInternalInfo.java +++ b/common/tls/src/main/java/io/helidon/common/tls/TlsInternalInfo.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.common.tls; +package io.helidon.common.tls; import java.util.List; diff --git a/nima/common/tls/src/main/java/io/helidon/nima/common/tls/TlsReloadableComponent.java b/common/tls/src/main/java/io/helidon/common/tls/TlsReloadableComponent.java similarity index 95% rename from nima/common/tls/src/main/java/io/helidon/nima/common/tls/TlsReloadableComponent.java rename to common/tls/src/main/java/io/helidon/common/tls/TlsReloadableComponent.java index cf2d305bb1c..0c604767460 100644 --- a/nima/common/tls/src/main/java/io/helidon/nima/common/tls/TlsReloadableComponent.java +++ b/common/tls/src/main/java/io/helidon/common/tls/TlsReloadableComponent.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.common.tls; +package io.helidon.common.tls; interface TlsReloadableComponent { diff --git a/nima/common/tls/src/main/java/io/helidon/nima/common/tls/TrustAllManagerFactory.java b/common/tls/src/main/java/io/helidon/common/tls/TrustAllManagerFactory.java similarity index 98% rename from nima/common/tls/src/main/java/io/helidon/nima/common/tls/TrustAllManagerFactory.java rename to common/tls/src/main/java/io/helidon/common/tls/TrustAllManagerFactory.java index 7c53583de0f..ff7da2b45cd 100644 --- a/nima/common/tls/src/main/java/io/helidon/nima/common/tls/TrustAllManagerFactory.java +++ b/common/tls/src/main/java/io/helidon/common/tls/TrustAllManagerFactory.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.common.tls; +package io.helidon.common.tls; import java.io.Serial; import java.security.KeyStore; diff --git a/common/tls/src/main/java/io/helidon/common/tls/package-info.java b/common/tls/src/main/java/io/helidon/common/tls/package-info.java new file mode 100644 index 00000000000..125f504ebc7 --- /dev/null +++ b/common/tls/src/main/java/io/helidon/common/tls/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * TLS Configuration for client and server. + */ +package io.helidon.common.tls; diff --git a/common/tls/src/main/java/module-info.java b/common/tls/src/main/java/module-info.java new file mode 100644 index 00000000000..0b21774923e --- /dev/null +++ b/common/tls/src/main/java/module-info.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * TLS configuration for client and server. + */ +module io.helidon.common.tls { + requires io.helidon.common; + requires io.helidon.common.pki; + + requires io.helidon.common.config; + + requires static io.helidon.builder.api; + requires static io.helidon.config.metadata; + + exports io.helidon.common.tls; +} \ No newline at end of file diff --git a/cors/pom.xml b/cors/pom.xml index 8c21acf5d1c..04f78165b7e 100644 --- a/cors/pom.xml +++ b/cors/pom.xml @@ -39,8 +39,8 @@ helidon-common-configurable - io.helidon.common - helidon-common-http + io.helidon.http + helidon-http io.helidon.config diff --git a/cors/src/main/java/io/helidon/cors/Aggregator.java b/cors/src/main/java/io/helidon/cors/Aggregator.java index 57ffbdb1ee4..33167701cc6 100644 --- a/cors/src/main/java/io/helidon/cors/Aggregator.java +++ b/cors/src/main/java/io/helidon/cors/Aggregator.java @@ -24,10 +24,10 @@ import io.helidon.common.config.Config; import io.helidon.common.config.ConfigValue; -import io.helidon.common.http.PathMatcher; -import io.helidon.common.http.PathMatchers; import io.helidon.common.uri.UriPath; import io.helidon.cors.LogHelper.MatcherChecks; +import io.helidon.http.PathMatcher; +import io.helidon.http.PathMatchers; /** * Collects CORS set-up information from various sources and looks up the relevant CORS information given a request's path and diff --git a/cors/src/main/java/io/helidon/cors/CorsRequestAdapter.java b/cors/src/main/java/io/helidon/cors/CorsRequestAdapter.java index 58f5299ada7..fa51bfc01f2 100644 --- a/cors/src/main/java/io/helidon/cors/CorsRequestAdapter.java +++ b/cors/src/main/java/io/helidon/cors/CorsRequestAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ import java.util.List; import java.util.Optional; -import io.helidon.common.http.Http; +import io.helidon.http.Http; /** * Not for use by developers. diff --git a/cors/src/main/java/io/helidon/cors/CorsResponseAdapter.java b/cors/src/main/java/io/helidon/cors/CorsResponseAdapter.java index 0bfd115444b..16f3de0b8fc 100644 --- a/cors/src/main/java/io/helidon/cors/CorsResponseAdapter.java +++ b/cors/src/main/java/io/helidon/cors/CorsResponseAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ package io.helidon.cors; -import io.helidon.common.http.Http; +import io.helidon.http.Http; /** * Not for use by developers. diff --git a/cors/src/main/java/io/helidon/cors/CorsSupportHelper.java b/cors/src/main/java/io/helidon/cors/CorsSupportHelper.java index be5a4b7a6cd..6031583dcd2 100644 --- a/cors/src/main/java/io/helidon/cors/CorsSupportHelper.java +++ b/cors/src/main/java/io/helidon/cors/CorsSupportHelper.java @@ -29,15 +29,15 @@ import java.util.logging.Logger; import io.helidon.common.config.Config; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderNames; import io.helidon.cors.LogHelper.Headers; +import io.helidon.http.Http; +import io.helidon.http.Http.HeaderNames; import static io.helidon.cors.LogHelper.DECISION_LEVEL; import static java.lang.Character.isDigit; /** - * Centralizes internal logic common to Reactive, Níma, and MP CORS support for processing requests and preparing responses. + * Centralizes internal CORS support common logic for processing requests and preparing responses. * *

This class is reserved for internal Helidon use. Do not use it from your applications. It might change or vanish at * any time.

diff --git a/cors/src/main/java/io/helidon/cors/LogHelper.java b/cors/src/main/java/io/helidon/cors/LogHelper.java index 21f0262bf49..cd34a7627a7 100644 --- a/cors/src/main/java/io/helidon/cors/LogHelper.java +++ b/cors/src/main/java/io/helidon/cors/LogHelper.java @@ -29,9 +29,9 @@ import java.util.logging.Logger; import java.util.stream.Collectors; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderNames; import io.helidon.cors.CorsSupportHelper.RequestType; +import io.helidon.http.Http; +import io.helidon.http.Http.HeaderNames; class LogHelper { diff --git a/cors/src/main/java/module-info.java b/cors/src/main/java/module-info.java index 326fc904a6b..dd31afdd6ad 100644 --- a/cors/src/main/java/module-info.java +++ b/cors/src/main/java/module-info.java @@ -15,11 +15,11 @@ */ /** - * CORS configuration and types shared between Helidon Reactive, Níma and MicroProfile. + * CORS configuration and types. */ module io.helidon.cors { requires java.logging; - requires io.helidon.common.http; + requires io.helidon.http; requires io.helidon.common.config; requires static io.helidon.config.metadata; diff --git a/docs-internal/connections.md b/docs-internal/connections.md new file mode 100644 index 00000000000..9b61324de9d --- /dev/null +++ b/docs-internal/connections.md @@ -0,0 +1,92 @@ +Connections +---- + +# Server Connection Providers + +WebServer uses SPI to discover how to handle a specific incoming connection. +The main entry point is `ServerConnectionProvider` - a service loader provider interface to discover +which connections are supported. + +We have the following implementations currently: + +- `Http1ConnectionProvider` - support for the usual HTTP/1.1 connections +- `Http2ConnectionProvider` - support for "prior-knowledge" HTTP/2 connections + +The connection provider creates a configured `ServerConnectionSelector`, which is then used at runtime. +The selector works based on initial bytes of the connection. + +# HTTP/1.1 Upgrade Providers + +HTTP/1.1 supports the concept of upgrading a connection. This is supported through +`Http1UpgradeProvider` - a service loader provider interface to discover which upgrades are supported. + +We have the following implementations currently: + +- `Http2UpgradeProvider` - upgrade to HTTP/2 using upgrade +- `WsUpgradeProvider` - upgrade to WebSocket implementation +- `TyrusUpgradeProvider` - upgrade to MP Tyrus WebSocket implementation (higher weight than WsUpgradeProvider) + +The upgrade provider creates a configured `Http1Upgrader`, which is then used at runtime. +Upgraders work based on protocol identificator (`h2c`, `websocket`). When more than one for the same protocol is configured, +the provider with higher weight will be used. + +# Configurability + +All connection providers, HTTP/1.1 upgrade providers and HTTP/2 sub-protocols are configured +under `server.connection-providers`, to have a single configuration of a protocol regardless whether this is accessed directly or +through upgrade mechanism. + +The configuration key is the one provided by the Connection provider, HTTP/1.1 Upgrade provider, or HTTP/2 SubProtocol +provider `configKey()` or `configKeys()` method. + +As all providers are configured on the same leave, each provider should have a descriptive and unique configuration key +relevant to its purpose. + +Example of such configuration (Tyrus and Helidon WebSocket both use `websocket`, as only one of them can be active): + +```yaml +server: + connection-providers: + http_1_1: + max-prologue-length: 4096 + websocket: + origins: [ "origin1" ] + http_2: + max-frame-size: 128000 + grpc: + something: "value" +``` + +Configuration levels: + +- `io.helidon.webserver.WebServer` + - `io.helidon.webserver.http.DirectHandlers` // should be configurable per socket, also HTTP only + - `io.helidon.common.context.Context` + - `io.helidon.http.media.MediaContext` - should be configurable per socket, HTTP only + - `io.helidon.http.encoding.ContentEncodingContext` - should be configurable per socket, HTTP only +- `io.helidon.webserver.ServerListener` (ListenerConfiguration) + +# Server Context and other contexts + +To access context related information of server and connection, the following types are available for connections: + +- `io.helidon.webserver.ListenerContext` - listener specific + - Helidon Context + - Media context + - Content encoding context +- `io.helidon.common.socket.SocketContext` - socket specific (as in TCP socket) + - remote and local peers + - socket ids (client and server) + - methods to log socket related information in a single format +- `io.helidon.webserver.ConnectionContext extends SocketContext` - connection specific (established connection for a + listener) + - listener context + - executor service + - data writer + - data reader + - router + +what we need + +- access to server config/socket configuration (so we do not need to repeat the configuration again on contexts) +- should we use composition or inheritance? \ No newline at end of file diff --git a/docs-internal/feature-catalog.md b/docs-internal/feature-catalog.md index 3958fab8b27..66a156fc706 100644 --- a/docs-internal/feature-catalog.md +++ b/docs-internal/feature-catalog.md @@ -27,14 +27,14 @@ import io.helidon.common.features.api.HelidonFlavor; import io.helidon.common.features.api.Preview; /** - * GraphQL server integration with Helidon Reactive WebServer. + * GraphQL server integration with Helidon WebServer. */ @Preview @Feature(value = "GraphQL", in = HelidonFlavor.SE, - invalidIn = {HelidonFlavor.MP, HelidonFlavor.NIMA}) + invalidIn = {HelidonFlavor.MP}) @Aot(description = "Incubating support, tested on limited use cases") -module io.helidon.nima.graphql.server { +module io.helidon.webserver.graphql { requires static io.helidon.common.features.api; // other module dependencies and configuration } diff --git a/docs-internal/http-features.md b/docs-internal/http-features.md new file mode 100644 index 00000000000..251495da5dd --- /dev/null +++ b/docs-internal/http-features.md @@ -0,0 +1,21 @@ +Features +---- + +# Weights + +| Feature | Weight | +|------------------------|--------| +| Context | 1100 | +| Access Log | 1000 | +| Tracing | 900 | +| Security | 800 | +| Routing (all handlers) | 100 | +| Observe | 80 | + +Reasoning: +- context is needed for security (and for access log when security is used) +- access log needs to log every request (even ones that fail security) +- tracing should trace as much as possible that is happening in Helidon, and may register stuff to context +- security evaluates authentication and authorization and may forbid access to other routes +- routing - all registered filters and handlers are added with this weight (to allow features that pick up requests that were not processed at all) +- Observability feature - after business routes \ No newline at end of file diff --git a/docs-internal/nima-connections.md b/docs-internal/nima-connections.md deleted file mode 100644 index ae53062e2fb..00000000000 --- a/docs-internal/nima-connections.md +++ /dev/null @@ -1,92 +0,0 @@ -Connections ----- - -# Server Connection Providers - -Níma server uses SPI to discover how to handle a specific incoming connection. -The main entry point is `ServerConnectionProvider` - a service loader provider interface to discover -which connections are supported. - -We have the following implementations currently: - -- `Http1ConnectionProvider` - support for the usual HTTP/1.1 connections -- `Http2ConnectionProvider` - support for "prior-knowledge" HTTP/2 connections - -The connection provider creates a configured `ServerConnectionSelector`, which is then used at runtime. -The selector works based on initial bytes of the connection. - -# HTTP/1.1 Upgrade Providers - -HTTP/1.1 supports the concept of upgrading a connection. This is supported through -`Http1UpgradeProvider` - a service loader provider interface to discover which upgrades are supported. - -We have the following implementations currently: - -- `Http2UpgradeProvider` - upgrade to HTTP/2 using upgrade -- `WsUpgradeProvider` - upgrade to Níma WebSocket implementation -- `TyrusUpgradeProvider` - upgrade to MP Tyrus WebSocket implementation (higher weight than WsUpgradeProvider) - -The upgrade provider creates a configured `Http1Upgrader`, which is then used at runtime. -Upgraders work based on protocol identificator (`h2c`, `websocket`). When more than one for the same protocol is configured, -the provider with higher weight will be used. - -# Configurability - -All of connection providers, HTTP/1.1 upgrade providers and HTTP/2 subprotocols are configured -under `server.connection-providers`, to have a single configuration of a protocol regardless whether this is accessed directly or -through upgrade mechanism. - -The configuration key is the one provided by the Connection provider, HTTP/1.1 Upgrade provider, or HTTP/2 SubProtocol -provider `configKey()` or `configKeys()` method. - -As all providers are configured on the same leave, each provider should have a descriptive and unique configuration key -relevant to its purpose. - -Example of such configuration (Tyrus and Níma WebSocket both use `websocket`, as only one of them can be active): - -```yaml -server: - connection-providers: - http_1_1: - max-prologue-length: 4096 - websocket: - origins: [ "origin1" ] - http_2: - max-frame-size: 128000 - grpc: - something: "value" -``` - -Configuration levels: - -- `io.helidon.nima.webserver.WebServer` - - `io.helidon.nima.webserver.http.DirectHandlers` // should be configurable per socket, also HTTP only - - `io.helidon.common.context.Context` - - `io.helidon.nima.http.media.MediaContext` - should be configurable per socket, HTTP only - - `io.helidon.nima.http.encoding.ContentEncodingContext` - should be configurable per socket, HTTP only -- `io.helidon.nima.webserver.ServerListener` (ListenerConfiguration) - -# Server Context and other contexts - -To access context related information of server and connection, the following types are available for connections: - -- `io.helidon.nima.webserver.ListenerContext` - listener specific - - Helidon Context - - Media context - - Content encoding context -- `io.helidon.common.socket.SocketContext` - socket specific (as in TCP socket) - - remote and local peers - - socket ids (client and server) - - methods to log socket related information in a single format -- `io.helidon.nima.webserver.ConnectionContext extends SocketContext` - connection specific (established connection for a - listener) - - listener context - - executor service - - data writer - - data reader - - router - -what we need - -- access to server config/socket configuration (so we do not need to repeat the configuration again on contexts) -- should we use composition or inheritance? \ No newline at end of file diff --git a/docs-internal/nima-http-features.md b/docs-internal/nima-http-features.md deleted file mode 100644 index c55bb04b343..00000000000 --- a/docs-internal/nima-http-features.md +++ /dev/null @@ -1,21 +0,0 @@ -Features ----- - -# Weights - -| Feature | Weight | -| ---------------- |--------| -| Context | 1100 | -| Access Log | 1000 | -| Tracing | 900 | -| Security | 800 | -| Routing (all handlers) | 100 | -| Observe | 80 | - -Reasoning: -- context is needed for security (and for access log when security is used) -- access log needs to log every request (even ones that fail security) -- tracing should trace as much as possible that is happening in Helidon, and may register stuff to context -- security evaluates authentication and authorization and may forbid access to other routes -- routing - all registered filters and handlers are added with this weight (to allow features that pick up requests that were not processed at all) -- Observability feature - after business routes \ No newline at end of file diff --git a/docs-internal/nima-testing.md b/docs-internal/nima-testing.md deleted file mode 100644 index 733cffeb3c4..00000000000 --- a/docs-internal/nima-testing.md +++ /dev/null @@ -1,46 +0,0 @@ -Testing ----- -There are two annotations that can be used to test Níma server. -`@ServerTest` is an integration test annotation, that starts server (opens ports) and provides client injection pre-configured for -the server port(s). -`@RoutingTest` is a unit test annotation, that does not start server and does not open ports, but provides direct client (with -same API as the usual network client) to test routing. - -Extensions can exist that enhance the features for the module `helidon-nima-testing-junit5-webserver` to support additional -protocols. Known are listed here. - -The following table lists supported types of parameters for `@SetUpRoute` annotated methods. Such methods MUST be static, -and may have any name. `@SetUpRoute` annotation has `value` with socket name (to customize setup for a different socket). - -- Parameter type - supported class of a parameter -- Annotation - which annotation(s) support this parameter -- Modules - which Níma extension modules support this signature - -| Parameter Type | Annotation | Modules | Notes | -|----------------------------|-------------------------------|-----------|---------------------------------------------------| -| `HttpRouting.Builder` | `@ServerTest`, `@RoutingTest` | | | -| `HttpRules` | `@ServerTest`, `@RoutingTest` | | Same as `HttpRouting.Builder`, only routing setup | -| `Router.RouterBuilder` | `@ServerTest`, `@RoutingTest` | | | -| `SocketListener.Builder` | `@ServerTest` | | | -| `WebSocketRouting.Builder` | `@ServerTest`, `@RoutingTest` | websocket | | - -In addition, a static method annotated with `@SetUpServer` can be defined for `@ServerTest`, that has a single parameter -of `WebServer.Builder`. - -The following table lists injectable types (through constructor or method injection). - -- Type - type that can be injected -- Socket? - if checked, you can use `@Socket` annotation to obtain value specific to that named socket -- Annotation - which annotation(s) support this injection -- Modules - which Níma extension modules support this injection -- Notes - additional details - -| Type | Socket? | Annotation | Modules | Notes | -|--------------------|---------|----------------|-----------|-----------------------------------------------------------------------| -| `WebServer` | | `@ServerTest` | | Server instance (already started) | -| `URI` | x | `@ServerTest` | | URI pointing to a port of the webserver | -| `SocketHttpClient` | x | `@ServerTest` | | Client that allows sending of anything, to test bad request and such. | -| `Http1Client` | x | `@ServerTest` | | | -| `DirectClient` | x | `@RoutingTest` | | Implements `Http1Client` API | -| `WsClient` | x | `@ServerTest` | websocket | | -| `DirectWsClient` | x | `@RoutingTest` | websocket | Implements `WsClient` API | diff --git a/docs-internal/testing.md b/docs-internal/testing.md new file mode 100644 index 00000000000..931e7298aa7 --- /dev/null +++ b/docs-internal/testing.md @@ -0,0 +1,46 @@ +Testing +---- +There are two annotations that can be used for WebServer tests. +`@ServerTest` is an integration test annotation, that starts server (opens ports) and provides client injection pre-configured for +the server port(s). +`@RoutingTest` is a unit test annotation, that does not start server and does not open ports, but provides direct client (with +same API as the usual network client) to test routing. + +Extensions can exist that enhance the features for the module `helidon-webserver-testing-junit5` to support additional +protocols. Known are listed here. + +The following table lists supported types of parameters for `@SetUpRoute` annotated methods. Such methods MUST be static, +and may have any name. `@SetUpRoute` annotation has `value` with socket name (to customize setup for a different socket). + +- Parameter type - supported class of a parameter +- Annotation - which annotation(s) support this parameter +- Modules - which extension modules support this signature + +| Parameter Type | Annotation | Modules | Notes | +|----------------------------|-------------------------------|-----------|---------------------------------------------------| +| `HttpRouting.Builder` | `@ServerTest`, `@RoutingTest` | | | +| `HttpRules` | `@ServerTest`, `@RoutingTest` | | Same as `HttpRouting.Builder`, only routing setup | +| `Router.RouterBuilder` | `@ServerTest`, `@RoutingTest` | | | +| `SocketListener.Builder` | `@ServerTest` | | | +| `WebSocketRouting.Builder` | `@ServerTest`, `@RoutingTest` | websocket | | + +In addition, a static method annotated with `@SetUpServer` can be defined for `@ServerTest`, that has a single parameter +of `WebServer.Builder`. + +The following table lists injectable types (through constructor or method injection). + +- Type - type that can be injected +- Socket? - if checked, you can use `@Socket` annotation to obtain value specific to that named socket +- Annotation - which annotation(s) support this injection +- Modules - which extension modules support this injection +- Notes - additional details + +| Type | Socket? | Annotation | Modules | Notes | +|--------------------|---------|----------------|-----------|-----------------------------------------------------------------------| +| `WebServer` | | `@ServerTest` | | Server instance (already started) | +| `URI` | x | `@ServerTest` | | URI pointing to a port of the webserver | +| `SocketHttpClient` | x | `@ServerTest` | | Client that allows sending of anything, to test bad request and such. | +| `Http1Client` | x | `@ServerTest` | | | +| `DirectClient` | x | `@RoutingTest` | | Implements `Http1Client` API | +| `WsClient` | x | `@ServerTest` | websocket | | +| `DirectWsClient` | x | `@RoutingTest` | websocket | Implements `WsClient` API | diff --git a/docs/about/doc_overview.adoc b/docs/about/doc_overview.adoc index 1ad64ae8e7c..43b623a6739 100644 --- a/docs/about/doc_overview.adoc +++ b/docs/about/doc_overview.adoc @@ -18,7 +18,7 @@ = Helidon Documentation :description: Helidon -:keywords: helidon, java, microservices, microprofile, documentation, nima +:keywords: helidon, java, microservices, microprofile, documentation :rootdir: {docdir}/.. Check out the xref:{rootdir}/about/doc_sitemap.adoc[Documentation Overview] for information about this site and the materials we provide. @@ -53,7 +53,7 @@ xref:{rootdir}/about/intro.adoc[What's New in Helidon 4] .Getting Started [icon=rocket_launch] -- -There are several ways to generate your first Helidon project. In a hurry? Try the Helidon CLI or Project Starter which provide a set of predefined archetypes to choose from. +There are several ways to generate your first Helidon project. In a hurry? Try the Helidon CLI or Project Starter which provide a set of predefined archetypes to choose from. xref:{rootdir}/about/prerequisites.adoc[Prerequisites and System Requirements] @@ -92,7 +92,7 @@ xref:{rootdir}/se/guides/migration.adoc[Upgrade From Helidon SE 2.x] .Developing Your First Application From Scratch [icon=terminal] -- -Use these hands-on development tutorials to learn how to generate a small "Hello World!" greeting service that demonstrates some of Helidon's core features. +Use these hands-on development tutorials to learn how to generate a small "Hello World!" greeting service that demonstrates some of Helidon's core features. xref:{rootdir}/mp/guides/mp-tutorial.adoc[Helidon MP Tutorial] @@ -114,7 +114,7 @@ xref:{rootdir}/mp/guides/overview.adoc[MP Guides] -- //Advanced Features [CARD] -.Advanced Features +.Advanced Features [icon=swap_horiz] -- diff --git a/docs/about/doc_sitemap.adoc b/docs/about/doc_sitemap.adoc index 7de6fe463f5..626c9cc887b 100644 --- a/docs/about/doc_sitemap.adoc +++ b/docs/about/doc_sitemap.adoc @@ -23,13 +23,13 @@ == Using This Site -Welcome to the Helidon documentation site. Here you will find general concepts, quickstart guides, tutorials and reference material. Existing Helidon users can go directly to their preferred programming flavor in the navigation panel to the left. +Welcome to the Helidon documentation site. Here you will find general concepts, quickstart guides, tutorials and reference material. Existing Helidon users can go directly to their preferred programming flavor in the navigation panel to the left. === New Users New to Helidon? Start with the xref:{rootdir}/about/introduction.adoc[Helidon Documentation] page. Here you will find some of the most common topics for getting started as well as easy first steps for building your first project or application. -Once you've settled on your preferred programming framework, visit the Helidon flavor sections of this site for more information. +Once you've settled on your preferred programming framework, visit the Helidon flavor sections of this site for more information. * xref:{rootdir}/se/introduction.adoc[Helidon SE] * xref:{rootdir}/mp/introduction.adoc[Helidon MP] @@ -37,11 +37,11 @@ Once you've settled on your preferred programming framework, visit the Helidon f === Existing Helidon Users -Welcome back! The documentation site has a couple of new features that we hope will make your experience here a bit easier. +Welcome back! The documentation site has a couple of new features that we hope will make your experience here a bit easier. -The new xref:{rootdir}/about/introduction.adoc[Helidon Documentation] page offers quick links to some of our most popular topics, including our new training and certification programs. +The new xref:{rootdir}/about/introduction.adoc[Helidon Documentation] page offers quick links to some of our most popular topics, including our new training and certification programs. -Check out the xref:{rootdir}/about/intro.adoc[What's New in Helidon 4] for a list of new features and functionality. +Check out the xref:{rootdir}/about/intro.adoc[What's New in Helidon 4] for a list of new features and functionality. diff --git a/docs/config/io_helidon_common_http_RequestedUriDiscoveryContext.adoc b/docs/config/io_helidon_common_http_RequestedUriDiscoveryContext.adoc index 1da541f2c10..a75bfc9ea1b 100644 --- a/docs/config/io_helidon_common_http_RequestedUriDiscoveryContext.adoc +++ b/docs/config/io_helidon_common_http_RequestedUriDiscoveryContext.adoc @@ -17,9 +17,9 @@ /////////////////////////////////////////////////////////////////////////////// ifndef::rootdir[:rootdir: {docdir}/..] -:description: Configuration of io.helidon.common.http.RequestedUriDiscoveryContext -:keywords: helidon, config, io.helidon.common.http.RequestedUriDiscoveryContext -:basic-table-intro: The table below lists the configuration keys that configure io.helidon.common.http.RequestedUriDiscoveryContext +:description: Configuration of io.helidon.http.RequestedUriDiscoveryContext +:keywords: helidon, config, io.helidon.http.RequestedUriDiscoveryContext +:basic-table-intro: The table below lists the configuration keys that configure io.helidon.http.RequestedUriDiscoveryContext include::{rootdir}/includes/attributes.adoc[] = RequestedUriDiscoveryContext (common.http) Configuration @@ -27,7 +27,7 @@ include::{rootdir}/includes/attributes.adoc[] // tag::config[] -Type: link:{javadoc-base-url}/io.helidon.common.http/io/helidon/common/http/RequestedUriDiscoveryContext.html[io.helidon.common.http.RequestedUriDiscoveryContext] +Type: link:{javadoc-base-url}/io.helidon.http/io/helidon/http/RequestedUriDiscoveryContext.html[io.helidon.http.RequestedUriDiscoveryContext] diff --git a/docs/config/io_helidon_reactive_webserver_SocketConfiguration.adoc b/docs/config/io_helidon_reactive_webserver_SocketConfiguration.adoc index 61542529dd6..d9099e110be 100644 --- a/docs/config/io_helidon_reactive_webserver_SocketConfiguration.adoc +++ b/docs/config/io_helidon_reactive_webserver_SocketConfiguration.adoc @@ -77,7 +77,7 @@ Type: link:{javadoc-base-url}/io.helidon.reactive.webserver/io/helidon/reactive/ Default is `false` |`host` |string |{nbsp} |A helper method that just calls #bindAddress(String). |`max-header-size` |int |`16384` |Maximal number of bytes of all header values combined. When a bigger value is received, a - io.helidon.common.http.Http.Status#BAD_REQUEST_400 + io.helidon.http.Http.Status#BAD_REQUEST_400 is returned. Default is `16384` diff --git a/docs/config/io_helidon_reactive_webserver_SocketConfiguration_SocketConfigurationBuilder.adoc b/docs/config/io_helidon_reactive_webserver_SocketConfiguration_SocketConfigurationBuilder.adoc index 222839fcd16..c7b83460213 100644 --- a/docs/config/io_helidon_reactive_webserver_SocketConfiguration_SocketConfigurationBuilder.adoc +++ b/docs/config/io_helidon_reactive_webserver_SocketConfiguration_SocketConfigurationBuilder.adoc @@ -68,7 +68,7 @@ Type: link:{javadoc-base-url}/io.helidon.reactive.webserver.SocketConfiguration/ Default is `false` |`host` |string |{nbsp} |A helper method that just calls #bindAddress(String). |`max-header-size` |int |`16384` |Maximal number of bytes of all header values combined. When a bigger value is received, a - io.helidon.common.http.Http.Status#BAD_REQUEST_400 + io.helidon.http.Http.Status#BAD_REQUEST_400 is returned. Default is `16384` diff --git a/docs/config/io_helidon_reactive_webserver_WebServer.adoc b/docs/config/io_helidon_reactive_webserver_WebServer.adoc index fb2f581270c..09f007e33ed 100644 --- a/docs/config/io_helidon_reactive_webserver_WebServer.adoc +++ b/docs/config/io_helidon_reactive_webserver_WebServer.adoc @@ -73,7 +73,7 @@ This is a standalone configuration type, prefix from configuration root: `server |`features.print-details` |boolean |`false` |Set to `true` to print detailed feature information on startup. |`host` |string |{nbsp} |A helper method that just calls #bindAddress(String). |`max-header-size` |int |`16384` |Maximal number of bytes of all header values combined. When a bigger value is received, a - io.helidon.common.http.Http.Status#BAD_REQUEST_400 + io.helidon.http.Http.Status#BAD_REQUEST_400 is returned. Default is `16384` diff --git a/docs/includes/attributes.adoc b/docs/includes/attributes.adoc index 2b801136cf5..032c0aa9348 100644 --- a/docs/includes/attributes.adoc +++ b/docs/includes/attributes.adoc @@ -187,7 +187,7 @@ endif::[] :javadoc-base-url: {base-url}/apidocs // Helidon component javadoc base URLs -:common-http-javadoc-base-url: {javadoc-base-url}/io.helidon.common.http +:http-javadoc-base-url: {javadoc-base-url}/io.helidon.http :config-javadoc-base-url: {javadoc-base-url}/io.helidon.config :configurable-javadoc-base-url: {javadoc-base-url}/apidocs/io.helidon.common.configurable :faulttolerance-javadoc-base-url: {javadoc-base-url}/io.helidon.reactive.faulttolerance @@ -225,7 +225,7 @@ endif::[] :security-provider-abac-base-url: {javadoc-base-url}/io.helidon.security.providers.abac :security-provider-google-login-base-url: {javadoc-base-url}/io.helidon.security.providers.google.login :security-provider-jwt-base-url: {javadoc-base-url}/io.helidon.security.providers.jwt -:nima-faulttolerance-javadoc-base-url: {javadoc-base-url}/io.helidon.nima.faulttolerance +:faulttolerance-javadoc-base-url: {javadoc-base-url}/io.helidon.faulttolerance // 3rd party versioned URLs :jaeger-doc-base-url: https://www.jaegertracing.io/docs/{version-lib-jaeger} diff --git a/docs/mp/guides/jbatch.adoc b/docs/mp/guides/jbatch.adoc index 66a841be575..7395e1eb6c8 100644 --- a/docs/mp/guides/jbatch.adoc +++ b/docs/mp/guides/jbatch.adoc @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////// - Copyright (c) 2022 Oracle and/or its affiliates. + Copyright (c) 2022, 2023 Oracle and/or its affiliates. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -214,20 +214,20 @@ Add this code to your job descriptor.xml file: version="2.0"> - - - + + + - + ---- <1> The first step of the job includes `MyItemReader`, `MyItemProcessor` and `MyItemWriter`. <2> The second step of the job includes `MyBatchlet`. -NOTE: You must specify the fully qualified names in the `ref` properties, like “io.helidon.jbatch.example.jobs.MyItemReader”, otherwise it will not work. +NOTE: You must specify the fully qualified names in the `ref` properties, like “jobs.io.helidon.examples.jbatch.MyItemReader”, otherwise it will not work. == Create an Endpoint Create a small endpoint to activate the job: diff --git a/docs/mp/server.adoc b/docs/mp/server.adoc index 93b58d05c12..b4fd66f4dd5 100644 --- a/docs/mp/server.adoc +++ b/docs/mp/server.adoc @@ -381,7 +381,7 @@ Helidon makes the requested URI information available as a property in the reque [source,java] .Retrieving Requested URI Information ---- -import io.helidon.common.http.UriInfo; +import io.helidon.http.UriInfo; public class MyFilter implements ContainerRequestFilter { @@ -392,7 +392,7 @@ public class MyFilter implements ContainerRequestFilter { } } ---- -See the link:{common-http-javadoc-base-url}/io/helidon/common/http/UriInfo.html[`UriInfo`] JavaDoc for more information. +See the link:{http-javadoc-base-url}/io/helidon/common/http/UriInfo.html[`UriInfo`] JavaDoc for more information. NOTE: The `requestContext.getUriInfo()` method returns the Jakarta RESTful web services `UriInfo` object, _not_ the Helidon-provided requested URI information `UriInfo` record. diff --git a/docs/se/guides/dbclient.adoc b/docs/se/guides/dbclient.adoc index 4a2466abff9..8d65159ce03 100644 --- a/docs/se/guides/dbclient.adoc +++ b/docs/se/guides/dbclient.adoc @@ -341,7 +341,7 @@ Create LibraryService class into `io.helidon.examples.quickstart.se` package. ---- package io.helidon.examples.quickstart.se; -import io.helidon.common.http.Http; // <1> +import io.helidon.http.Http; // <1> import io.helidon.reactive.dbclient.DbClient; import io.helidon.reactive.webserver.Routing; import io.helidon.reactive.webserver.ServerRequest; diff --git a/docs/se/guides/security-oidc.adoc b/docs/se/guides/security-oidc.adoc index 090fb696ead..a5348d78623 100644 --- a/docs/se/guides/security-oidc.adoc +++ b/docs/se/guides/security-oidc.adoc @@ -508,8 +508,8 @@ In the `MainTest.java` file, tests need to be modified to check the application [source,java] .Import the following class: ---- -import java.util.Base64; -import io.helidon.common.http.Http; + +import io.helidon.http.Http; ---- [source,java] diff --git a/docs/se/guides/tracing.adoc b/docs/se/guides/tracing.adoc index 542f49bd7af..eee4e170785 100644 --- a/docs/se/guides/tracing.adoc +++ b/docs/se/guides/tracing.adoc @@ -453,7 +453,7 @@ call it. ---- package io.helidon.examples.quickstart.se; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.config.Config; import io.helidon.tracing.jersey.client.ClientTracingFilter; import io.helidon.reactive.webserver.Routing; diff --git a/docs/se/guides/webclient.adoc b/docs/se/guides/webclient.adoc index 286df895b23..a1276ed7305 100644 --- a/docs/se/guides/webclient.adoc +++ b/docs/se/guides/webclient.adoc @@ -290,7 +290,7 @@ that can be used with any metric. [source,java] .Example of metric creation: ---- -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.metrics.RegistryFactory; import io.helidon.reactive.webclient.metrics.WebClientMetrics; import io.helidon.reactive.webclient.spi.WebClientService; diff --git a/docs/se/webserver.adoc b/docs/se/webserver.adoc index 9cde7da893a..e2fdfb42a67 100644 --- a/docs/se/webserver.adoc +++ b/docs/se/webserver.adoc @@ -328,8 +328,8 @@ To set up requested URI discovery on the default socket for your server, use the .Requested URI set-up for the default server socket ---- import io.helidon.common.configurable.AllowList; -import static io.helidon.common.http.RequestedUriDiscoveryContext.RequestedUriDiscoveryType.FORWARDED; -import static io.helidon.common.http.RequestedUriDiscoveryContext.RequestedUriDiscoveryType.X_FORWARDED; +import static io.helidon.http.RequestedUriDiscoveryContext.RequestedUriDiscoveryType.FORWARDED; +import static io.helidon.http.RequestedUriDiscoveryContext.RequestedUriDiscoveryType.X_FORWARDED; AllowList trustedProxies = AllowList.builder() .addAllowedPattern(Pattern.compile("lb.+\\.mycorp\\.com")) @@ -376,7 +376,7 @@ Your code obtains the requested URI information from the Helidon server request [source,java] .Retrieving Requested URI Information ---- -import io.helidon.common.http.UriInfo; +import io.helidon.http.UriInfo; public class MyHandler implements Handler { @@ -387,7 +387,7 @@ public class MyHandler implements Handler { } } ---- -See the link:{common-http-javadoc-base-url}/io/helidon/common/http/UriInfo.html[`UriInfo`] JavaDoc for more information. +See the link:{http-javadoc-base-url}/io/helidon/common/http/UriInfo.html[`UriInfo`] JavaDoc for more information. == Error Handling diff --git a/etc/checkstyle-suppressions.xml b/etc/checkstyle-suppressions.xml index c9310d82fe8..179df7b43bd 100644 --- a/etc/checkstyle-suppressions.xml +++ b/etc/checkstyle-suppressions.xml @@ -58,23 +58,26 @@ files="DerUtils\.java"/> - - - - + + - @@ -129,5 +132,4 @@ - diff --git a/etc/scripts/includes/pipeline-env.sh b/etc/scripts/includes/pipeline-env.sh index 2d8aea3813b..d0c36da3554 100644 --- a/etc/scripts/includes/pipeline-env.sh +++ b/etc/scripts/includes/pipeline-env.sh @@ -69,7 +69,7 @@ if [ -z "${__PIPELINE_ENV_INCLUDED__}" ]; then export PIPELINE="true" MAVEN_ARGS="${MAVEN_ARGS} -B ${MAVEN_HTTP_ARGS}" export MAVEN_ARGS - # temporary fix for copyright plugin (currently fails on big renaming action for Nima) + # temporary fix for copyright plugin git config diff.renameLimit 32768 fi @@ -130,7 +130,7 @@ if [ -z "${__PIPELINE_ENV_INCLUDED__}" ]; then GPG_KEYGRIP=$(gpg --with-keygrip -K | grep "Keygrip" | head -1 | awk '{print $3}') /usr/lib/gnupg/gpg-preset-passphrase --preset "${GPG_KEYGRIP}" <<< "${GPG_PASSPHRASE}" fi - # temporary fix for copyright plugin (currently fails on big renaming action for Nima) + # temporary fix for copyright plugin git config diff.renameLimit 32768 fi diff --git a/etc/scripts/test-packaging-native.sh b/etc/scripts/test-packaging-native.sh index 7b90b02862d..b7311b891d4 100755 --- a/etc/scripts/test-packaging-native.sh +++ b/etc/scripts/test-packaging-native.sh @@ -57,7 +57,7 @@ mvn ${MAVEN_ARGS} -e clean install # Build native images # TODO:java19 -readonly native_image_tests="nima-1" +readonly native_image_tests="se-1" for native_test in ${native_image_tests}; do cd ${WS_DIR}/tests/integration/native-image/${native_test} mvn ${MAVEN_ARGS} -e clean package -Pnative-image @@ -69,6 +69,6 @@ done # cd ${WS_DIR}/tests/integration/native-image/mp-1 # ${WS_DIR}/tests/integration/native-image/mp-1/target/helidon-tests-native-image-mp-1 || true -# Run Nima-1 exiting on started -cd ${WS_DIR}/tests/integration/native-image/nima-1 -${WS_DIR}/tests/integration/native-image/nima-1/target/helidon-tests-native-image-nima-1 -Dexit.on.started=! || true +# Run se-1 exiting on started +cd ${WS_DIR}/tests/integration/native-image/se-1 +${WS_DIR}/tests/integration/native-image/se-1/target/helidon-tests-native-image-se-1 -Dexit.on.started=! || true diff --git a/examples/config/basics/README.md b/examples/config/basics/README.md index aa2aa316b1f..1031407da92 100644 --- a/examples/config/basics/README.md +++ b/examples/config/basics/README.md @@ -1,7 +1,7 @@ # Helidon Config Basic Example This example shows the basics of using Helidon SE Config. The -[Main.java](./src/main/java/io/helidon/config/examples/basics/Main.java) class shows: +[Main.java](src/main/java/io/helidon/examples/config/basics/Main.java) class shows: * loading configuration from a resource [`application.conf`](./src/main/resources/application.conf) on the classpath diff --git a/examples/config/basics/pom.xml b/examples/config/basics/pom.xml index 95f4be7c697..9b2af70acfb 100644 --- a/examples/config/basics/pom.xml +++ b/examples/config/basics/pom.xml @@ -28,14 +28,14 @@ io.helidon.examples.config helidon-examples-config-basics - Helidon Config Examples Basics + Helidon Examples Config Basics The simplest example shows how to use Configuration API. - io.helidon.config.examples.basics.Main + io.helidon.examples.config.basics.Main diff --git a/examples/config/basics/src/main/java/io/helidon/config/examples/basics/Main.java b/examples/config/basics/src/main/java/io/helidon/config/examples/basics/Main.java deleted file mode 100644 index b9b77b6b797..00000000000 --- a/examples/config/basics/src/main/java/io/helidon/config/examples/basics/Main.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2017, 2021 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.config.examples.basics; - -import java.nio.file.Path; -import java.util.List; - -import io.helidon.config.Config; - -import static io.helidon.config.ConfigSources.classpath; - -/** - * Basics example. - */ -public class Main { - - private Main() { - } - - /** - * Executes the example. - * - * @param args arguments - */ - public static void main(String... args) { - Config config = Config.create(classpath("application.conf")); - - int pageSize = config.get("app.page-size").asInt().get(); - - boolean storageEnabled = config.get("app.storageEnabled").asBoolean().orElse(false); - - List basicRange = config.get("app.basic-range").asList(Integer.class).get(); - - Path loggingOutputPath = config.get("logging.outputs.file.name").as(Path.class).get(); - - System.out.println(pageSize); - System.out.println(storageEnabled); - System.out.println(basicRange); - System.out.println(loggingOutputPath); - } - -} diff --git a/examples/config/basics/src/main/java/io/helidon/config/examples/basics/package-info.java b/examples/config/basics/src/main/java/io/helidon/config/examples/basics/package-info.java deleted file mode 100644 index 0d1a22169e2..00000000000 --- a/examples/config/basics/src/main/java/io/helidon/config/examples/basics/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2017, 2021 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * The simplest example shows how to use Configuration API. - */ -package io.helidon.config.examples.basics; diff --git a/examples/config/basics/src/main/java/io/helidon/examples/config/basics/Main.java b/examples/config/basics/src/main/java/io/helidon/examples/config/basics/Main.java new file mode 100644 index 00000000000..e5cae4a4688 --- /dev/null +++ b/examples/config/basics/src/main/java/io/helidon/examples/config/basics/Main.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.examples.config.basics; + +import java.nio.file.Path; +import java.util.List; + +import io.helidon.config.Config; + +import static io.helidon.config.ConfigSources.classpath; + +/** + * Basics example. + */ +public class Main { + + private Main() { + } + + /** + * Executes the example. + * + * @param args arguments + */ + public static void main(String... args) { + Config config = Config.create(classpath("application.conf")); + + int pageSize = config.get("app.page-size").asInt().get(); + + boolean storageEnabled = config.get("app.storageEnabled").asBoolean().orElse(false); + + List basicRange = config.get("app.basic-range").asList(Integer.class).get(); + + Path loggingOutputPath = config.get("logging.outputs.file.name").as(Path.class).get(); + + System.out.println(pageSize); + System.out.println(storageEnabled); + System.out.println(basicRange); + System.out.println(loggingOutputPath); + } + +} diff --git a/examples/config/basics/src/main/java/io/helidon/examples/config/basics/package-info.java b/examples/config/basics/src/main/java/io/helidon/examples/config/basics/package-info.java new file mode 100644 index 00000000000..266ea311291 --- /dev/null +++ b/examples/config/basics/src/main/java/io/helidon/examples/config/basics/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * The simplest example shows how to use Configuration API. + */ +package io.helidon.examples.config.basics; diff --git a/examples/config/changes/README.md b/examples/config/changes/README.md index cdab258cdc5..ca4e4a58871 100644 --- a/examples/config/changes/README.md +++ b/examples/config/changes/README.md @@ -5,7 +5,7 @@ configuration. ## Change notification -[`OnChangeExample.java`](./src/main/java/io/helidon/config/examples/changes/OnChangeExample.java): +[`OnChangeExample.java`](src/main/java/io/helidon/examples/config/changes/OnChangeExample.java): uses `Config.onChange`, passing either a method reference (a lambda expression would also work) which the config system invokes when the config source changes ) @@ -14,7 +14,7 @@ would also work) which the config system invokes when the config source changes Recall that once your application obtains a `Config` instance, its config values do not change. The -[`AsSupplierExample.java`](./src/main/java/io/helidon/config/examples/changes/AsSupplierExample.java) +[`AsSupplierExample.java`](src/main/java/io/helidon/examples/config/changes/AsSupplierExample.java) example shows how your application can get a config _supplier_ that always reports the latest config value for a key, including any changes made after your application obtained the `Config` object. Although this approach does not notify diff --git a/examples/config/changes/pom.xml b/examples/config/changes/pom.xml index a99f8cc35d4..c7e58b7211a 100644 --- a/examples/config/changes/pom.xml +++ b/examples/config/changes/pom.xml @@ -28,14 +28,14 @@ io.helidon.examples.config helidon-examples-config-changes - Helidon Config Examples Changes + Helidon Examples Config Changes The example shows how to use Configuration Changes API. - io.helidon.config.examples.changes.Main + io.helidon.examples.config.changes.Main diff --git a/examples/config/changes/src/main/java/io/helidon/config/examples/changes/Main.java b/examples/config/changes/src/main/java/io/helidon/config/examples/changes/Main.java deleted file mode 100644 index dd72f5e2a48..00000000000 --- a/examples/config/changes/src/main/java/io/helidon/config/examples/changes/Main.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2017, 2020 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.config.examples.changes; - -import java.io.IOException; -import java.util.concurrent.TimeUnit; -import java.util.logging.Logger; - -/** - * Config changes examples. - */ -public class Main { - - private static final Logger LOGGER = Logger.getLogger(Main.class.getName()); - - private Main() { - } - - /** - * Executes the example. - * - * @param args arguments - * @throws InterruptedException in case you cannot sleep - * @throws IOException in case of IO error - */ - public static void main(String... args) throws IOException, InterruptedException { - // subscribe using simple onChange function - new OnChangeExample().run(); - // use same Supplier instances to get up-to-date value - AsSupplierExample asSupplier = new AsSupplierExample(); - asSupplier.run(); - - // waiting for user made changes in config files - long sleep = 60; - LOGGER.info("Application is waiting " + sleep + " seconds for change..."); - TimeUnit.SECONDS.sleep(sleep); - - asSupplier.shutdown(); - LOGGER.info("Goodbye."); - } - -} diff --git a/examples/config/changes/src/main/java/io/helidon/config/examples/changes/package-info.java b/examples/config/changes/src/main/java/io/helidon/config/examples/changes/package-info.java deleted file mode 100644 index a8576e63d54..00000000000 --- a/examples/config/changes/src/main/java/io/helidon/config/examples/changes/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2017, 2021 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * The example shows how to use Configuration Changes API. - */ -package io.helidon.config.examples.changes; diff --git a/examples/config/changes/src/main/java/io/helidon/config/examples/changes/AsSupplierExample.java b/examples/config/changes/src/main/java/io/helidon/examples/config/changes/AsSupplierExample.java similarity index 97% rename from examples/config/changes/src/main/java/io/helidon/config/examples/changes/AsSupplierExample.java rename to examples/config/changes/src/main/java/io/helidon/examples/config/changes/AsSupplierExample.java index d1113130fef..33c6cc13461 100644 --- a/examples/config/changes/src/main/java/io/helidon/config/examples/changes/AsSupplierExample.java +++ b/examples/config/changes/src/main/java/io/helidon/examples/config/changes/AsSupplierExample.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020 Oracle and/or its affiliates. + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.config.examples.changes; +package io.helidon.examples.config.changes; import java.time.Duration; import java.util.Objects; diff --git a/examples/config/changes/src/main/java/io/helidon/examples/config/changes/Main.java b/examples/config/changes/src/main/java/io/helidon/examples/config/changes/Main.java new file mode 100644 index 00000000000..9b94bf3179e --- /dev/null +++ b/examples/config/changes/src/main/java/io/helidon/examples/config/changes/Main.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.examples.config.changes; + +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import java.util.logging.Logger; + +/** + * Config changes examples. + */ +public class Main { + + private static final Logger LOGGER = Logger.getLogger(Main.class.getName()); + + private Main() { + } + + /** + * Executes the example. + * + * @param args arguments + * @throws InterruptedException in case you cannot sleep + * @throws IOException in case of IO error + */ + public static void main(String... args) throws IOException, InterruptedException { + // subscribe using simple onChange function + new OnChangeExample().run(); + // use same Supplier instances to get up-to-date value + AsSupplierExample asSupplier = new AsSupplierExample(); + asSupplier.run(); + + // waiting for user made changes in config files + long sleep = 60; + LOGGER.info("Application is waiting " + sleep + " seconds for change..."); + TimeUnit.SECONDS.sleep(sleep); + + asSupplier.shutdown(); + LOGGER.info("Goodbye."); + } + +} diff --git a/examples/config/changes/src/main/java/io/helidon/config/examples/changes/OnChangeExample.java b/examples/config/changes/src/main/java/io/helidon/examples/config/changes/OnChangeExample.java similarity index 95% rename from examples/config/changes/src/main/java/io/helidon/config/examples/changes/OnChangeExample.java rename to examples/config/changes/src/main/java/io/helidon/examples/config/changes/OnChangeExample.java index aefc1fbe058..03b303dae5d 100644 --- a/examples/config/changes/src/main/java/io/helidon/config/examples/changes/OnChangeExample.java +++ b/examples/config/changes/src/main/java/io/helidon/examples/config/changes/OnChangeExample.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020 Oracle and/or its affiliates. + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.config.examples.changes; +package io.helidon.examples.config.changes; import java.util.logging.Logger; diff --git a/examples/config/changes/src/main/java/io/helidon/examples/config/changes/package-info.java b/examples/config/changes/src/main/java/io/helidon/examples/config/changes/package-info.java new file mode 100644 index 00000000000..6422ccbd838 --- /dev/null +++ b/examples/config/changes/src/main/java/io/helidon/examples/config/changes/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * The example shows how to use Configuration Changes API. + */ +package io.helidon.examples.config.changes; diff --git a/examples/config/git/README.md b/examples/config/git/README.md index 17317d06410..4b73456ffcc 100644 --- a/examples/config/git/README.md +++ b/examples/config/git/README.md @@ -10,7 +10,7 @@ has a branch named `test` that contains `application.conf` which sets the key `greeting` to value `hello`. (The Helidon team has created and populated this repository.) -The code in [`Main.java`](./src/main/java/io/helidon/config/examples/git/Main.java) +The code in [`Main.java`](src/main/java/io/helidon/examples/config/git/Main.java) uses the environment variable `ENVIRONMENT_NAME` to fetch the branch name in the GitHub repository to use; it uses `master` by default (which does _not_ contain the expected value). diff --git a/examples/config/git/pom.xml b/examples/config/git/pom.xml index 8a26e097724..483c2da946c 100644 --- a/examples/config/git/pom.xml +++ b/examples/config/git/pom.xml @@ -28,14 +28,14 @@ io.helidon.examples.config helidon-examples-config-git - Helidon Config Examples Git + Helidon Examples Config Git The example shows how to use GitConfigSource. - io.helidon.config.examples.git.Main + io.helidon.examples.config.git.Main diff --git a/examples/config/git/src/main/java/io/helidon/config/examples/git/Main.java b/examples/config/git/src/main/java/io/helidon/config/examples/git/Main.java deleted file mode 100644 index 1af5b17e0c6..00000000000 --- a/examples/config/git/src/main/java/io/helidon/config/examples/git/Main.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2017, 2020 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.helidon.config.examples.git; - -import java.io.IOException; -import java.net.URI; - -import io.helidon.config.Config; -import io.helidon.config.ConfigSources; -import io.helidon.config.git.GitConfigSource; - -/** - * Git source example. - *

- * This example expects: - *

    - *
  1. a Git repository {@code helidonrobot/test-config} which contains: - *
      - *
    1. the branch {@code test} containing {@code application.conf} which sets - * {@code greeting} to {@code hello}, - *
    2. the branch {@code main} containing the file {@code application.conf} - * which sets the property {@code greeting} to any value other than - * {@code hello}, - *
    3. optionally, any other branch in which {@code application.conf} sets - * {@code greeting} to {@code hello}. - *
    - *
  2. the environment variable {@code ENVIRONMENT_NAME} set to: - *
      - *
    1. {@code test}, or - *
    2. the name of the optional additional branch described above. - *
    - *
- */ -public class Main { - - private static final String ENVIRONMENT_NAME_PROPERTY = "ENVIRONMENT_NAME"; - - private Main() { - } - - /** - * Executes the example. - * - * @param args arguments - * @throws IOException when some git repo operation failed - */ - public static void main(String... args) throws IOException { - - // we expect a name of the current environment in envvar ENVIRONMENT_NAME - // in this example we just set envvar in maven plugin 'exec', but can be set in k8s pod via ConfigMap - Config env = Config.create(ConfigSources.environmentVariables()); - - String branch = env.get(ENVIRONMENT_NAME_PROPERTY).asString().orElse("master"); - - System.out.println("Loading from branch " + branch); - - Config config = Config.create( - GitConfigSource.builder() - .path("application.conf") - .uri(URI.create("https://github.com/helidonrobot/test-config.git")) - .branch(branch) - .build()); - - System.out.println("Greeting is " + config.get("greeting").asString().get()); - assert config.get("greeting").asString().get().equals("hello"); - } - -} diff --git a/examples/config/git/src/main/java/io/helidon/config/examples/git/package-info.java b/examples/config/git/src/main/java/io/helidon/config/examples/git/package-info.java deleted file mode 100644 index ed0dd6ab8f9..00000000000 --- a/examples/config/git/src/main/java/io/helidon/config/examples/git/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2017, 2021 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * The example shows how to use GitConfigSource. - */ -package io.helidon.config.examples.git; diff --git a/examples/config/git/src/main/java/io/helidon/examples/config/git/Main.java b/examples/config/git/src/main/java/io/helidon/examples/config/git/Main.java new file mode 100644 index 00000000000..79b976ea614 --- /dev/null +++ b/examples/config/git/src/main/java/io/helidon/examples/config/git/Main.java @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.helidon.examples.config.git; + +import java.io.IOException; +import java.net.URI; + +import io.helidon.config.Config; +import io.helidon.config.ConfigSources; +import io.helidon.config.git.GitConfigSource; + +/** + * Git source example. + *

+ * This example expects: + *

    + *
  1. a Git repository {@code helidonrobot/test-config} which contains: + *
      + *
    1. the branch {@code test} containing {@code application.conf} which sets + * {@code greeting} to {@code hello}, + *
    2. the branch {@code main} containing the file {@code application.conf} + * which sets the property {@code greeting} to any value other than + * {@code hello}, + *
    3. optionally, any other branch in which {@code application.conf} sets + * {@code greeting} to {@code hello}. + *
    + *
  2. the environment variable {@code ENVIRONMENT_NAME} set to: + *
      + *
    1. {@code test}, or + *
    2. the name of the optional additional branch described above. + *
    + *
+ */ +public class Main { + + private static final String ENVIRONMENT_NAME_PROPERTY = "ENVIRONMENT_NAME"; + + private Main() { + } + + /** + * Executes the example. + * + * @param args arguments + * @throws IOException when some git repo operation failed + */ + public static void main(String... args) throws IOException { + + // we expect a name of the current environment in envvar ENVIRONMENT_NAME + // in this example we just set envvar in maven plugin 'exec', but can be set in k8s pod via ConfigMap + Config env = Config.create(ConfigSources.environmentVariables()); + + String branch = env.get(ENVIRONMENT_NAME_PROPERTY).asString().orElse("master"); + + System.out.println("Loading from branch " + branch); + + Config config = Config.create( + GitConfigSource.builder() + .path("application.conf") + .uri(URI.create("https://github.com/helidonrobot/test-config.git")) + .branch(branch) + .build()); + + System.out.println("Greeting is " + config.get("greeting").asString().get()); + assert config.get("greeting").asString().get().equals("hello"); + } + +} diff --git a/examples/config/git/src/main/java/io/helidon/examples/config/git/package-info.java b/examples/config/git/src/main/java/io/helidon/examples/config/git/package-info.java new file mode 100644 index 00000000000..47c2c44eb1d --- /dev/null +++ b/examples/config/git/src/main/java/io/helidon/examples/config/git/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * The example shows how to use GitConfigSource. + */ +package io.helidon.examples.config.git; diff --git a/examples/config/mapping/README.md b/examples/config/mapping/README.md index d8d561f3a3c..05e060f6421 100644 --- a/examples/config/mapping/README.md +++ b/examples/config/mapping/README.md @@ -3,15 +3,15 @@ This example shows how to implement mappers that convert configuration to POJOs. -1. [`BuilderExample.java`](./src/main/java/io/helidon/config/examples/mapping/BuilderExample.java) +1. [`BuilderExample.java`](src/main/java/io/helidon/examples/config/mapping/BuilderExample.java) shows how you can add a `builder()` method to a POJO. That method returns a `Builder` object which the config system uses to update with various key settings and then, finally, invoke `build()` so the builder can instantiate the POJO with the assigned values. -2. [`DeserializationExample.java`](./src/main/java/io/helidon/config/examples/mapping/DeserializationExample.java) +2. [`DeserializationExample.java`](src/main/java/io/helidon/examples/config/mapping/DeserializationExample.java) uses the config system's support for automatic mapping to POJOs that have bean-style setter methods. -3. [`FactoryMethodExample.java`](./src/main/java/io/helidon/config/examples/mapping/FactoryMethodExample.java) +3. [`FactoryMethodExample.java`](src/main/java/io/helidon/examples/config/mapping/FactoryMethodExample.java) illustrates how you can add a static factory method `create` to a POJO to tell the config system how to construct a POJO instance. diff --git a/examples/config/mapping/pom.xml b/examples/config/mapping/pom.xml index ff2c9da6f0c..768d6e47529 100644 --- a/examples/config/mapping/pom.xml +++ b/examples/config/mapping/pom.xml @@ -28,14 +28,14 @@ io.helidon.examples.config helidon-examples-config-mapping - Helidon Config Examples Mapping + Helidon Examples Config Mapping The example shows how to use Config Mapping functionality. - io.helidon.config.examples.mapping.Main + io.helidon.examples.config.mapping.Main diff --git a/examples/config/mapping/src/main/java/io/helidon/config/examples/mapping/Main.java b/examples/config/mapping/src/main/java/io/helidon/config/examples/mapping/Main.java deleted file mode 100644 index 25a94b6fb95..00000000000 --- a/examples/config/mapping/src/main/java/io/helidon/config/examples/mapping/Main.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2017, 2021 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.config.examples.mapping; - -/** - * Runs every example main class in this module/package. - */ -public class Main { - - private Main() { - } - - /** - * Executes the example. - * - * @param args arguments - */ - public static void main(String[] args) { - DeserializationExample.main(args); - FactoryMethodExample.main(args); - BuilderExample.main(args); - } - -} diff --git a/examples/config/mapping/src/main/java/io/helidon/config/examples/mapping/package-info.java b/examples/config/mapping/src/main/java/io/helidon/config/examples/mapping/package-info.java deleted file mode 100644 index 79793e73d38..00000000000 --- a/examples/config/mapping/src/main/java/io/helidon/config/examples/mapping/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2017, 2021 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * The example shows how to use Config Mapping functionality. - */ -package io.helidon.config.examples.mapping; diff --git a/examples/config/mapping/src/main/java/io/helidon/config/examples/mapping/BuilderExample.java b/examples/config/mapping/src/main/java/io/helidon/examples/config/mapping/BuilderExample.java similarity index 98% rename from examples/config/mapping/src/main/java/io/helidon/config/examples/mapping/BuilderExample.java rename to examples/config/mapping/src/main/java/io/helidon/examples/config/mapping/BuilderExample.java index c9fa7ff61e1..18af2182fcc 100644 --- a/examples/config/mapping/src/main/java/io/helidon/config/examples/mapping/BuilderExample.java +++ b/examples/config/mapping/src/main/java/io/helidon/examples/config/mapping/BuilderExample.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021 Oracle and/or its affiliates. + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.config.examples.mapping; +package io.helidon.examples.config.mapping; import java.util.List; import java.util.function.Supplier; diff --git a/examples/config/mapping/src/main/java/io/helidon/config/examples/mapping/DeserializationExample.java b/examples/config/mapping/src/main/java/io/helidon/examples/config/mapping/DeserializationExample.java similarity index 97% rename from examples/config/mapping/src/main/java/io/helidon/config/examples/mapping/DeserializationExample.java rename to examples/config/mapping/src/main/java/io/helidon/examples/config/mapping/DeserializationExample.java index ec00769c7d7..2dcb41f3daf 100644 --- a/examples/config/mapping/src/main/java/io/helidon/config/examples/mapping/DeserializationExample.java +++ b/examples/config/mapping/src/main/java/io/helidon/examples/config/mapping/DeserializationExample.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021 Oracle and/or its affiliates. + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.config.examples.mapping; +package io.helidon.examples.config.mapping; import java.util.List; import java.util.function.Supplier; diff --git a/examples/config/mapping/src/main/java/io/helidon/config/examples/mapping/FactoryMethodExample.java b/examples/config/mapping/src/main/java/io/helidon/examples/config/mapping/FactoryMethodExample.java similarity index 97% rename from examples/config/mapping/src/main/java/io/helidon/config/examples/mapping/FactoryMethodExample.java rename to examples/config/mapping/src/main/java/io/helidon/examples/config/mapping/FactoryMethodExample.java index 1b681b0428f..bd5c3849741 100644 --- a/examples/config/mapping/src/main/java/io/helidon/config/examples/mapping/FactoryMethodExample.java +++ b/examples/config/mapping/src/main/java/io/helidon/examples/config/mapping/FactoryMethodExample.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021 Oracle and/or its affiliates. + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.config.examples.mapping; +package io.helidon.examples.config.mapping; import java.util.List; import java.util.function.Supplier; diff --git a/examples/config/mapping/src/main/java/io/helidon/examples/config/mapping/Main.java b/examples/config/mapping/src/main/java/io/helidon/examples/config/mapping/Main.java new file mode 100644 index 00000000000..62dbd3fda4b --- /dev/null +++ b/examples/config/mapping/src/main/java/io/helidon/examples/config/mapping/Main.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.examples.config.mapping; + +/** + * Runs every example main class in this module/package. + */ +public class Main { + + private Main() { + } + + /** + * Executes the example. + * + * @param args arguments + */ + public static void main(String[] args) { + DeserializationExample.main(args); + FactoryMethodExample.main(args); + BuilderExample.main(args); + } + +} diff --git a/examples/config/mapping/src/main/java/io/helidon/examples/config/mapping/package-info.java b/examples/config/mapping/src/main/java/io/helidon/examples/config/mapping/package-info.java new file mode 100644 index 00000000000..9d61db35a2e --- /dev/null +++ b/examples/config/mapping/src/main/java/io/helidon/examples/config/mapping/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * The example shows how to use Config Mapping functionality. + */ +package io.helidon.examples.config.mapping; diff --git a/examples/config/metadata/pom.xml b/examples/config/metadata/pom.xml index b272ee5cb36..ec6b2ac9c3d 100644 --- a/examples/config/metadata/pom.xml +++ b/examples/config/metadata/pom.xml @@ -28,7 +28,7 @@ io.helidon.examples.config helidon-examples-config-metadata - Helidon Config Examples Metadata + Helidon Examples Config Metadata This example shows possibilities with configuration metadata. To test this, add a configurable library on the classpath @@ -36,7 +36,7 @@ - io.helidon.config.examples.metadata.ConfigMetadataMain + io.helidon.examples.config.metadata.ConfigMetadataMain diff --git a/examples/config/metadata/src/main/java/io/helidon/config/examples/metadata/package-info.java b/examples/config/metadata/src/main/java/io/helidon/config/examples/metadata/package-info.java deleted file mode 100644 index f25539377d9..00000000000 --- a/examples/config/metadata/src/main/java/io/helidon/config/examples/metadata/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2021 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Example of processing configuration metadata. - */ -package io.helidon.config.examples.metadata; diff --git a/examples/config/metadata/src/main/java/io/helidon/config/examples/metadata/ConfigMetadataMain.java b/examples/config/metadata/src/main/java/io/helidon/examples/config/metadata/ConfigMetadataMain.java similarity index 92% rename from examples/config/metadata/src/main/java/io/helidon/config/examples/metadata/ConfigMetadataMain.java rename to examples/config/metadata/src/main/java/io/helidon/examples/config/metadata/ConfigMetadataMain.java index 7af2100e166..a8db687f12d 100644 --- a/examples/config/metadata/src/main/java/io/helidon/config/examples/metadata/ConfigMetadataMain.java +++ b/examples/config/metadata/src/main/java/io/helidon/examples/config/metadata/ConfigMetadataMain.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. + * Copyright (c) 2021, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.config.examples.metadata; +package io.helidon.examples.config.metadata; import java.io.IOException; import java.io.InputStream; @@ -28,7 +28,6 @@ import java.util.Set; import java.util.stream.Collectors; -import io.helidon.config.examples.metadata.ConfiguredType.ConfiguredProperty; import io.helidon.config.metadata.ConfiguredOption; import jakarta.json.Json; @@ -100,10 +99,10 @@ private static void printType(ConfiguredType configuredType, int nesting, boolean listStart) { String spaces = " ".repeat(nesting * 2); - Set properties = configuredType.properties(); + Set properties = configuredType.properties(); boolean isListStart = listStart; - for (ConfiguredProperty property : properties) { + for (ConfiguredType.ConfiguredProperty property : properties) { if (property.key() != null && property.key().contains(".*.")) { // this is a nested key, must be resolved by the parent list node continue; @@ -124,8 +123,8 @@ private static void printType(ConfiguredType configuredType, } } - private static void printProperty(ConfiguredProperty property, - Set properties, + private static void printProperty(ConfiguredType.ConfiguredProperty property, + Set properties, Map typesMap, int nesting, boolean listStart) { @@ -168,7 +167,7 @@ private static void printProperty(ConfiguredProperty property, } } - private static void printMapProperty(ConfiguredProperty property, + private static void printMapProperty(ConfiguredType.ConfiguredProperty property, Map typesMap, int nesting, String spaces) { @@ -185,8 +184,8 @@ private static void printMapProperty(ConfiguredProperty property, } } - private static void printListProperty(ConfiguredProperty property, - Set properties, + private static void printListProperty(ConfiguredType.ConfiguredProperty property, + Set properties, Map typesMap, int nesting, String spaces) { @@ -207,7 +206,7 @@ private static void printListProperty(ConfiguredProperty property, } } - private static void listFromProvider(ConfiguredProperty property, + private static void listFromProvider(ConfiguredType.ConfiguredProperty property, Map typesMap, int nesting, String spaces) { @@ -236,7 +235,7 @@ private static void listFromProvider(ConfiguredProperty property, } } - private static void fromProvider(ConfiguredProperty property, + private static void fromProvider(ConfiguredType.ConfiguredProperty property, Map typesMap, int nesting) { String spaces = " ".repeat(nesting + 1); @@ -267,15 +266,15 @@ private static void fromProvider(ConfiguredProperty property, } } - private static void listFromTypes(ConfiguredProperty property, - Set properties, + private static void listFromTypes(ConfiguredType.ConfiguredProperty property, + Set properties, Map typesMap, int nesting, String spaces) { // this may be a list defined in configuration itself (*) String prefix = property.outputKey() + ".*."; - Map children = new HashMap<>(); - for (ConfiguredProperty configuredProperty : properties) { + Map children = new HashMap<>(); + for (ConfiguredType.ConfiguredProperty configuredProperty : properties) { if (configuredProperty.outputKey().startsWith(prefix)) { children.put(configuredProperty.outputKey().substring(prefix.length()), configuredProperty); } @@ -325,7 +324,7 @@ private static void listFromTypes(ConfiguredProperty property, System.out.print(spaces + "- "); boolean listStart = true; for (var entry : children.entrySet()) { - ConfiguredProperty element = entry.getValue(); + ConfiguredType.ConfiguredProperty element = entry.getValue(); // we must modify the key element.key(entry.getKey()); printProperty(element, properties, typesMap, nesting + 1, listStart); @@ -334,7 +333,7 @@ private static void listFromTypes(ConfiguredProperty property, } } - private static void printDocs(ConfiguredProperty property, String spaces, boolean firstLineNoSpaces) { + private static void printDocs(ConfiguredType.ConfiguredProperty property, String spaces, boolean firstLineNoSpaces) { String description = property.description(); description = (description == null || description.isBlank()) ? null : description; @@ -371,7 +370,7 @@ private static String output(TypedValue typed, String value) { return value; } - private static void printAllowedValuesOrMissing(ConfiguredProperty property, + private static void printAllowedValuesOrMissing(ConfiguredType.ConfiguredProperty property, Map typesMap, int nesting, String spaces) { if (property.provider()) { @@ -405,7 +404,7 @@ private static void printAllowedValuesOrMissing(ConfiguredProperty property, } } - private static String toTypedValue(ConfiguredProperty property, + private static String toTypedValue(ConfiguredType.ConfiguredProperty property, TypedValue typed) { String value = property.defaultValue(); diff --git a/examples/config/metadata/src/main/java/io/helidon/config/examples/metadata/ConfiguredType.java b/examples/config/metadata/src/main/java/io/helidon/examples/config/metadata/ConfiguredType.java similarity index 99% rename from examples/config/metadata/src/main/java/io/helidon/config/examples/metadata/ConfiguredType.java rename to examples/config/metadata/src/main/java/io/helidon/examples/config/metadata/ConfiguredType.java index bd4b552d823..19b92f83998 100644 --- a/examples/config/metadata/src/main/java/io/helidon/config/examples/metadata/ConfiguredType.java +++ b/examples/config/metadata/src/main/java/io/helidon/examples/config/metadata/ConfiguredType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. + * Copyright (c) 2021, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.config.examples.metadata; +package io.helidon.examples.config.metadata; import java.util.ArrayList; import java.util.Arrays; diff --git a/examples/config/metadata/src/main/java/io/helidon/examples/config/metadata/package-info.java b/examples/config/metadata/src/main/java/io/helidon/examples/config/metadata/package-info.java new file mode 100644 index 00000000000..3e85bb724db --- /dev/null +++ b/examples/config/metadata/src/main/java/io/helidon/examples/config/metadata/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2021, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Example of processing configuration metadata. + */ +package io.helidon.examples.config.metadata; diff --git a/examples/config/overrides/pom.xml b/examples/config/overrides/pom.xml index 0a25bf6fd16..555aee2983f 100644 --- a/examples/config/overrides/pom.xml +++ b/examples/config/overrides/pom.xml @@ -28,14 +28,14 @@ io.helidon.examples.config helidon-examples-config-overrides - Helidon Config Examples Overrides + Helidon Examples Config Overrides The example shows how to use Overrides in Configuration API. - io.helidon.config.examples.overrides.Main + io.helidon.examples.config.overrides.Main diff --git a/examples/config/overrides/src/main/java/io/helidon/config/examples/overrides/Main.java b/examples/config/overrides/src/main/java/io/helidon/config/examples/overrides/Main.java deleted file mode 100644 index da17516844c..00000000000 --- a/examples/config/overrides/src/main/java/io/helidon/config/examples/overrides/Main.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2017, 2020 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.config.examples.overrides; - -import java.time.Duration; -import java.util.concurrent.TimeUnit; - -import io.helidon.config.Config; -import io.helidon.config.OverrideSources; - -import static io.helidon.config.ConfigSources.classpath; -import static io.helidon.config.ConfigSources.file; -import static io.helidon.config.PollingStrategies.regular; - -/** - * Overrides example. - *

- * Shows the Overrides feature where values from config sources might be overridden by override source. - *

- * In this example, {@code application.yaml} is meant to be default application configuration distributed with an app, containing - * a wildcard configuration nodes representing the defaults for every environment and pod as well as a default definition of - * these values. The source {@code conf/priority-config.yaml} is a higher priority configuration source which can be in a real - * app dynamically changed (i.e. {@code Kubernetes ConfigMap} mapped as the file) and contains the current {@code env} and {@code - * pod} values ({@code prod} and {@code abcdef} in this example) and higher priority default configuration. So far the current - * configuration looks like this: - *

- * prod:
- *   abcdef:
- *     logging:
- *     level: ERROR
- *     app:
- *       greeting:  Ahoy
- *       page-size: 42
- *       basic-range:
- *         - -20
- *         -  20
- * 
- * But the override source just overrides values for environment: {@code prod} and pod: {@code abcdef} (it is the first - * overriding rule found) and value for key {@code prod.abcdef.logging.level = FINEST}. For completeness, we would say that the - * other pods in {@code prod} environment has overridden config value {@code prod.*.logging.level} to {@code WARNING} and all - * pods - * {@code test.*.logging.level} to {@code FINE}. - */ -public final class Main { - - private Main() { - } - - /** - * Executes the example. - * - * @param args arguments - * @throws InterruptedException when a sleeper awakes - */ - public static void main(String... args) throws InterruptedException { - Config config = Config - .builder() - // specify config sources - .sources(file("conf/priority-config.yaml").pollingStrategy(regular(Duration.ofSeconds(1))), - classpath("application.yaml")) - // specify overrides source - .overrides(OverrideSources.file("conf/overrides.properties") - .pollingStrategy(regular(Duration.ofSeconds(1)))) - .build(); - - // Resolve current runtime context - String env = config.get("env").asString().get(); - String pod = config.get("pod").asString().get(); - - // get logging config for the current runtime - Config loggingConfig = config - .get(env) - .get(pod) - .get("logging"); - - // initialize logging from config - initLogging(loggingConfig); - - // react on changes of logging configuration - loggingConfig.onChange(Main::initLogging); - - TimeUnit.MINUTES.sleep(1); - } - - /** - * Initialize logging from config. - */ - private static void initLogging(Config loggingConfig) { - String level = loggingConfig.get("level").asString().orElse("WARNING"); - //e.g. initialize logging using configured level... - - System.out.println("Set logging level to " + level + "."); - } - -} diff --git a/examples/config/overrides/src/main/java/io/helidon/config/examples/overrides/package-info.java b/examples/config/overrides/src/main/java/io/helidon/config/examples/overrides/package-info.java deleted file mode 100644 index 2b2c9b4fbe1..00000000000 --- a/examples/config/overrides/src/main/java/io/helidon/config/examples/overrides/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2017, 2021 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * The example shows how to use Overrides in Configuration API. - */ -package io.helidon.config.examples.overrides; diff --git a/examples/config/overrides/src/main/java/io/helidon/examples/config/overrides/Main.java b/examples/config/overrides/src/main/java/io/helidon/examples/config/overrides/Main.java new file mode 100644 index 00000000000..34a9c1679c6 --- /dev/null +++ b/examples/config/overrides/src/main/java/io/helidon/examples/config/overrides/Main.java @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.examples.config.overrides; + +import java.time.Duration; +import java.util.concurrent.TimeUnit; + +import io.helidon.config.Config; +import io.helidon.config.OverrideSources; + +import static io.helidon.config.ConfigSources.classpath; +import static io.helidon.config.ConfigSources.file; +import static io.helidon.config.PollingStrategies.regular; + +/** + * Overrides example. + *

+ * Shows the Overrides feature where values from config sources might be overridden by override source. + *

+ * In this example, {@code application.yaml} is meant to be default application configuration distributed with an app, containing + * a wildcard configuration nodes representing the defaults for every environment and pod as well as a default definition of + * these values. The source {@code conf/priority-config.yaml} is a higher priority configuration source which can be in a real + * app dynamically changed (i.e. {@code Kubernetes ConfigMap} mapped as the file) and contains the current {@code env} and {@code + * pod} values ({@code prod} and {@code abcdef} in this example) and higher priority default configuration. So far the current + * configuration looks like this: + *

+ * prod:
+ *   abcdef:
+ *     logging:
+ *     level: ERROR
+ *     app:
+ *       greeting:  Ahoy
+ *       page-size: 42
+ *       basic-range:
+ *         - -20
+ *         -  20
+ * 
+ * But the override source just overrides values for environment: {@code prod} and pod: {@code abcdef} (it is the first + * overriding rule found) and value for key {@code prod.abcdef.logging.level = FINEST}. For completeness, we would say that the + * other pods in {@code prod} environment has overridden config value {@code prod.*.logging.level} to {@code WARNING} and all + * pods + * {@code test.*.logging.level} to {@code FINE}. + */ +public final class Main { + + private Main() { + } + + /** + * Executes the example. + * + * @param args arguments + * @throws InterruptedException when a sleeper awakes + */ + public static void main(String... args) throws InterruptedException { + Config config = Config + .builder() + // specify config sources + .sources(file("conf/priority-config.yaml").pollingStrategy(regular(Duration.ofSeconds(1))), + classpath("application.yaml")) + // specify overrides source + .overrides(OverrideSources.file("conf/overrides.properties") + .pollingStrategy(regular(Duration.ofSeconds(1)))) + .build(); + + // Resolve current runtime context + String env = config.get("env").asString().get(); + String pod = config.get("pod").asString().get(); + + // get logging config for the current runtime + Config loggingConfig = config + .get(env) + .get(pod) + .get("logging"); + + // initialize logging from config + initLogging(loggingConfig); + + // react on changes of logging configuration + loggingConfig.onChange(Main::initLogging); + + TimeUnit.MINUTES.sleep(1); + } + + /** + * Initialize logging from config. + */ + private static void initLogging(Config loggingConfig) { + String level = loggingConfig.get("level").asString().orElse("WARNING"); + //e.g. initialize logging using configured level... + + System.out.println("Set logging level to " + level + "."); + } + +} diff --git a/examples/config/overrides/src/main/java/io/helidon/examples/config/overrides/package-info.java b/examples/config/overrides/src/main/java/io/helidon/examples/config/overrides/package-info.java new file mode 100644 index 00000000000..52f2846cd81 --- /dev/null +++ b/examples/config/overrides/src/main/java/io/helidon/examples/config/overrides/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * The example shows how to use Overrides in Configuration API. + */ +package io.helidon.examples.config.overrides; diff --git a/examples/config/pom.xml b/examples/config/pom.xml index e89017e1c87..a2b15bd79b4 100644 --- a/examples/config/pom.xml +++ b/examples/config/pom.xml @@ -28,7 +28,7 @@ io.helidon.examples.config helidon-examples-config-project pom - Helidon Config Examples + Helidon Examples Config basics diff --git a/examples/config/profiles/pom.xml b/examples/config/profiles/pom.xml index 69a8d7f46e6..b2830e4cba0 100644 --- a/examples/config/profiles/pom.xml +++ b/examples/config/profiles/pom.xml @@ -28,7 +28,7 @@ io.helidon.examples.config helidon-examples-config-profiles - Helidon Config Examples Profiles + Helidon Examples Config Profiles The example shows how to use Config Profiles (meta configuration). diff --git a/examples/config/sources/README.md b/examples/config/sources/README.md index 27e20509842..65cb26ebb3c 100644 --- a/examples/config/sources/README.md +++ b/examples/config/sources/README.md @@ -3,15 +3,15 @@ This example shows how to load configuration from multiple configuration sources. -1. [`DirectorySourceExample.java`](./src/main/java/io/helidon/config/examples/sources/DirectorySourceExample.java) +1. [`DirectorySourceExample.java`](src/main/java/io/helidon/examples/config/sources/DirectorySourceExample.java) reads configuration from multiple files in a directory by specifying only the directory. -2. [`LoadSourcesExample.java`](./src/main/java/io/helidon/config/examples/sources/LoadSourcesExample.java) +2. [`LoadSourcesExample.java`](src/main/java/io/helidon/examples/config/sources/LoadSourcesExample.java) uses _meta-configuration_ files [`conf/meta-config.yaml`](./conf/meta-config.yaml) and [`src/main/resources/meta-config.yaml`](./src/main/resources/meta-config.yaml) which contain not the configuration itself but _instructions for loading_ the configuration: what type, from where, etc. It also applies a filter to modify config values whose keys match a certain pattern. -3. [`WithSourcesExample.java`](./src/main/java/io/helidon/config/examples/sources/WithSourcesExample.java) +3. [`WithSourcesExample.java`](src/main/java/io/helidon/examples/config/sources/WithSourcesExample.java) combines multiple config sources into a single configuration instance (and adds a filter. diff --git a/examples/config/sources/pom.xml b/examples/config/sources/pom.xml index 212fc6dcaf4..61e59f19940 100644 --- a/examples/config/sources/pom.xml +++ b/examples/config/sources/pom.xml @@ -28,14 +28,14 @@ io.helidon.examples.config helidon-examples-config-sources - Helidon Config Examples Sources + Helidon Examples Config Sources This example shows how to merge the configuration from different sources. - io.helidon.config.examples.sources.Main + io.helidon.examples.config.sources.Main diff --git a/examples/config/sources/src/main/java/io/helidon/config/examples/sources/Main.java b/examples/config/sources/src/main/java/io/helidon/config/examples/sources/Main.java deleted file mode 100644 index bea16ec6dec..00000000000 --- a/examples/config/sources/src/main/java/io/helidon/config/examples/sources/Main.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2017, 2021 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.config.examples.sources; - -/** - * Runs every example main class in this module/package. - */ -public class Main { - - private Main() { - } - - /** - * Executes the example. - * - * @param args arguments - */ - public static void main(String[] args) { - WithSourcesExample.main(args); - LoadSourcesExample.main(args); - DirectorySourceExample.main(args); - } - -} diff --git a/examples/config/sources/src/main/java/io/helidon/config/examples/sources/package-info.java b/examples/config/sources/src/main/java/io/helidon/config/examples/sources/package-info.java deleted file mode 100644 index 44958945786..00000000000 --- a/examples/config/sources/src/main/java/io/helidon/config/examples/sources/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2017, 2021 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * This example shows how to merge the configuration from different sources. - */ -package io.helidon.config.examples.sources; diff --git a/examples/config/sources/src/main/java/io/helidon/config/examples/sources/DirectorySourceExample.java b/examples/config/sources/src/main/java/io/helidon/examples/config/sources/DirectorySourceExample.java similarity index 94% rename from examples/config/sources/src/main/java/io/helidon/config/examples/sources/DirectorySourceExample.java rename to examples/config/sources/src/main/java/io/helidon/examples/config/sources/DirectorySourceExample.java index 6f469ac998f..cd54b0d4fde 100644 --- a/examples/config/sources/src/main/java/io/helidon/config/examples/sources/DirectorySourceExample.java +++ b/examples/config/sources/src/main/java/io/helidon/examples/config/sources/DirectorySourceExample.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021 Oracle and/or its affiliates. + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.config.examples.sources; +package io.helidon.examples.config.sources; import io.helidon.config.Config; diff --git a/examples/config/sources/src/main/java/io/helidon/config/examples/sources/LoadSourcesExample.java b/examples/config/sources/src/main/java/io/helidon/examples/config/sources/LoadSourcesExample.java similarity index 96% rename from examples/config/sources/src/main/java/io/helidon/config/examples/sources/LoadSourcesExample.java rename to examples/config/sources/src/main/java/io/helidon/examples/config/sources/LoadSourcesExample.java index ead744ce6a1..fec701180bd 100644 --- a/examples/config/sources/src/main/java/io/helidon/config/examples/sources/LoadSourcesExample.java +++ b/examples/config/sources/src/main/java/io/helidon/examples/config/sources/LoadSourcesExample.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021 Oracle and/or its affiliates. + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.config.examples.sources; +package io.helidon.examples.config.sources; import io.helidon.config.Config; import io.helidon.config.ConfigValue; diff --git a/examples/config/sources/src/main/java/io/helidon/examples/config/sources/Main.java b/examples/config/sources/src/main/java/io/helidon/examples/config/sources/Main.java new file mode 100644 index 00000000000..a7a9aa19901 --- /dev/null +++ b/examples/config/sources/src/main/java/io/helidon/examples/config/sources/Main.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.examples.config.sources; + +/** + * Runs every example main class in this module/package. + */ +public class Main { + + private Main() { + } + + /** + * Executes the example. + * + * @param args arguments + */ + public static void main(String[] args) { + WithSourcesExample.main(args); + LoadSourcesExample.main(args); + DirectorySourceExample.main(args); + } + +} diff --git a/examples/config/sources/src/main/java/io/helidon/config/examples/sources/WithSourcesExample.java b/examples/config/sources/src/main/java/io/helidon/examples/config/sources/WithSourcesExample.java similarity index 96% rename from examples/config/sources/src/main/java/io/helidon/config/examples/sources/WithSourcesExample.java rename to examples/config/sources/src/main/java/io/helidon/examples/config/sources/WithSourcesExample.java index 8de8a3aaaa9..1d214572e5e 100644 --- a/examples/config/sources/src/main/java/io/helidon/config/examples/sources/WithSourcesExample.java +++ b/examples/config/sources/src/main/java/io/helidon/examples/config/sources/WithSourcesExample.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021 Oracle and/or its affiliates. + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.config.examples.sources; +package io.helidon.examples.config.sources; import io.helidon.config.Config; import io.helidon.config.ConfigValue; diff --git a/examples/config/sources/src/main/java/io/helidon/examples/config/sources/package-info.java b/examples/config/sources/src/main/java/io/helidon/examples/config/sources/package-info.java new file mode 100644 index 00000000000..aa3a06ec8d4 --- /dev/null +++ b/examples/config/sources/src/main/java/io/helidon/examples/config/sources/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * This example shows how to merge the configuration from different sources. + */ +package io.helidon.examples.config.sources; diff --git a/examples/cors/pom.xml b/examples/cors/pom.xml index 28a393ca0d5..3ad5fd2ecdf 100644 --- a/examples/cors/pom.xml +++ b/examples/cors/pom.xml @@ -28,7 +28,7 @@ io.helidon.examples helidon-examples-cors - Helidon SE Examples CORS + Helidon Examples CORS SE Basic illustration of CORS support in Helidon SE @@ -54,28 +54,28 @@ - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.nima.observe - helidon-nima-observe + io.helidon.webserver.observe + helidon-webserver-observe - io.helidon.nima.observe - helidon-nima-observe-health + io.helidon.webserver.observe + helidon-webserver-observe-health - io.helidon.nima.observe - helidon-nima-observe-metrics + io.helidon.webserver.observe + helidon-webserver-observe-metrics io.helidon.config helidon-config-yaml - io.helidon.nima.http.media - helidon-nima-http-media-jsonp + io.helidon.http.media + helidon-http-media-jsonp io.helidon.health @@ -90,8 +90,8 @@ jakarta.json-api - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test diff --git a/examples/cors/src/main/java/io/helidon/examples/cors/GreetService.java b/examples/cors/src/main/java/io/helidon/examples/cors/GreetService.java index e01d300a2d3..8ade766ef23 100644 --- a/examples/cors/src/main/java/io/helidon/examples/cors/GreetService.java +++ b/examples/cors/src/main/java/io/helidon/examples/cors/GreetService.java @@ -18,12 +18,12 @@ import java.util.Collections; -import io.helidon.common.http.Http; import io.helidon.config.Config; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.Http; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import jakarta.json.Json; import jakarta.json.JsonBuilderFactory; diff --git a/examples/cors/src/main/java/io/helidon/examples/cors/Main.java b/examples/cors/src/main/java/io/helidon/examples/cors/Main.java index 273e73b42e0..133b5460acf 100644 --- a/examples/cors/src/main/java/io/helidon/examples/cors/Main.java +++ b/examples/cors/src/main/java/io/helidon/examples/cors/Main.java @@ -21,11 +21,11 @@ import io.helidon.config.Config; import io.helidon.cors.CrossOriginConfig; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.observe.ObserveFeature; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.cors.CorsSupport; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.cors.CorsSupport; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.observe.ObserveFeature; /** * Simple Hello World rest application. diff --git a/examples/cors/src/main/resources/logging.properties b/examples/cors/src/main/resources/logging.properties index c0b2db7febe..2c828e180b8 100644 --- a/examples/cors/src/main/resources/logging.properties +++ b/examples/cors/src/main/resources/logging.properties @@ -27,4 +27,4 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ .level=INFO # Uncomment the following to see CORS-related decision-making -# io.helidon.nima.webserver.cors.level=FINE +# io.helidon.webserver.cors.level=FINE diff --git a/examples/cors/src/test/java/io/helidon/examples/cors/MainTest.java b/examples/cors/src/test/java/io/helidon/examples/cors/MainTest.java index d8938bf4789..ec46604b2a4 100644 --- a/examples/cors/src/test/java/io/helidon/examples/cors/MainTest.java +++ b/examples/cors/src/test/java/io/helidon/examples/cors/MainTest.java @@ -19,17 +19,17 @@ import java.util.List; import java.util.Optional; -import io.helidon.common.http.Headers; -import io.helidon.common.http.WritableHeaders; +import io.helidon.http.Headers; +import io.helidon.http.WritableHeaders; import io.helidon.common.media.type.MediaTypes; import io.helidon.config.Config; import io.helidon.cors.CrossOriginConfig; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientRequest; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.WebServerConfig; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientRequest; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.WebServerConfig; import jakarta.json.JsonObject; import org.junit.jupiter.api.MethodOrderer; @@ -37,11 +37,11 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; -import static io.helidon.common.http.Http.HeaderNames.ACCESS_CONTROL_ALLOW_METHODS; -import static io.helidon.common.http.Http.HeaderNames.ACCESS_CONTROL_ALLOW_ORIGIN; -import static io.helidon.common.http.Http.HeaderNames.ACCESS_CONTROL_REQUEST_METHOD; -import static io.helidon.common.http.Http.HeaderNames.HOST; -import static io.helidon.common.http.Http.HeaderNames.ORIGIN; +import static io.helidon.http.Http.HeaderNames.ACCESS_CONTROL_ALLOW_METHODS; +import static io.helidon.http.Http.HeaderNames.ACCESS_CONTROL_ALLOW_ORIGIN; +import static io.helidon.http.Http.HeaderNames.ACCESS_CONTROL_REQUEST_METHOD; +import static io.helidon.http.Http.HeaderNames.HOST; +import static io.helidon.http.Http.HeaderNames.ORIGIN; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.hasItem; import static org.hamcrest.CoreMatchers.is; diff --git a/examples/dbclient/common/pom.xml b/examples/dbclient/common/pom.xml index 90e49b6a65c..70a72b2d4e9 100644 --- a/examples/dbclient/common/pom.xml +++ b/examples/dbclient/common/pom.xml @@ -34,16 +34,16 @@ helidon-dbclient - io.helidon.nima.http.media - helidon-nima-http-media-jsonp + io.helidon.http.media + helidon-http-media-jsonp - io.helidon.nima.http.media - helidon-nima-http-media-jsonb + io.helidon.http.media + helidon-http-media-jsonb - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver jakarta.json diff --git a/examples/dbclient/common/src/main/java/io/helidon/examples/dbclient/common/AbstractPokemonService.java b/examples/dbclient/common/src/main/java/io/helidon/examples/dbclient/common/AbstractPokemonService.java index d8c7e6c6b14..43bce5f832c 100644 --- a/examples/dbclient/common/src/main/java/io/helidon/examples/dbclient/common/AbstractPokemonService.java +++ b/examples/dbclient/common/src/main/java/io/helidon/examples/dbclient/common/AbstractPokemonService.java @@ -15,15 +15,15 @@ */ package io.helidon.examples.dbclient.common; -import io.helidon.common.http.NotFoundException; import io.helidon.common.parameters.Parameters; import io.helidon.dbclient.DbClient; import io.helidon.dbclient.DbTransaction; -import io.helidon.nima.webserver.http.Handler; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.NotFoundException; +import io.helidon.webserver.http.Handler; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import jakarta.json.JsonObject; diff --git a/examples/dbclient/jdbc/pom.xml b/examples/dbclient/jdbc/pom.xml index 3acefe58c4c..7dd7574bf34 100644 --- a/examples/dbclient/jdbc/pom.xml +++ b/examples/dbclient/jdbc/pom.xml @@ -89,16 +89,16 @@ slf4j-jdk14 - io.helidon.nima.http.media - helidon-nima-http-media-jsonb + io.helidon.http.media + helidon-http-media-jsonb - io.helidon.nima.observe - helidon-nima-observe + io.helidon.webserver.observe + helidon-webserver-observe - io.helidon.nima.webserver - helidon-nima-webserver-tracing + io.helidon.webserver + helidon-webserver-tracing io.helidon.config diff --git a/examples/dbclient/jdbc/src/main/java/io/helidon/examples/dbclient/jdbc/JdbcExampleMain.java b/examples/dbclient/jdbc/src/main/java/io/helidon/examples/dbclient/jdbc/JdbcExampleMain.java index 203a6a68d90..9e50ea2b0b2 100644 --- a/examples/dbclient/jdbc/src/main/java/io/helidon/examples/dbclient/jdbc/JdbcExampleMain.java +++ b/examples/dbclient/jdbc/src/main/java/io/helidon/examples/dbclient/jdbc/JdbcExampleMain.java @@ -19,11 +19,11 @@ import io.helidon.config.Config; import io.helidon.dbclient.DbClient; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.observe.ObserveFeature; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.tracing.TracingFeature; import io.helidon.tracing.TracerBuilder; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.observe.ObserveFeature; +import io.helidon.webserver.tracing.TracingFeature; /** * Simple Hello World rest application. diff --git a/examples/dbclient/jdbc/src/main/java/io/helidon/examples/dbclient/jdbc/PokemonService.java b/examples/dbclient/jdbc/src/main/java/io/helidon/examples/dbclient/jdbc/PokemonService.java index e2409afeada..743357ebbef 100644 --- a/examples/dbclient/jdbc/src/main/java/io/helidon/examples/dbclient/jdbc/PokemonService.java +++ b/examples/dbclient/jdbc/src/main/java/io/helidon/examples/dbclient/jdbc/PokemonService.java @@ -18,8 +18,8 @@ import io.helidon.dbclient.DbClient; import io.helidon.examples.dbclient.common.AbstractPokemonService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; /** * Example service using a database. diff --git a/examples/dbclient/jdbc/src/main/resources/logging.properties b/examples/dbclient/jdbc/src/main/resources/logging.properties index 3d8fb0008b0..28d23fd6c57 100644 --- a/examples/dbclient/jdbc/src/main/resources/logging.properties +++ b/examples/dbclient/jdbc/src/main/resources/logging.properties @@ -29,7 +29,7 @@ io.helidon.logging.jul.HelidonConsoleHandler.level=ALL java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$s %3$s !thread!: %5$s%6$s%n #Component specific log levels -#io.helidon.nima.webserver.level=INFO +#io.helidon.webserver.level=INFO #io.helidon.config.level=INFO #io.helidon.security.level=INFO #io.helidon.common.level=INFO diff --git a/examples/dbclient/mongodb/pom.xml b/examples/dbclient/mongodb/pom.xml index e72852f4644..6ca819a5a56 100644 --- a/examples/dbclient/mongodb/pom.xml +++ b/examples/dbclient/mongodb/pom.xml @@ -63,16 +63,16 @@ helidon-dbclient-jsonp - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.nima.observe - helidon-nima-observe + io.helidon.webserver.observe + helidon-webserver-observe - io.helidon.nima.webserver - helidon-nima-webserver-tracing + io.helidon.webserver + helidon-webserver-tracing io.helidon.metrics diff --git a/examples/dbclient/mongodb/src/main/java/io/helidon/examples/dbclient/mongo/MongoDbExampleMain.java b/examples/dbclient/mongodb/src/main/java/io/helidon/examples/dbclient/mongo/MongoDbExampleMain.java index 571a3913c4a..a34aca81009 100644 --- a/examples/dbclient/mongodb/src/main/java/io/helidon/examples/dbclient/mongo/MongoDbExampleMain.java +++ b/examples/dbclient/mongodb/src/main/java/io/helidon/examples/dbclient/mongo/MongoDbExampleMain.java @@ -22,12 +22,12 @@ import io.helidon.dbclient.metrics.DbClientMetrics; import io.helidon.dbclient.tracing.DbClientTracing; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.observe.ObserveFeature; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.tracing.TracingFeature; import io.helidon.tracing.Tracer; import io.helidon.tracing.TracerBuilder; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.observe.ObserveFeature; +import io.helidon.webserver.tracing.TracingFeature; /** * Simple Hello World rest application. diff --git a/examples/dbclient/mongodb/src/main/java/io/helidon/examples/dbclient/mongo/PokemonService.java b/examples/dbclient/mongodb/src/main/java/io/helidon/examples/dbclient/mongo/PokemonService.java index e66e3821683..ee286ff8c94 100644 --- a/examples/dbclient/mongodb/src/main/java/io/helidon/examples/dbclient/mongo/PokemonService.java +++ b/examples/dbclient/mongodb/src/main/java/io/helidon/examples/dbclient/mongo/PokemonService.java @@ -18,8 +18,8 @@ import io.helidon.dbclient.DbClient; import io.helidon.examples.dbclient.common.AbstractPokemonService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; /** * A simple service to greet you. Examples: diff --git a/examples/dbclient/mongodb/src/main/resources/logging.properties b/examples/dbclient/mongodb/src/main/resources/logging.properties index 3d8fb0008b0..28d23fd6c57 100644 --- a/examples/dbclient/mongodb/src/main/resources/logging.properties +++ b/examples/dbclient/mongodb/src/main/resources/logging.properties @@ -29,7 +29,7 @@ io.helidon.logging.jul.HelidonConsoleHandler.level=ALL java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$s %3$s !thread!: %5$s%6$s%n #Component specific log levels -#io.helidon.nima.webserver.level=INFO +#io.helidon.webserver.level=INFO #io.helidon.config.level=INFO #io.helidon.security.level=INFO #io.helidon.common.level=INFO diff --git a/examples/dbclient/pokemons/pom.xml b/examples/dbclient/pokemons/pom.xml index 83b00a01f62..27c8349710c 100644 --- a/examples/dbclient/pokemons/pom.xml +++ b/examples/dbclient/pokemons/pom.xml @@ -101,12 +101,12 @@ runtime - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.nima.observe - helidon-nima-observe + io.helidon.webserver.observe + helidon-webserver-observe diff --git a/examples/dbclient/pokemons/src/main/java/io/helidon/examples/dbclient/pokemons/PokemonMain.java b/examples/dbclient/pokemons/src/main/java/io/helidon/examples/dbclient/pokemons/PokemonMain.java index 6de364d73cb..85c14f9f194 100644 --- a/examples/dbclient/pokemons/src/main/java/io/helidon/examples/dbclient/pokemons/PokemonMain.java +++ b/examples/dbclient/pokemons/src/main/java/io/helidon/examples/dbclient/pokemons/PokemonMain.java @@ -20,9 +20,9 @@ import io.helidon.config.ConfigSources; import io.helidon.dbclient.DbClient; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.observe.ObserveFeature; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.observe.ObserveFeature; /** * Simple Hello World rest application. diff --git a/examples/dbclient/pokemons/src/main/java/io/helidon/examples/dbclient/pokemons/PokemonService.java b/examples/dbclient/pokemons/src/main/java/io/helidon/examples/dbclient/pokemons/PokemonService.java index 69229dfde43..6500e20f692 100644 --- a/examples/dbclient/pokemons/src/main/java/io/helidon/examples/dbclient/pokemons/PokemonService.java +++ b/examples/dbclient/pokemons/src/main/java/io/helidon/examples/dbclient/pokemons/PokemonService.java @@ -18,15 +18,15 @@ import java.util.Map; -import io.helidon.common.http.BadRequestException; -import io.helidon.common.http.NotFoundException; import io.helidon.common.media.type.MediaTypes; import io.helidon.dbclient.DbClient; -import io.helidon.nima.webserver.http.Handler; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.BadRequestException; +import io.helidon.http.NotFoundException; +import io.helidon.webserver.http.Handler; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import jakarta.json.Json; import jakarta.json.JsonArray; diff --git a/examples/dbclient/pokemons/src/main/resources/logging.properties b/examples/dbclient/pokemons/src/main/resources/logging.properties index 3d8fb0008b0..28d23fd6c57 100644 --- a/examples/dbclient/pokemons/src/main/resources/logging.properties +++ b/examples/dbclient/pokemons/src/main/resources/logging.properties @@ -29,7 +29,7 @@ io.helidon.logging.jul.HelidonConsoleHandler.level=ALL java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$s %3$s !thread!: %5$s%6$s%n #Component specific log levels -#io.helidon.nima.webserver.level=INFO +#io.helidon.webserver.level=INFO #io.helidon.config.level=INFO #io.helidon.security.level=INFO #io.helidon.common.level=INFO diff --git a/examples/employee-app/pom.xml b/examples/employee-app/pom.xml index 7b9b4d47d73..4681ef2bbdd 100644 --- a/examples/employee-app/pom.xml +++ b/examples/employee-app/pom.xml @@ -33,7 +33,7 @@ Helidon Examples Employee App - io.helidon.service.employee.Main + io.helidon.examples.employee.Main @@ -43,20 +43,20 @@ pom
- io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.nima.observe - helidon-nima-observe + io.helidon.webserver.observe + helidon-webserver-observe - io.helidon.nima.webserver - helidon-nima-webserver-static-content + io.helidon.webserver + helidon-webserver-static-content - io.helidon.nima.http.media - helidon-nima-http-media-jsonb + io.helidon.http.media + helidon-http-media-jsonb io.helidon.config @@ -79,8 +79,8 @@ helidon-dbclient-jdbc - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test diff --git a/examples/employee-app/src/main/java/io/helidon/service/employee/Employee.java b/examples/employee-app/src/main/java/io/helidon/examples/employee/Employee.java similarity index 97% rename from examples/employee-app/src/main/java/io/helidon/service/employee/Employee.java rename to examples/employee-app/src/main/java/io/helidon/examples/employee/Employee.java index 8f3a09eb7e9..f61e587defb 100644 --- a/examples/employee-app/src/main/java/io/helidon/service/employee/Employee.java +++ b/examples/employee-app/src/main/java/io/helidon/examples/employee/Employee.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021 Oracle and/or its affiliates. + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.service.employee; +package io.helidon.examples.employee; import java.util.UUID; diff --git a/examples/employee-app/src/main/java/io/helidon/service/employee/EmployeeRepository.java b/examples/employee-app/src/main/java/io/helidon/examples/employee/EmployeeRepository.java similarity index 98% rename from examples/employee-app/src/main/java/io/helidon/service/employee/EmployeeRepository.java rename to examples/employee-app/src/main/java/io/helidon/examples/employee/EmployeeRepository.java index 637f1940467..b53cef37ed2 100644 --- a/examples/employee-app/src/main/java/io/helidon/service/employee/EmployeeRepository.java +++ b/examples/employee-app/src/main/java/io/helidon/examples/employee/EmployeeRepository.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.service.employee; +package io.helidon.examples.employee; import java.util.List; import java.util.Optional; diff --git a/examples/employee-app/src/main/java/io/helidon/service/employee/EmployeeRepositoryImpl.java b/examples/employee-app/src/main/java/io/helidon/examples/employee/EmployeeRepositoryImpl.java similarity index 99% rename from examples/employee-app/src/main/java/io/helidon/service/employee/EmployeeRepositoryImpl.java rename to examples/employee-app/src/main/java/io/helidon/examples/employee/EmployeeRepositoryImpl.java index ee4a4ed3d62..e5641fc5852 100644 --- a/examples/employee-app/src/main/java/io/helidon/service/employee/EmployeeRepositoryImpl.java +++ b/examples/employee-app/src/main/java/io/helidon/examples/employee/EmployeeRepositoryImpl.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.service.employee; +package io.helidon.examples.employee; import java.io.InputStream; import java.util.Arrays; diff --git a/examples/employee-app/src/main/java/io/helidon/service/employee/EmployeeRepositoryImplDB.java b/examples/employee-app/src/main/java/io/helidon/examples/employee/EmployeeRepositoryImplDB.java similarity index 99% rename from examples/employee-app/src/main/java/io/helidon/service/employee/EmployeeRepositoryImplDB.java rename to examples/employee-app/src/main/java/io/helidon/examples/employee/EmployeeRepositoryImplDB.java index 4ec8fe82ce0..17c0c6caeb6 100644 --- a/examples/employee-app/src/main/java/io/helidon/service/employee/EmployeeRepositoryImplDB.java +++ b/examples/employee-app/src/main/java/io/helidon/examples/employee/EmployeeRepositoryImplDB.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.service.employee; +package io.helidon.examples.employee; import java.util.List; import java.util.Optional; diff --git a/examples/employee-app/src/main/java/io/helidon/service/employee/EmployeeService.java b/examples/employee-app/src/main/java/io/helidon/examples/employee/EmployeeService.java similarity index 96% rename from examples/employee-app/src/main/java/io/helidon/service/employee/EmployeeService.java rename to examples/employee-app/src/main/java/io/helidon/examples/employee/EmployeeService.java index a04411a98dc..ff2f01cf5df 100644 --- a/examples/employee-app/src/main/java/io/helidon/service/employee/EmployeeService.java +++ b/examples/employee-app/src/main/java/io/helidon/examples/employee/EmployeeService.java @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.service.employee; +package io.helidon.examples.employee; import java.util.HashMap; import java.util.Map; import java.util.logging.Logger; import io.helidon.config.Config; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; /** * The Employee service endpoints. diff --git a/examples/employee-app/src/main/java/io/helidon/examples/employee/Main.java b/examples/employee-app/src/main/java/io/helidon/examples/employee/Main.java new file mode 100644 index 00000000000..3a90cdd89de --- /dev/null +++ b/examples/employee-app/src/main/java/io/helidon/examples/employee/Main.java @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.examples.employee; + +import io.helidon.config.Config; +import io.helidon.logging.common.LogConfig; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.observe.ObserveFeature; +import io.helidon.webserver.staticcontent.StaticContentService; + +/** + * Simple Employee rest application. + */ +public final class Main { + + /** + * Cannot be instantiated. + */ + private Main() { + } + + /** + * Application main entry point. + * + * @param args command line arguments. + */ + public static void main(final String[] args) { + WebServerConfig.Builder builder = WebServer.builder(); + setup(builder); + WebServer server = builder.build().start(); + System.out.printf(""" + WEB server is up! + Web client at: http://localhost:%1$d/public/index.html + """, server.port()); + } + + /** + * Set up the server. + * + * @param server server builder + */ + static void setup(WebServerConfig.Builder server) { + + // load logging configuration + LogConfig.configureRuntime(); + + // By default, this will pick up application.yaml from the classpath + Config config = Config.create(); + + // Get webserver config from the "server" section of application.yaml and JSON support registration + server.config(config.get("server")) + .routing(r -> routing(r, config)); + } + + /** + * Setup routing. + * + * @param routing routing builder + * @param config configuration of this server + */ + static void routing(HttpRouting.Builder routing, Config config) { + routing.addFeature(ObserveFeature.create()) + .register("/public", StaticContentService.builder("public") + .welcomeFileName("index.html")) + .register("/employees", new EmployeeService(config)); + } + +} diff --git a/examples/employee-app/src/main/java/io/helidon/examples/employee/package-info.java b/examples/employee-app/src/main/java/io/helidon/examples/employee/package-info.java new file mode 100644 index 00000000000..af67b8932d8 --- /dev/null +++ b/examples/employee-app/src/main/java/io/helidon/examples/employee/package-info.java @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Employee example application + *

+ * Start with {@link io.helidon.examples.employee.Main} class. + * + * @see io.helidon.examples.employee.Main + */ +package io.helidon.examples.employee; diff --git a/examples/employee-app/src/main/java/io/helidon/service/employee/Main.java b/examples/employee-app/src/main/java/io/helidon/service/employee/Main.java deleted file mode 100644 index 48bfd7b2fde..00000000000 --- a/examples/employee-app/src/main/java/io/helidon/service/employee/Main.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2019, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.service.employee; - -import io.helidon.config.Config; -import io.helidon.logging.common.LogConfig; -import io.helidon.nima.observe.ObserveFeature; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.staticcontent.StaticContentService; - -/** - * Simple Employee rest application. - */ -public final class Main { - - /** - * Cannot be instantiated. - */ - private Main() { - } - - /** - * Application main entry point. - * - * @param args command line arguments. - */ - public static void main(final String[] args) { - WebServerConfig.Builder builder = WebServer.builder(); - setup(builder); - WebServer server = builder.build().start(); - System.out.printf(""" - WEB server is up! - Web client at: http://localhost:%1$d/public/index.html - """, server.port()); - } - - /** - * Set up the server. - * - * @param server server builder - */ - static void setup(WebServerConfig.Builder server) { - - // load logging configuration - LogConfig.configureRuntime(); - - // By default, this will pick up application.yaml from the classpath - Config config = Config.create(); - - // Get webserver config from the "server" section of application.yaml and JSON support registration - server.config(config.get("server")) - .routing(r -> routing(r, config)); - } - - /** - * Setup routing. - * - * @param routing routing builder - * @param config configuration of this server - */ - static void routing(HttpRouting.Builder routing, Config config) { - routing.addFeature(ObserveFeature.create()) - .register("/public", StaticContentService.builder("public") - .welcomeFileName("index.html")) - .register("/employees", new EmployeeService(config)); - } - -} diff --git a/examples/employee-app/src/main/java/io/helidon/service/employee/package-info.java b/examples/employee-app/src/main/java/io/helidon/service/employee/package-info.java deleted file mode 100644 index addc5ad6ce2..00000000000 --- a/examples/employee-app/src/main/java/io/helidon/service/employee/package-info.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2019, 2021 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Employee example application - *

- * Start with {@link io.helidon.service.employee.Main} class. - * - * @see io.helidon.service.employee.Main - */ -package io.helidon.service.employee; diff --git a/examples/employee-app/src/main/resources/logging.properties b/examples/employee-app/src/main/resources/logging.properties index a83e9d0bce6..57a34e4663c 100644 --- a/examples/employee-app/src/main/resources/logging.properties +++ b/examples/employee-app/src/main/resources/logging.properties @@ -27,7 +27,7 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ .level=INFO # Component specific log levels -#io.helidon.nima.webserver.level=INFO +#io.helidon.webserver.level=INFO #io.helidon.config.level=INFO #io.helidon.security.level=INFO #io.helidon.common.level=INFO diff --git a/examples/employee-app/src/test/java/io/helidon/examples/employee/MainTest.java b/examples/employee-app/src/test/java/io/helidon/examples/employee/MainTest.java new file mode 100644 index 00000000000..dcdd81d267a --- /dev/null +++ b/examples/employee-app/src/test/java/io/helidon/examples/employee/MainTest.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.examples.employee; + +import io.helidon.http.Http; +import io.helidon.config.Config; +import io.helidon.webserver.testing.junit5.DirectClient; +import io.helidon.webserver.testing.junit5.RoutingTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.http.HttpRouting; + +import jakarta.json.JsonArray; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +@RoutingTest +public class MainTest { + + private final DirectClient client; + + public MainTest(DirectClient client) { + this.client = client; + } + + @SetUpRoute + public static void setup(HttpRouting.Builder routing) { + Main.routing(routing, Config.empty()); + } + + @Test + public void testEmployees() { + try (Http1ClientResponse response = client.get("/employees") + .request()) { + assertThat("HTTP response2", response.status(), is(Http.Status.OK_200)); + assertThat(response.as(JsonArray.class).size(), is(40)); + } + } + +} diff --git a/examples/employee-app/src/test/java/io/helidon/service/employee/MainTest.java b/examples/employee-app/src/test/java/io/helidon/service/employee/MainTest.java deleted file mode 100644 index 9ad87157e00..00000000000 --- a/examples/employee-app/src/test/java/io/helidon/service/employee/MainTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2019, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.service.employee; - -import io.helidon.common.http.Http; -import io.helidon.config.Config; -import io.helidon.nima.testing.junit5.webserver.DirectClient; -import io.helidon.nima.testing.junit5.webserver.RoutingTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.http.HttpRouting; - -import jakarta.json.JsonArray; -import org.junit.jupiter.api.Test; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; - -@RoutingTest -public class MainTest { - - private final DirectClient client; - - public MainTest(DirectClient client) { - this.client = client; - } - - @SetUpRoute - public static void setup(HttpRouting.Builder routing) { - Main.routing(routing, Config.empty()); - } - - @Test - public void testEmployees() { - try (Http1ClientResponse response = client.get("/employees") - .request()) { - assertThat("HTTP response2", response.status(), is(Http.Status.OK_200)); - assertThat(response.as(JsonArray.class).size(), is(40)); - } - } - -} diff --git a/examples/fault-tolerance/pom.xml b/examples/fault-tolerance/pom.xml new file mode 100644 index 00000000000..3e591e75fcd --- /dev/null +++ b/examples/fault-tolerance/pom.xml @@ -0,0 +1,138 @@ + + + + 4.0.0 + + io.helidon.applications + helidon-se + 4.0.0-SNAPSHOT + ../../applications/se/pom.xml + + + io.helidon.examples + helidon-examples-fault-tolerance + Helidon Examples Fault Tolerance + + + io.helidon.Main + + + + + io.helidon + helidon + + + io.helidon.webserver + helidon-webserver + + + io.helidon.webclient + helidon-webclient + + + io.helidon.inject + helidon-inject-api + + + io.helidon.inject + helidon-inject-runtime + + + io.helidon.inject.configdriven + helidon-inject-configdriven-runtime + + + io.helidon.config + helidon-config-yaml + + + io.helidon.fault-tolerance + helidon-fault-tolerance + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + true + + + io.helidon.inject + helidon-inject-processor + ${helidon.version} + + + io.helidon.http + helidon-http-processor + ${helidon.version} + + + io.helidon.fault-tolerance + helidon-fault-tolerance-processor + ${helidon.version} + + + + -Aio.helidon.inject.autoAddNonContractInterfaces=true + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-libs + + + + + org.apache.maven.plugins + maven-failsafe-plugin + + + + integration-test + verify + + + + + + + diff --git a/examples/nima/fault-tolerance/src/main/java/io/helidon/examples/nima/faulttolerance/AdminEndpoint.java b/examples/fault-tolerance/src/main/java/io/helidon/examples/faulttolerance/AdminEndpoint.java similarity index 90% rename from examples/nima/fault-tolerance/src/main/java/io/helidon/examples/nima/faulttolerance/AdminEndpoint.java rename to examples/fault-tolerance/src/main/java/io/helidon/examples/faulttolerance/AdminEndpoint.java index a1430d70985..2e15380bcd9 100644 --- a/examples/nima/fault-tolerance/src/main/java/io/helidon/examples/nima/faulttolerance/AdminEndpoint.java +++ b/examples/fault-tolerance/src/main/java/io/helidon/examples/faulttolerance/AdminEndpoint.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.helidon.examples.nima.faulttolerance; +package io.helidon.examples.faulttolerance; -import io.helidon.common.http.Endpoint; +import io.helidon.http.Endpoint; import jakarta.inject.Singleton; diff --git a/examples/nima/fault-tolerance/src/main/java/io/helidon/examples/nima/faulttolerance/GreetEndpoint.java b/examples/fault-tolerance/src/main/java/io/helidon/examples/faulttolerance/GreetEndpoint.java similarity index 92% rename from examples/nima/fault-tolerance/src/main/java/io/helidon/examples/nima/faulttolerance/GreetEndpoint.java rename to examples/fault-tolerance/src/main/java/io/helidon/examples/faulttolerance/GreetEndpoint.java index 407481f791c..a1b70348d18 100644 --- a/examples/nima/fault-tolerance/src/main/java/io/helidon/examples/nima/faulttolerance/GreetEndpoint.java +++ b/examples/fault-tolerance/src/main/java/io/helidon/examples/faulttolerance/GreetEndpoint.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.examples.nima.faulttolerance; +package io.helidon.examples.faulttolerance; import java.time.temporal.ChronoUnit; -import io.helidon.common.http.Endpoint; -import io.helidon.common.http.Http; +import io.helidon.faulttolerance.FaultTolerance; +import io.helidon.http.Endpoint; +import io.helidon.http.Http; import io.helidon.inject.api.InjectionException; -import io.helidon.nima.faulttolerance.FaultTolerance; import jakarta.inject.Singleton; diff --git a/examples/nima/fault-tolerance/src/main/java/io/helidon/examples/nima/faulttolerance/PlatformExecutorProvider.java b/examples/fault-tolerance/src/main/java/io/helidon/examples/faulttolerance/PlatformExecutorProvider.java similarity index 88% rename from examples/nima/fault-tolerance/src/main/java/io/helidon/examples/nima/faulttolerance/PlatformExecutorProvider.java rename to examples/fault-tolerance/src/main/java/io/helidon/examples/faulttolerance/PlatformExecutorProvider.java index c1bb400f30f..f463a5f404d 100644 --- a/examples/nima/fault-tolerance/src/main/java/io/helidon/examples/nima/faulttolerance/PlatformExecutorProvider.java +++ b/examples/fault-tolerance/src/main/java/io/helidon/examples/faulttolerance/PlatformExecutorProvider.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.examples.nima.faulttolerance; +package io.helidon.examples.faulttolerance; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -27,8 +27,7 @@ import jakarta.inject.Singleton; /** - * This service will be part of Níma on Injection module. - * It may use Injection to get config sources exposed through injection. + * Injection provider that provides a "platform" executor. */ @Singleton @Named("platform-executor") diff --git a/examples/fault-tolerance/src/main/java/io/helidon/examples/faulttolerance/package-info.java b/examples/fault-tolerance/src/main/java/io/helidon/examples/faulttolerance/package-info.java new file mode 100644 index 00000000000..62bb56cb0ff --- /dev/null +++ b/examples/fault-tolerance/src/main/java/io/helidon/examples/faulttolerance/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Example showing usage of HTTP endpoints with Fault Tolerance annotations. + */ +package io.helidon.examples.faulttolerance; diff --git a/examples/nima/fault-tolerance/src/main/resources/application.yaml b/examples/fault-tolerance/src/main/resources/application.yaml similarity index 100% rename from examples/nima/fault-tolerance/src/main/resources/application.yaml rename to examples/fault-tolerance/src/main/resources/application.yaml diff --git a/examples/nima/fault-tolerance/src/main/resources/logging.properties b/examples/fault-tolerance/src/main/resources/logging.properties similarity index 100% rename from examples/nima/fault-tolerance/src/main/resources/logging.properties rename to examples/fault-tolerance/src/main/resources/logging.properties diff --git a/examples/fault-tolerance/src/test/java/io/helidon/examples/faulttolerance/FaultToleranceTest.java b/examples/fault-tolerance/src/test/java/io/helidon/examples/faulttolerance/FaultToleranceTest.java new file mode 100644 index 00000000000..f1f7efe19c8 --- /dev/null +++ b/examples/fault-tolerance/src/test/java/io/helidon/examples/faulttolerance/FaultToleranceTest.java @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.examples.faulttolerance; + +import io.helidon.Main; +import io.helidon.http.Http; +import io.helidon.inject.api.InjectionServices; +import io.helidon.webclient.api.ClientResponseTyped; +import io.helidon.webclient.api.WebClient; +import io.helidon.webserver.WebServer; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.startsWith; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.fail; + +class FaultToleranceTest { + private static WebClient webClient; + private static WebClient adminWebClient; + + @BeforeAll + static void init() { + Main.main(new String[0]); + WebServer webServer = InjectionServices.realizedServices() + .lookup(WebServer.class) + .get(); + + if (!webServer.isRunning()) { + fail("Webserver should be running, but is shut down"); + } + + webClient = WebClient.builder() + .baseUri("http://localhost:" + webServer.port()) + .build(); + + adminWebClient = WebClient.builder() + .baseUri("http://localhost:" + webServer.port("admin")) + .build(); + } + + @AfterAll + static void shutDown() { + InjectionServices.injectionServices() + .map(InjectionServices::shutdown); + } + + @Test + void testAdminEndpointIsOnAdminSocket() { + String response = adminWebClient.get("/admin") + .requestEntity(String.class); + + assertThat(response, startsWith("This is the admin endpoint")); + } + + @Test + void testAdminEndpointIsNotOnDefaultSocket() { + ClientResponseTyped response = webClient.get("/admin") + .request(String.class); + assertThat(response.entity(), response.status(), is(Http.Status.NOT_FOUND_404)); + } + + @Test + void testGreetSimple() { + String response = webClient.get("/greet") + .requestEntity(String.class); + assertThat(response, is("Hello World!")); + } + + @Test + void testGreetNamed() { + String response = webClient.get("/greet/helidon") + .requestEntity(String.class); + + assertThat(response, startsWith("Hello helidon! Requested host: localhost:")); + } + + @Test + void testGreetNamedFallback() { + String response = webClient.get("/greet/helidon") + .queryParam("throw", "true") + .requestEntity(String.class); + + assertThat(response, startsWith("Fallback for")); + } +} diff --git a/examples/graphql/basics/pom.xml b/examples/graphql/basics/pom.xml index 49df218c469..1e5be437a38 100644 --- a/examples/graphql/basics/pom.xml +++ b/examples/graphql/basics/pom.xml @@ -27,7 +27,7 @@ io.helidon.examples.graphql helidon-examples-graphql-basics - Helidon GraphQL Examples Basics + Helidon Examples GraphQL Basics Basic usage of GraphQL in helidon SE @@ -39,12 +39,12 @@ - io.helidon.nima.graphql - helidon-nima-graphql-server + io.helidon.webserver + helidon-webserver-graphql - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver io.helidon.common diff --git a/examples/graphql/basics/src/main/java/io/helidon/examples/graphql/basics/Main.java b/examples/graphql/basics/src/main/java/io/helidon/examples/graphql/basics/Main.java index 888f26d59cd..ba5911e61ab 100644 --- a/examples/graphql/basics/src/main/java/io/helidon/examples/graphql/basics/Main.java +++ b/examples/graphql/basics/src/main/java/io/helidon/examples/graphql/basics/Main.java @@ -18,8 +18,8 @@ import java.util.List; -import io.helidon.nima.graphql.server.GraphQlService; -import io.helidon.nima.webserver.WebServer; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.graphql.GraphQlService; import graphql.schema.DataFetcher; import graphql.schema.GraphQLSchema; diff --git a/examples/graphql/pom.xml b/examples/graphql/pom.xml index 063f00f798a..3926f2a7ecf 100644 --- a/examples/graphql/pom.xml +++ b/examples/graphql/pom.xml @@ -27,7 +27,7 @@ io.helidon.examples.graphql helidon-examples-graphql-project pom - Helidon GraphQL Examples + Helidon Examples GraphQL basics diff --git a/examples/health/basics/pom.xml b/examples/health/basics/pom.xml index 36414b3ff33..7e35f8ddff9 100644 --- a/examples/health/basics/pom.xml +++ b/examples/health/basics/pom.xml @@ -27,7 +27,7 @@ io.helidon.examples.health helidon-examples-health-basics - Helidon Health Examples Basics + Helidon Examples Health Basics Basic usage of health checks in helidon SE @@ -39,12 +39,12 @@ - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.nima.observe - helidon-nima-observe-health + io.helidon.webserver.observe + helidon-webserver-observe-health io.helidon.health diff --git a/examples/health/basics/src/main/java/io/helidon/examples/health/basics/Main.java b/examples/health/basics/src/main/java/io/helidon/examples/health/basics/Main.java index 4638bf1916d..55b055ca933 100644 --- a/examples/health/basics/src/main/java/io/helidon/examples/health/basics/Main.java +++ b/examples/health/basics/src/main/java/io/helidon/examples/health/basics/Main.java @@ -20,11 +20,11 @@ import io.helidon.health.HealthCheckResponse; import io.helidon.health.HealthCheckType; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.observe.ObserveFeature; -import io.helidon.nima.observe.health.HealthFeature; -import io.helidon.nima.observe.health.HealthObserveProvider; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.observe.ObserveFeature; +import io.helidon.webserver.observe.health.HealthFeature; +import io.helidon.webserver.observe.health.HealthObserveProvider; /** * Main class of health check integration example. diff --git a/examples/health/pom.xml b/examples/health/pom.xml index 31312e2e598..7ad1008c435 100644 --- a/examples/health/pom.xml +++ b/examples/health/pom.xml @@ -27,7 +27,7 @@ io.helidon.examples.health helidon-examples-health-project pom - Helidon Health Examples + Helidon Examples Health basics diff --git a/examples/inject/README.md b/examples/inject/README.md index 19ad7bd4504..081854eeae7 100644 --- a/examples/inject/README.md +++ b/examples/inject/README.md @@ -1,5 +1,5 @@ -# Helidon Injection Examples +# Helidon Examples Injection Each subdirectory contains example code that highlights specific aspects of Helidon Injection. diff --git a/examples/inject/application/pom.xml b/examples/inject/application/pom.xml index 5d01aa58162..ffb98f326a9 100644 --- a/examples/inject/application/pom.xml +++ b/examples/inject/application/pom.xml @@ -22,13 +22,13 @@ 4.0.0 io.helidon.applications - helidon-nima + helidon-se 4.0.0-SNAPSHOT - ../../../applications/nima/pom.xml + ../../../applications/se/pom.xml io.helidon.examples.inject helidon-examples-inject-application - Helidon Injection Examples Application + Helidon Examples Injection Application Example usages of an Injection Application. diff --git a/examples/inject/basics/pom.xml b/examples/inject/basics/pom.xml index 779dd882c98..2f29aa24431 100644 --- a/examples/inject/basics/pom.xml +++ b/examples/inject/basics/pom.xml @@ -22,13 +22,13 @@ 4.0.0 io.helidon.applications - helidon-nima + helidon-se 4.0.0-SNAPSHOT - ../../../applications/nima/pom.xml + ../../../applications/se/pom.xml io.helidon.examples.inject helidon-examples-inject-basics - Helidon Injection Examples Basics + Helidon Examples Injection Basics Examples of programmatic and declarative usages of Injection. diff --git a/examples/inject/configdriven/pom.xml b/examples/inject/configdriven/pom.xml index bdfa4cb820e..221e6ff69e3 100644 --- a/examples/inject/configdriven/pom.xml +++ b/examples/inject/configdriven/pom.xml @@ -22,13 +22,13 @@ 4.0.0 io.helidon.applications - helidon-nima + helidon-se 4.0.0-SNAPSHOT - ../../../applications/nima/pom.xml + ../../../applications/se/pom.xml io.helidon.examples.inject helidon-examples-inject-configdriven - Helidon Injection Examples Config-Driven + Helidon Examples Injection Config-Driven Examples of Config-driven services in Injection. diff --git a/examples/inject/interceptors/pom.xml b/examples/inject/interceptors/pom.xml index c3ae8a9321c..bc7515345de 100644 --- a/examples/inject/interceptors/pom.xml +++ b/examples/inject/interceptors/pom.xml @@ -22,13 +22,13 @@ 4.0.0 io.helidon.applications - helidon-nima + helidon-se 4.0.0-SNAPSHOT - ../../../applications/nima/pom.xml + ../../../applications/se/pom.xml io.helidon.examples.inject helidon-examples-inject-interceptors - Helidon Injection Examples Interceptors + Helidon Examples Injection Interceptors Example usages of Injection in Interceptors. diff --git a/examples/inject/pom.xml b/examples/inject/pom.xml index 78b789a3ac9..07ee8d010c7 100644 --- a/examples/inject/pom.xml +++ b/examples/inject/pom.xml @@ -28,7 +28,7 @@ io.helidon.examples.inject helidon-examples-inject-project pom - Helidon Injection Examples + Helidon Examples Injection basics diff --git a/examples/inject/providers/pom.xml b/examples/inject/providers/pom.xml index 0f5a83629b9..3445464e1fb 100644 --- a/examples/inject/providers/pom.xml +++ b/examples/inject/providers/pom.xml @@ -22,13 +22,13 @@ 4.0.0 io.helidon.applications - helidon-nima + helidon-se 4.0.0-SNAPSHOT - ../../../applications/nima/pom.xml + ../../../applications/se/pom.xml io.helidon.examples.inject helidon-examples-inject-providers - Helidon Injection Examples Providers + Helidon Examples Injection Providers Example usages of Injection Providers. diff --git a/examples/integrations/cdi/datasource-hikaricp-h2/pom.xml b/examples/integrations/cdi/datasource-hikaricp-h2/pom.xml index d4d05758adf..c979fc688fb 100644 --- a/examples/integrations/cdi/datasource-hikaricp-h2/pom.xml +++ b/examples/integrations/cdi/datasource-hikaricp-h2/pom.xml @@ -14,7 +14,7 @@ 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. - + --> io.helidon.examples.integrations.cdi helidon-integrations-examples-datasource-hikaricp-h2 - Helidon CDI Extensions Examples DataSource/HikariCP H2 + Helidon Examples CDI Extensions DataSource/HikariCP H2 diff --git a/examples/integrations/cdi/datasource-hikaricp-h2/src/main/java/io/helidon/examples/integrations/datasource/hikaricp/jaxrs/TablesResource.java b/examples/integrations/cdi/datasource-hikaricp-h2/src/main/java/io/helidon/examples/integrations/datasource/hikaricp/jaxrs/TablesResource.java new file mode 100644 index 00000000000..35fcaeac4f2 --- /dev/null +++ b/examples/integrations/cdi/datasource-hikaricp-h2/src/main/java/io/helidon/examples/integrations/datasource/hikaricp/jaxrs/TablesResource.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.helidon.examples.integrations.datasource.hikaricp.jaxrs; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Objects; + +import javax.sql.DataSource; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; +import jakarta.inject.Named; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; + +/** + * A JAX-RS resource class in {@linkplain ApplicationScoped + * application scope} rooted at {@code /tables}. + * + * @see #get() + */ +@Path("/tables") +@ApplicationScoped +public class TablesResource { + + private final DataSource dataSource; + + /** + * Creates a new {@link TablesResource}. + * + * @param dataSource the {@link DataSource} to use to acquire + * database table names; must not be {@code null} + * + * @exception NullPointerException if {@code dataSource} is {@code + * null} + */ + @Inject + public TablesResource(@Named("example") final DataSource dataSource) { + super(); + this.dataSource = Objects.requireNonNull(dataSource); + } + + /** + * Returns a {@link Response} which, if successful, contains a + * newline-separated list of Oracle database table names. + * + *

This method never returns {@code null}.

+ * + * @return a non-{@code null} {@link Response} + * + * @exception SQLException if a database error occurs + */ + @GET + @Produces(MediaType.TEXT_PLAIN) + public Response get() throws SQLException { + final StringBuilder sb = new StringBuilder(); + try (Connection connection = this.dataSource.getConnection(); + PreparedStatement ps = + connection.prepareStatement(" SELECT TABLE_NAME" + + " FROM INFORMATION_SCHEMA.TABLES " + + "ORDER BY TABLE_NAME ASC"); + ResultSet rs = ps.executeQuery()) { + while (rs.next()) { + sb.append(rs.getString(1)).append("\n"); + } + } + final Response returnValue = Response.ok() + .entity(sb.toString()) + .build(); + return returnValue; + } + +} diff --git a/examples/integrations/cdi/datasource-hikaricp-h2/src/main/java/io/helidon/examples/integrations/datasource/hikaricp/jaxrs/package-info.java b/examples/integrations/cdi/datasource-hikaricp-h2/src/main/java/io/helidon/examples/integrations/datasource/hikaricp/jaxrs/package-info.java new file mode 100644 index 00000000000..1dfba973d57 --- /dev/null +++ b/examples/integrations/cdi/datasource-hikaricp-h2/src/main/java/io/helidon/examples/integrations/datasource/hikaricp/jaxrs/package-info.java @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Provides JAX-RS-related classes and interfaces for this example + * project. + */ +package io.helidon.examples.integrations.datasource.hikaricp.jaxrs; diff --git a/examples/integrations/cdi/datasource-hikaricp-h2/src/main/java/io/helidon/integrations/examples/datasource/hikaricp/jaxrs/TablesResource.java b/examples/integrations/cdi/datasource-hikaricp-h2/src/main/java/io/helidon/integrations/examples/datasource/hikaricp/jaxrs/TablesResource.java deleted file mode 100644 index 76c6d33acba..00000000000 --- a/examples/integrations/cdi/datasource-hikaricp-h2/src/main/java/io/helidon/integrations/examples/datasource/hikaricp/jaxrs/TablesResource.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2019, 2021 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.helidon.integrations.examples.datasource.hikaricp.jaxrs; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.Objects; - -import javax.sql.DataSource; - -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; -import jakarta.inject.Named; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; - -/** - * A JAX-RS resource class in {@linkplain ApplicationScoped - * application scope} rooted at {@code /tables}. - * - * @see #get() - */ -@Path("/tables") -@ApplicationScoped -public class TablesResource { - - private final DataSource dataSource; - - /** - * Creates a new {@link TablesResource}. - * - * @param dataSource the {@link DataSource} to use to acquire - * database table names; must not be {@code null} - * - * @exception NullPointerException if {@code dataSource} is {@code - * null} - */ - @Inject - public TablesResource(@Named("example") final DataSource dataSource) { - super(); - this.dataSource = Objects.requireNonNull(dataSource); - } - - /** - * Returns a {@link Response} which, if successful, contains a - * newline-separated list of Oracle database table names. - * - *

This method never returns {@code null}.

- * - * @return a non-{@code null} {@link Response} - * - * @exception SQLException if a database error occurs - */ - @GET - @Produces(MediaType.TEXT_PLAIN) - public Response get() throws SQLException { - final StringBuilder sb = new StringBuilder(); - try (Connection connection = this.dataSource.getConnection(); - PreparedStatement ps = - connection.prepareStatement(" SELECT TABLE_NAME" - + " FROM INFORMATION_SCHEMA.TABLES " - + "ORDER BY TABLE_NAME ASC"); - ResultSet rs = ps.executeQuery()) { - while (rs.next()) { - sb.append(rs.getString(1)).append("\n"); - } - } - final Response returnValue = Response.ok() - .entity(sb.toString()) - .build(); - return returnValue; - } - -} diff --git a/examples/integrations/cdi/datasource-hikaricp-h2/src/main/java/io/helidon/integrations/examples/datasource/hikaricp/jaxrs/package-info.java b/examples/integrations/cdi/datasource-hikaricp-h2/src/main/java/io/helidon/integrations/examples/datasource/hikaricp/jaxrs/package-info.java deleted file mode 100644 index 5814f096ad2..00000000000 --- a/examples/integrations/cdi/datasource-hikaricp-h2/src/main/java/io/helidon/integrations/examples/datasource/hikaricp/jaxrs/package-info.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2019, 2021 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Provides JAX-RS-related classes and interfaces for this example - * project. - */ -package io.helidon.integrations.examples.datasource.hikaricp.jaxrs; diff --git a/examples/integrations/cdi/datasource-hikaricp-mysql/pom.xml b/examples/integrations/cdi/datasource-hikaricp-mysql/pom.xml index c802b4e21fa..9d5fdd66c6c 100644 --- a/examples/integrations/cdi/datasource-hikaricp-mysql/pom.xml +++ b/examples/integrations/cdi/datasource-hikaricp-mysql/pom.xml @@ -14,7 +14,7 @@ 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. - + --> io.helidon.examples.integrations.cdi helidon-integrations-examples-datasource-hikaricp-mysql - Helidon CDI Extensions Examples DataSource/HikariCP MySQL + Helidon Examples CDI Extensions DataSource/HikariCP MySQL diff --git a/examples/integrations/cdi/datasource-hikaricp-mysql/src/main/java/io/helidon/examples/integrations/datasource/hikaricp/jaxrs/TablesResource.java b/examples/integrations/cdi/datasource-hikaricp-mysql/src/main/java/io/helidon/examples/integrations/datasource/hikaricp/jaxrs/TablesResource.java new file mode 100644 index 00000000000..35fcaeac4f2 --- /dev/null +++ b/examples/integrations/cdi/datasource-hikaricp-mysql/src/main/java/io/helidon/examples/integrations/datasource/hikaricp/jaxrs/TablesResource.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.helidon.examples.integrations.datasource.hikaricp.jaxrs; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Objects; + +import javax.sql.DataSource; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; +import jakarta.inject.Named; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; + +/** + * A JAX-RS resource class in {@linkplain ApplicationScoped + * application scope} rooted at {@code /tables}. + * + * @see #get() + */ +@Path("/tables") +@ApplicationScoped +public class TablesResource { + + private final DataSource dataSource; + + /** + * Creates a new {@link TablesResource}. + * + * @param dataSource the {@link DataSource} to use to acquire + * database table names; must not be {@code null} + * + * @exception NullPointerException if {@code dataSource} is {@code + * null} + */ + @Inject + public TablesResource(@Named("example") final DataSource dataSource) { + super(); + this.dataSource = Objects.requireNonNull(dataSource); + } + + /** + * Returns a {@link Response} which, if successful, contains a + * newline-separated list of Oracle database table names. + * + *

This method never returns {@code null}.

+ * + * @return a non-{@code null} {@link Response} + * + * @exception SQLException if a database error occurs + */ + @GET + @Produces(MediaType.TEXT_PLAIN) + public Response get() throws SQLException { + final StringBuilder sb = new StringBuilder(); + try (Connection connection = this.dataSource.getConnection(); + PreparedStatement ps = + connection.prepareStatement(" SELECT TABLE_NAME" + + " FROM INFORMATION_SCHEMA.TABLES " + + "ORDER BY TABLE_NAME ASC"); + ResultSet rs = ps.executeQuery()) { + while (rs.next()) { + sb.append(rs.getString(1)).append("\n"); + } + } + final Response returnValue = Response.ok() + .entity(sb.toString()) + .build(); + return returnValue; + } + +} diff --git a/examples/integrations/cdi/datasource-hikaricp-mysql/src/main/java/io/helidon/examples/integrations/datasource/hikaricp/jaxrs/package-info.java b/examples/integrations/cdi/datasource-hikaricp-mysql/src/main/java/io/helidon/examples/integrations/datasource/hikaricp/jaxrs/package-info.java new file mode 100644 index 00000000000..1dfba973d57 --- /dev/null +++ b/examples/integrations/cdi/datasource-hikaricp-mysql/src/main/java/io/helidon/examples/integrations/datasource/hikaricp/jaxrs/package-info.java @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Provides JAX-RS-related classes and interfaces for this example + * project. + */ +package io.helidon.examples.integrations.datasource.hikaricp.jaxrs; diff --git a/examples/integrations/cdi/datasource-hikaricp-mysql/src/main/java/io/helidon/integrations/examples/datasource/hikaricp/jaxrs/TablesResource.java b/examples/integrations/cdi/datasource-hikaricp-mysql/src/main/java/io/helidon/integrations/examples/datasource/hikaricp/jaxrs/TablesResource.java deleted file mode 100644 index 76c6d33acba..00000000000 --- a/examples/integrations/cdi/datasource-hikaricp-mysql/src/main/java/io/helidon/integrations/examples/datasource/hikaricp/jaxrs/TablesResource.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2019, 2021 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.helidon.integrations.examples.datasource.hikaricp.jaxrs; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.Objects; - -import javax.sql.DataSource; - -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; -import jakarta.inject.Named; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; - -/** - * A JAX-RS resource class in {@linkplain ApplicationScoped - * application scope} rooted at {@code /tables}. - * - * @see #get() - */ -@Path("/tables") -@ApplicationScoped -public class TablesResource { - - private final DataSource dataSource; - - /** - * Creates a new {@link TablesResource}. - * - * @param dataSource the {@link DataSource} to use to acquire - * database table names; must not be {@code null} - * - * @exception NullPointerException if {@code dataSource} is {@code - * null} - */ - @Inject - public TablesResource(@Named("example") final DataSource dataSource) { - super(); - this.dataSource = Objects.requireNonNull(dataSource); - } - - /** - * Returns a {@link Response} which, if successful, contains a - * newline-separated list of Oracle database table names. - * - *

This method never returns {@code null}.

- * - * @return a non-{@code null} {@link Response} - * - * @exception SQLException if a database error occurs - */ - @GET - @Produces(MediaType.TEXT_PLAIN) - public Response get() throws SQLException { - final StringBuilder sb = new StringBuilder(); - try (Connection connection = this.dataSource.getConnection(); - PreparedStatement ps = - connection.prepareStatement(" SELECT TABLE_NAME" - + " FROM INFORMATION_SCHEMA.TABLES " - + "ORDER BY TABLE_NAME ASC"); - ResultSet rs = ps.executeQuery()) { - while (rs.next()) { - sb.append(rs.getString(1)).append("\n"); - } - } - final Response returnValue = Response.ok() - .entity(sb.toString()) - .build(); - return returnValue; - } - -} diff --git a/examples/integrations/cdi/datasource-hikaricp-mysql/src/main/java/io/helidon/integrations/examples/datasource/hikaricp/jaxrs/package-info.java b/examples/integrations/cdi/datasource-hikaricp-mysql/src/main/java/io/helidon/integrations/examples/datasource/hikaricp/jaxrs/package-info.java deleted file mode 100644 index 5814f096ad2..00000000000 --- a/examples/integrations/cdi/datasource-hikaricp-mysql/src/main/java/io/helidon/integrations/examples/datasource/hikaricp/jaxrs/package-info.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2019, 2021 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Provides JAX-RS-related classes and interfaces for this example - * project. - */ -package io.helidon.integrations.examples.datasource.hikaricp.jaxrs; diff --git a/examples/integrations/cdi/datasource-hikaricp/pom.xml b/examples/integrations/cdi/datasource-hikaricp/pom.xml index c2850ca4680..a919202d9fb 100644 --- a/examples/integrations/cdi/datasource-hikaricp/pom.xml +++ b/examples/integrations/cdi/datasource-hikaricp/pom.xml @@ -14,7 +14,7 @@ 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. - + --> io.helidon.examples.integrations.cdi helidon-examples-integrations-datasource-hikaricp - Helidon CDI Extensions Examples DataSource/HikariCP + Helidon Examples CDI Extensions DataSource/HikariCP diff --git a/examples/integrations/cdi/datasource-hikaricp/src/main/java/io/helidon/examples/integrations/datasource/hikaricp/jaxrs/TablesResource.java b/examples/integrations/cdi/datasource-hikaricp/src/main/java/io/helidon/examples/integrations/datasource/hikaricp/jaxrs/TablesResource.java new file mode 100644 index 00000000000..74026bc5a0c --- /dev/null +++ b/examples/integrations/cdi/datasource-hikaricp/src/main/java/io/helidon/examples/integrations/datasource/hikaricp/jaxrs/TablesResource.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2018, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.helidon.examples.integrations.datasource.hikaricp.jaxrs; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Objects; + +import javax.sql.DataSource; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; +import jakarta.inject.Named; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; + +/** + * A JAX-RS resource class in {@linkplain ApplicationScoped + * application scope} rooted at {@code /tables}. + * + * @see #get() + */ +@Path("/tables") +@ApplicationScoped +public class TablesResource { + + private final DataSource dataSource; + + /** + * Creates a new {@link TablesResource}. + * + * @param dataSource the {@link DataSource} to use to acquire + * database table names; must not be {@code null} + * + * @exception NullPointerException if {@code dataSource} is {@code + * null} + */ + @Inject + public TablesResource(@Named("example") final DataSource dataSource) { + super(); + this.dataSource = Objects.requireNonNull(dataSource); + } + + /** + * Returns a {@link Response} which, if successful, contains a + * newline-separated list of Oracle database table names. + * + *

This method never returns {@code null}.

+ * + * @return a non-{@code null} {@link Response} + * + * @exception SQLException if a database error occurs + */ + @GET + @Produces(MediaType.TEXT_PLAIN) + public Response get() throws SQLException { + final StringBuilder sb = new StringBuilder(); + try (Connection connection = this.dataSource.getConnection(); + PreparedStatement ps = + connection.prepareStatement(" SELECT TABLE_NAME" + + " FROM ALL_TABLES " + + "ORDER BY TABLE_NAME ASC"); + ResultSet rs = ps.executeQuery()) { + while (rs.next()) { + sb.append(rs.getString(1)).append("\n"); + } + } + final Response returnValue = Response.ok() + .entity(sb.toString()) + .build(); + return returnValue; + } + +} diff --git a/examples/integrations/cdi/datasource-hikaricp/src/main/java/io/helidon/examples/integrations/datasource/hikaricp/jaxrs/package-info.java b/examples/integrations/cdi/datasource-hikaricp/src/main/java/io/helidon/examples/integrations/datasource/hikaricp/jaxrs/package-info.java new file mode 100644 index 00000000000..f0ef82d2308 --- /dev/null +++ b/examples/integrations/cdi/datasource-hikaricp/src/main/java/io/helidon/examples/integrations/datasource/hikaricp/jaxrs/package-info.java @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2018, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Provides JAX-RS-related classes and interfaces for this example + * project. + */ +package io.helidon.examples.integrations.datasource.hikaricp.jaxrs; diff --git a/examples/integrations/cdi/datasource-hikaricp/src/main/java/io/helidon/integrations/examples/datasource/hikaricp/jaxrs/TablesResource.java b/examples/integrations/cdi/datasource-hikaricp/src/main/java/io/helidon/integrations/examples/datasource/hikaricp/jaxrs/TablesResource.java deleted file mode 100644 index a8a9b5bd2d0..00000000000 --- a/examples/integrations/cdi/datasource-hikaricp/src/main/java/io/helidon/integrations/examples/datasource/hikaricp/jaxrs/TablesResource.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2018, 2021 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.helidon.integrations.examples.datasource.hikaricp.jaxrs; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.Objects; - -import javax.sql.DataSource; - -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; -import jakarta.inject.Named; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; - -/** - * A JAX-RS resource class in {@linkplain ApplicationScoped - * application scope} rooted at {@code /tables}. - * - * @see #get() - */ -@Path("/tables") -@ApplicationScoped -public class TablesResource { - - private final DataSource dataSource; - - /** - * Creates a new {@link TablesResource}. - * - * @param dataSource the {@link DataSource} to use to acquire - * database table names; must not be {@code null} - * - * @exception NullPointerException if {@code dataSource} is {@code - * null} - */ - @Inject - public TablesResource(@Named("example") final DataSource dataSource) { - super(); - this.dataSource = Objects.requireNonNull(dataSource); - } - - /** - * Returns a {@link Response} which, if successful, contains a - * newline-separated list of Oracle database table names. - * - *

This method never returns {@code null}.

- * - * @return a non-{@code null} {@link Response} - * - * @exception SQLException if a database error occurs - */ - @GET - @Produces(MediaType.TEXT_PLAIN) - public Response get() throws SQLException { - final StringBuilder sb = new StringBuilder(); - try (Connection connection = this.dataSource.getConnection(); - PreparedStatement ps = - connection.prepareStatement(" SELECT TABLE_NAME" - + " FROM ALL_TABLES " - + "ORDER BY TABLE_NAME ASC"); - ResultSet rs = ps.executeQuery()) { - while (rs.next()) { - sb.append(rs.getString(1)).append("\n"); - } - } - final Response returnValue = Response.ok() - .entity(sb.toString()) - .build(); - return returnValue; - } - -} diff --git a/examples/integrations/cdi/datasource-hikaricp/src/main/java/io/helidon/integrations/examples/datasource/hikaricp/jaxrs/package-info.java b/examples/integrations/cdi/datasource-hikaricp/src/main/java/io/helidon/integrations/examples/datasource/hikaricp/jaxrs/package-info.java deleted file mode 100644 index 2b4f85b6e0f..00000000000 --- a/examples/integrations/cdi/datasource-hikaricp/src/main/java/io/helidon/integrations/examples/datasource/hikaricp/jaxrs/package-info.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2018, 2021 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Provides JAX-RS-related classes and interfaces for this example - * project. - */ -package io.helidon.integrations.examples.datasource.hikaricp.jaxrs; diff --git a/examples/integrations/cdi/jedis/pom.xml b/examples/integrations/cdi/jedis/pom.xml index 02fb490a043..23f8f2608b2 100644 --- a/examples/integrations/cdi/jedis/pom.xml +++ b/examples/integrations/cdi/jedis/pom.xml @@ -14,7 +14,7 @@ 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. - + --> io.helidon.examples.integrations.cdi helidon-examples-integrations-cdi-jedis - Helidon CDI Extensions Examples Jedis + Helidon Examples CDI Extensions Jedis diff --git a/examples/integrations/cdi/jedis/src/main/java/io/helidon/integrations/examples/jedis/jaxrs/RedisClientResource.java b/examples/integrations/cdi/jedis/src/main/java/io/helidon/examples/integrations/jedis/jaxrs/RedisClientResource.java similarity index 97% rename from examples/integrations/cdi/jedis/src/main/java/io/helidon/integrations/examples/jedis/jaxrs/RedisClientResource.java rename to examples/integrations/cdi/jedis/src/main/java/io/helidon/examples/integrations/jedis/jaxrs/RedisClientResource.java index 49d2143bf42..13c40b8ea39 100644 --- a/examples/integrations/cdi/jedis/src/main/java/io/helidon/integrations/examples/jedis/jaxrs/RedisClientResource.java +++ b/examples/integrations/cdi/jedis/src/main/java/io/helidon/examples/integrations/jedis/jaxrs/RedisClientResource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021 Oracle and/or its affiliates. + * Copyright (c) 2018, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.integrations.examples.jedis.jaxrs; +package io.helidon.examples.integrations.jedis.jaxrs; import java.util.Objects; diff --git a/examples/integrations/cdi/jedis/src/main/java/io/helidon/examples/integrations/jedis/jaxrs/package-info.java b/examples/integrations/cdi/jedis/src/main/java/io/helidon/examples/integrations/jedis/jaxrs/package-info.java new file mode 100644 index 00000000000..32df6b57c72 --- /dev/null +++ b/examples/integrations/cdi/jedis/src/main/java/io/helidon/examples/integrations/jedis/jaxrs/package-info.java @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2018, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Provides JAX-RS-related classes and interfaces for this example + * project. + */ +package io.helidon.examples.integrations.jedis.jaxrs; diff --git a/examples/integrations/cdi/jedis/src/main/java/io/helidon/integrations/examples/jedis/jaxrs/package-info.java b/examples/integrations/cdi/jedis/src/main/java/io/helidon/integrations/examples/jedis/jaxrs/package-info.java deleted file mode 100644 index 526557b043a..00000000000 --- a/examples/integrations/cdi/jedis/src/main/java/io/helidon/integrations/examples/jedis/jaxrs/package-info.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2018, 2021 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Provides JAX-RS-related classes and interfaces for this example - * project. - */ -package io.helidon.integrations.examples.jedis.jaxrs; diff --git a/examples/integrations/cdi/jpa/pom.xml b/examples/integrations/cdi/jpa/pom.xml index 359982a67ee..2dbb0339239 100644 --- a/examples/integrations/cdi/jpa/pom.xml +++ b/examples/integrations/cdi/jpa/pom.xml @@ -29,7 +29,7 @@ io.helidon.examples.integrations.cdi helidon-integrations-examples-jpa - Helidon CDI Extensions Examples JPA + Helidon Examples CDI Extensions JPA diff --git a/examples/integrations/cdi/pokemons/pom.xml b/examples/integrations/cdi/pokemons/pom.xml index ecae02349fe..a31ab00aea6 100644 --- a/examples/integrations/cdi/pokemons/pom.xml +++ b/examples/integrations/cdi/pokemons/pom.xml @@ -29,7 +29,7 @@ io.helidon.examples.integrations.cdi helidon-integrations-examples-pokemons - Helidon CDI Extensions Examples Pokemons JPA + Helidon Examples CDI Extensions Pokemons JPA diff --git a/examples/integrations/cdi/pom.xml b/examples/integrations/cdi/pom.xml index f36747ee181..7199bb78890 100644 --- a/examples/integrations/cdi/pom.xml +++ b/examples/integrations/cdi/pom.xml @@ -29,7 +29,7 @@ io.helidon.examples.integrations.cdi helidon-examples-integrations-cdi-project pom - Helidon CDI Extensions Examples + Helidon Examples CDI Extensions datasource-hikaricp diff --git a/examples/integrations/micrometer/mp/pom.xml b/examples/integrations/micrometer/mp/pom.xml index 3f5694dab9d..19a4ddab24b 100644 --- a/examples/integrations/micrometer/mp/pom.xml +++ b/examples/integrations/micrometer/mp/pom.xml @@ -27,7 +27,7 @@ 4.0.0 - Helidon MP Examples Micrometer + Helidon Examples Integration Micrometer MP Basic illustration of Micrometer integration in Helidon MP @@ -65,8 +65,8 @@ test
- io.helidon.nima.webclient - helidon-nima-webclient + io.helidon.webclient + helidon-webclient test
diff --git a/examples/integrations/micrometer/mp/src/main/resources/logging.properties b/examples/integrations/micrometer/mp/src/main/resources/logging.properties index a1a217d795d..ac4c451f1be 100644 --- a/examples/integrations/micrometer/mp/src/main/resources/logging.properties +++ b/examples/integrations/micrometer/mp/src/main/resources/logging.properties @@ -27,7 +27,7 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ .level=INFO # Component specific log levels -#io.helidon.nima.webserver.level=INFO +#io.helidon.webserver.level=INFO #io.helidon.config.level=INFO #io.helidon.security.level=INFO #io.helidon.microprofile.level=INFO diff --git a/examples/integrations/micrometer/pom.xml b/examples/integrations/micrometer/pom.xml index bed7a37ed19..634809db534 100644 --- a/examples/integrations/micrometer/pom.xml +++ b/examples/integrations/micrometer/pom.xml @@ -26,7 +26,7 @@ helidon-examples-micrometer-project - Helidon Micrometer Examples + Helidon Examples Integration Micrometer pom diff --git a/examples/integrations/micrometer/se/pom.xml b/examples/integrations/micrometer/se/pom.xml index 3652e31c070..1de664153f4 100644 --- a/examples/integrations/micrometer/se/pom.xml +++ b/examples/integrations/micrometer/se/pom.xml @@ -29,14 +29,14 @@ io.helidon.examples.integrations.micrometer-project helidon-examples-integrations-micrometer-se - Helidon SE Examples Micrometer + Helidon Examples Integration Micrometer SE Basic illustration of Micrometer integration in Helidon SE - io.helidon.examples.micrometer.se.Main + io.helidon.examples.integrations.micrometer.se.Main @@ -55,29 +55,29 @@ - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver io.helidon.config helidon-config-yaml - io.helidon.nima.http.media - helidon-nima-http-media-jsonp + io.helidon.http.media + helidon-http-media-jsonp io.helidon.integrations.micrometer helidon-integrations-micrometer - io.helidon.nima.webclient - helidon-nima-webclient + io.helidon.webclient + helidon-webclient test - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test diff --git a/examples/integrations/micrometer/se/src/main/java/io/helidon/examples/integrations/micrometer/se/GreetService.java b/examples/integrations/micrometer/se/src/main/java/io/helidon/examples/integrations/micrometer/se/GreetService.java new file mode 100644 index 00000000000..4317bf1f7b4 --- /dev/null +++ b/examples/integrations/micrometer/se/src/main/java/io/helidon/examples/integrations/micrometer/se/GreetService.java @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2021, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.examples.integrations.micrometer.se; + +import java.util.Collections; + +import io.helidon.config.Config; +import io.helidon.http.Http; +import io.helidon.webserver.http.HttpRequest; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; + +import io.micrometer.core.instrument.Counter; +import io.micrometer.core.instrument.Timer; +import jakarta.json.Json; +import jakarta.json.JsonBuilderFactory; +import jakarta.json.JsonObject; + +/** + * A simple service to greet you. + *

+ * Examples: + *

{@code
+ * Get default greeting message:
+ * curl -X GET http://localhost:8080/greet
+ *
+ * Get greeting message for Joe:
+ * curl -X GET http://localhost:8080/greet/Joe
+ *
+ * Change greeting
+ * curl -X PUT -H "Content-Type: application/json" -d '{"greeting" : "Howdy"}' http://localhost:8080/greet/greeting
+ *
+ * }
+ * The greeting message is returned as a JSON object. + * + *

+ */ + +public class GreetService implements HttpService { + + /** + * The config value for the key {@code greeting}. + */ + private String greeting; + + private final Timer getTimer; + private final Counter personalizedGetCounter; + + private static final JsonBuilderFactory JSON_BF = Json.createBuilderFactory(Collections.emptyMap()); + + GreetService(Config config, Timer getTimer, Counter personalizedGetCounter) { + this.greeting = config.get("app.greeting").asString().orElse("Ciao"); + this.getTimer = getTimer; + this.personalizedGetCounter = personalizedGetCounter; + } + + /** + * A service registers itself by updating the routine rules. + * @param rules the routing rules. + */ + @Override + public void routing(HttpRules rules) { + rules + .get((req, resp) -> getTimer.record(resp::next)) // Update the timer with every GET. + .get("/", this::getDefaultMessageHandler) + .get("/{name}", + (req, resp) -> { + personalizedGetCounter.increment(); + resp.next(); + }, // Count personalized GETs... + this::getMessageHandler) // ...and process them. + .put("/greeting", this::updateGreetingHandler); + } + + /** + * Return a worldly greeting message. + * @param request the server request + * @param response the server response + */ + private void getDefaultMessageHandler(HttpRequest request, + ServerResponse response) { + sendResponse(response, "World"); + } + + /** + * Return a greeting message using the name that was provided. + * @param request the server request + * @param response the server response + */ + private void getMessageHandler(ServerRequest request, + ServerResponse response) { + String name = request.path().pathParameters().first("name").get(); + sendResponse(response, name); + } + + private void sendResponse(ServerResponse response, String name) { + GreetingMessage msg = new GreetingMessage(String.format("%s %s!", greeting, name)); + response.send(msg.forRest()); + } + + private void updateGreetingFromJson(JsonObject jo, ServerResponse response) { + + if (!jo.containsKey(GreetingMessage.JSON_LABEL)) { + JsonObject jsonErrorObject = JSON_BF.createObjectBuilder() + .add("error", "No greeting provided") + .build(); + response.status(Http.Status.BAD_REQUEST_400) + .send(jsonErrorObject); + return; + } + + greeting = GreetingMessage.fromRest(jo).getMessage(); + response.status(Http.Status.NO_CONTENT_204).send(); + } + + /** + * Set the greeting to use in future messages. + * @param request the server request + * @param response the server response + */ + private void updateGreetingHandler(ServerRequest request, + ServerResponse response) { + JsonObject obj = request.content().as(JsonObject.class); + updateGreetingFromJson(obj, response); + } +} diff --git a/examples/integrations/micrometer/se/src/main/java/io/helidon/examples/micrometer/se/GreetingMessage.java b/examples/integrations/micrometer/se/src/main/java/io/helidon/examples/integrations/micrometer/se/GreetingMessage.java similarity index 95% rename from examples/integrations/micrometer/se/src/main/java/io/helidon/examples/micrometer/se/GreetingMessage.java rename to examples/integrations/micrometer/se/src/main/java/io/helidon/examples/integrations/micrometer/se/GreetingMessage.java index 055a06774be..f7a71f8203f 100644 --- a/examples/integrations/micrometer/se/src/main/java/io/helidon/examples/micrometer/se/GreetingMessage.java +++ b/examples/integrations/micrometer/se/src/main/java/io/helidon/examples/integrations/micrometer/se/GreetingMessage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. + * Copyright (c) 2021, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.examples.micrometer.se; +package io.helidon.examples.integrations.micrometer.se; import java.util.Collections; diff --git a/examples/integrations/micrometer/se/src/main/java/io/helidon/examples/integrations/micrometer/se/Main.java b/examples/integrations/micrometer/se/src/main/java/io/helidon/examples/integrations/micrometer/se/Main.java new file mode 100644 index 00000000000..f605cda5e94 --- /dev/null +++ b/examples/integrations/micrometer/se/src/main/java/io/helidon/examples/integrations/micrometer/se/Main.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2021, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.examples.integrations.micrometer.se; + +import io.helidon.config.Config; +import io.helidon.integrations.micrometer.MicrometerFeature; +import io.helidon.logging.common.LogConfig; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.HttpRouting; + +import io.micrometer.core.instrument.Counter; +import io.micrometer.core.instrument.Timer; + +/** + * Simple Hello World rest application. + */ +public final class Main { + + static final String PERSONALIZED_GETS_COUNTER_NAME = "personalizedGets"; + static final String ALL_GETS_TIMER_NAME = "allGets"; + + /** + * Cannot be instantiated. + */ + private Main() { + } + + /** + * Application main entry point. + * + * @param args command line arguments. + */ + public static void main(final String[] args) { + startServer(); + } + + /** + * Start the server. + */ + static WebServer startServer() { + + // load logging configuration + LogConfig.configureRuntime(); + + // By default, this will pick up application.yaml from the classpath + Config config = Config.create(); + + WebServer server = WebServer.builder() + .config(config.get("server")) + .routing(r -> setupRouting(r, config)) + .build() + .start(); + + System.out.println("WEB server is up! http://localhost:" + server.port() + "/greet"); + return server; + } + + /** + * Setup routing. + * + * @param routing routing builder + * @param config config + */ + static void setupRouting(HttpRouting.Builder routing, Config config) { + MicrometerFeature micrometerSupport = MicrometerFeature.create(config); + Counter personalizedGetCounter = micrometerSupport.registry() + .counter(PERSONALIZED_GETS_COUNTER_NAME); + Timer getTimer = Timer.builder(ALL_GETS_TIMER_NAME) + .publishPercentileHistogram() + .register(micrometerSupport.registry()); + + GreetService greetService = new GreetService(config, getTimer, personalizedGetCounter); + + routing.register("/greet", greetService) + .addFeature(micrometerSupport); + } +} diff --git a/examples/integrations/micrometer/se/src/main/java/io/helidon/examples/integrations/micrometer/se/package-info.java b/examples/integrations/micrometer/se/src/main/java/io/helidon/examples/integrations/micrometer/se/package-info.java new file mode 100644 index 00000000000..26aaa61b34c --- /dev/null +++ b/examples/integrations/micrometer/se/src/main/java/io/helidon/examples/integrations/micrometer/se/package-info.java @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2021, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Example application showing Micrometer support in Helidon SE + *

+ * Start with {@link io.helidon.examples.integrations.micrometer.se.Main} class. + * + * @see io.helidon.examples.integrations.micrometer.se.Main + */ +package io.helidon.examples.integrations.micrometer.se; diff --git a/examples/integrations/micrometer/se/src/main/java/io/helidon/examples/micrometer/se/GreetService.java b/examples/integrations/micrometer/se/src/main/java/io/helidon/examples/micrometer/se/GreetService.java deleted file mode 100644 index 6701b9bf84c..00000000000 --- a/examples/integrations/micrometer/se/src/main/java/io/helidon/examples/micrometer/se/GreetService.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2021, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.examples.micrometer.se; - -import java.util.Collections; - -import io.helidon.common.http.Http; -import io.helidon.config.Config; -import io.helidon.nima.webserver.http.HttpRequest; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; - -import io.micrometer.core.instrument.Counter; -import io.micrometer.core.instrument.Timer; -import jakarta.json.Json; -import jakarta.json.JsonBuilderFactory; -import jakarta.json.JsonObject; - -/** - * A simple service to greet you. - *

- * Examples: - *

{@code
- * Get default greeting message:
- * curl -X GET http://localhost:8080/greet
- *
- * Get greeting message for Joe:
- * curl -X GET http://localhost:8080/greet/Joe
- *
- * Change greeting
- * curl -X PUT -H "Content-Type: application/json" -d '{"greeting" : "Howdy"}' http://localhost:8080/greet/greeting
- *
- * }
- * The greeting message is returned as a JSON object. - * - *

- */ - -public class GreetService implements HttpService { - - /** - * The config value for the key {@code greeting}. - */ - private String greeting; - - private final Timer getTimer; - private final Counter personalizedGetCounter; - - private static final JsonBuilderFactory JSON_BF = Json.createBuilderFactory(Collections.emptyMap()); - - GreetService(Config config, Timer getTimer, Counter personalizedGetCounter) { - this.greeting = config.get("app.greeting").asString().orElse("Ciao"); - this.getTimer = getTimer; - this.personalizedGetCounter = personalizedGetCounter; - } - - /** - * A service registers itself by updating the routine rules. - * @param rules the routing rules. - */ - @Override - public void routing(HttpRules rules) { - rules - .get((req, resp) -> getTimer.record(resp::next)) // Update the timer with every GET. - .get("/", this::getDefaultMessageHandler) - .get("/{name}", - (req, resp) -> { - personalizedGetCounter.increment(); - resp.next(); - }, // Count personalized GETs... - this::getMessageHandler) // ...and process them. - .put("/greeting", this::updateGreetingHandler); - } - - /** - * Return a worldly greeting message. - * @param request the server request - * @param response the server response - */ - private void getDefaultMessageHandler(HttpRequest request, - ServerResponse response) { - sendResponse(response, "World"); - } - - /** - * Return a greeting message using the name that was provided. - * @param request the server request - * @param response the server response - */ - private void getMessageHandler(ServerRequest request, - ServerResponse response) { - String name = request.path().pathParameters().first("name").get(); - sendResponse(response, name); - } - - private void sendResponse(ServerResponse response, String name) { - GreetingMessage msg = new GreetingMessage(String.format("%s %s!", greeting, name)); - response.send(msg.forRest()); - } - - private void updateGreetingFromJson(JsonObject jo, ServerResponse response) { - - if (!jo.containsKey(GreetingMessage.JSON_LABEL)) { - JsonObject jsonErrorObject = JSON_BF.createObjectBuilder() - .add("error", "No greeting provided") - .build(); - response.status(Http.Status.BAD_REQUEST_400) - .send(jsonErrorObject); - return; - } - - greeting = GreetingMessage.fromRest(jo).getMessage(); - response.status(Http.Status.NO_CONTENT_204).send(); - } - - /** - * Set the greeting to use in future messages. - * @param request the server request - * @param response the server response - */ - private void updateGreetingHandler(ServerRequest request, - ServerResponse response) { - JsonObject obj = request.content().as(JsonObject.class); - updateGreetingFromJson(obj, response); - } -} diff --git a/examples/integrations/micrometer/se/src/main/java/io/helidon/examples/micrometer/se/Main.java b/examples/integrations/micrometer/se/src/main/java/io/helidon/examples/micrometer/se/Main.java deleted file mode 100644 index 0fb3d65fb0b..00000000000 --- a/examples/integrations/micrometer/se/src/main/java/io/helidon/examples/micrometer/se/Main.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2021, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.examples.micrometer.se; - -import io.helidon.config.Config; -import io.helidon.integrations.micrometer.MicrometerFeature; -import io.helidon.logging.common.LogConfig; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRouting; - -import io.micrometer.core.instrument.Counter; -import io.micrometer.core.instrument.Timer; - -/** - * Simple Hello World rest application. - */ -public final class Main { - - static final String PERSONALIZED_GETS_COUNTER_NAME = "personalizedGets"; - static final String ALL_GETS_TIMER_NAME = "allGets"; - - /** - * Cannot be instantiated. - */ - private Main() { - } - - /** - * Application main entry point. - * - * @param args command line arguments. - */ - public static void main(final String[] args) { - startServer(); - } - - /** - * Start the server. - */ - static WebServer startServer() { - - // load logging configuration - LogConfig.configureRuntime(); - - // By default, this will pick up application.yaml from the classpath - Config config = Config.create(); - - WebServer server = WebServer.builder() - .config(config.get("server")) - .routing(r -> setupRouting(r, config)) - .build() - .start(); - - System.out.println("WEB server is up! http://localhost:" + server.port() + "/greet"); - return server; - } - - /** - * Setup routing. - * - * @param routing routing builder - * @param config config - */ - static void setupRouting(HttpRouting.Builder routing, Config config) { - MicrometerFeature micrometerSupport = MicrometerFeature.create(config); - Counter personalizedGetCounter = micrometerSupport.registry() - .counter(PERSONALIZED_GETS_COUNTER_NAME); - Timer getTimer = Timer.builder(ALL_GETS_TIMER_NAME) - .publishPercentileHistogram() - .register(micrometerSupport.registry()); - - GreetService greetService = new GreetService(config, getTimer, personalizedGetCounter); - - routing.register("/greet", greetService) - .addFeature(micrometerSupport); - } -} diff --git a/examples/integrations/micrometer/se/src/main/java/io/helidon/examples/micrometer/se/package-info.java b/examples/integrations/micrometer/se/src/main/java/io/helidon/examples/micrometer/se/package-info.java deleted file mode 100644 index eb46268faa5..00000000000 --- a/examples/integrations/micrometer/se/src/main/java/io/helidon/examples/micrometer/se/package-info.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2021 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Example application showing Micrometer support in Helidon SE - *

- * Start with {@link io.helidon.examples.micrometer.se.Main} class. - * - * @see io.helidon.examples.micrometer.se.Main - */ -package io.helidon.examples.micrometer.se; diff --git a/examples/integrations/micrometer/se/src/test/java/io/helidon/examples/integrations/micrometer/se/MainTest.java b/examples/integrations/micrometer/se/src/test/java/io/helidon/examples/integrations/micrometer/se/MainTest.java new file mode 100644 index 00000000000..baaef19aaa7 --- /dev/null +++ b/examples/integrations/micrometer/se/src/test/java/io/helidon/examples/integrations/micrometer/se/MainTest.java @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2021, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.helidon.examples.integrations.micrometer.se; + +import java.util.Collections; + +import io.helidon.http.Http; +import io.helidon.config.Config; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.WebServerConfig.Builder; + +import jakarta.json.Json; +import jakarta.json.JsonBuilderFactory; +import jakarta.json.JsonObject; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.MethodOrderer; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestMethodOrder; + +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +// we need to first call the methods, before validating metrics +@TestMethodOrder(MethodOrderer.OrderAnnotation.class) +@ServerTest +public class MainTest { + + private static final JsonBuilderFactory JSON_BF = Json.createBuilderFactory(Collections.emptyMap()); + private static final JsonObject TEST_JSON_OBJECT; + + private static double expectedPersonalizedGets; + private static double expectedAllGets; + private final Http1Client client; + + static { + TEST_JSON_OBJECT = JSON_BF.createObjectBuilder() + .add("greeting", "Hola") + .build(); + } + + public MainTest(Http1Client client) { + this.client = client; + } + + @SetUpServer + public static void setup(Builder builder) { + builder.routing(r -> Main.setupRouting(r, Config.create())); + } + + @Test + @Order(1) + void testDefaultGreeting() { + JsonObject jsonObject = get(); + assertThat(jsonObject.getString("greeting"), is("Hello World!")); + } + + @Test + @Order(2) + void testNamedGreeting() { + JsonObject jsonObject = personalizedGet("Joe"); + Assertions.assertEquals("Hello Joe!", jsonObject.getString("greeting")); + } + + @Test + @Order(3) + void testUpdateGreeting() { + try (Http1ClientResponse response = client.put() + .path("/greet/greeting") + .submit(TEST_JSON_OBJECT)) { + + assertThat(response.status(), is(Http.Status.NO_CONTENT_204)); + } + + JsonObject jsonObject = personalizedGet("Joe"); + assertThat(jsonObject.getString("greeting"), is("Hola Joe!")); + } + + @Test + @Order(4) + void testMicrometer() { + Http1ClientResponse response = client.get() + .path("/micrometer") + .request(); + + assertThat(response.status().code(), is(200)); + + String output = response.as(String.class); + String expected = Main.ALL_GETS_TIMER_NAME + "_seconds_count " + expectedAllGets; + assertThat("Unable to find expected all-gets timer count " + expected + "; output is " + output, + output, containsString(expected)); // all gets; the put + // is not counted + assertThat("Unable to find expected all-gets timer sum", output, + containsString(Main.ALL_GETS_TIMER_NAME + "_seconds_sum")); + expected = Main.PERSONALIZED_GETS_COUNTER_NAME + "_total " + expectedPersonalizedGets; + assertThat("Unable to find expected counter result " + expected + "; output is " + output, + output, containsString(expected)); + response.close(); + } + + private JsonObject get() { + return get("/greet"); + } + + private JsonObject get(String path) { + JsonObject jsonObject = client.get() + .path(path) + .requestEntity(JsonObject.class); + expectedAllGets++; + return jsonObject; + } + + private JsonObject personalizedGet(String name) { + JsonObject result = get("/greet/" + name); + expectedPersonalizedGets++; + return result; + } +} diff --git a/examples/integrations/micrometer/se/src/test/java/io/helidon/examples/micrometer/se/MainTest.java b/examples/integrations/micrometer/se/src/test/java/io/helidon/examples/micrometer/se/MainTest.java deleted file mode 100644 index 88ba04edd8c..00000000000 --- a/examples/integrations/micrometer/se/src/test/java/io/helidon/examples/micrometer/se/MainTest.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2021, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.helidon.examples.micrometer.se; - -import java.util.Collections; - -import io.helidon.common.http.Http; -import io.helidon.config.Config; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.WebServerConfig.Builder; - -import jakarta.json.Json; -import jakarta.json.JsonBuilderFactory; -import jakarta.json.JsonObject; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.MethodOrderer; -import org.junit.jupiter.api.Order; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.TestMethodOrder; - -import static org.hamcrest.CoreMatchers.containsString; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; - -// we need to first call the methods, before validating metrics -@TestMethodOrder(MethodOrderer.OrderAnnotation.class) -@ServerTest -public class MainTest { - - private static final JsonBuilderFactory JSON_BF = Json.createBuilderFactory(Collections.emptyMap()); - private static final JsonObject TEST_JSON_OBJECT; - - private static double expectedPersonalizedGets; - private static double expectedAllGets; - private final Http1Client client; - - static { - TEST_JSON_OBJECT = JSON_BF.createObjectBuilder() - .add("greeting", "Hola") - .build(); - } - - public MainTest(Http1Client client) { - this.client = client; - } - - @SetUpServer - public static void setup(Builder builder) { - builder.routing(r -> Main.setupRouting(r, Config.create())); - } - - @Test - @Order(1) - void testDefaultGreeting() { - JsonObject jsonObject = get(); - assertThat(jsonObject.getString("greeting"), is("Hello World!")); - } - - @Test - @Order(2) - void testNamedGreeting() { - JsonObject jsonObject = personalizedGet("Joe"); - Assertions.assertEquals("Hello Joe!", jsonObject.getString("greeting")); - } - - @Test - @Order(3) - void testUpdateGreeting() { - try (Http1ClientResponse response = client.put() - .path("/greet/greeting") - .submit(TEST_JSON_OBJECT)) { - - assertThat(response.status(), is(Http.Status.NO_CONTENT_204)); - } - - JsonObject jsonObject = personalizedGet("Joe"); - assertThat(jsonObject.getString("greeting"), is("Hola Joe!")); - } - - @Test - @Order(4) - void testMicrometer() { - Http1ClientResponse response = client.get() - .path("/micrometer") - .request(); - - assertThat(response.status().code(), is(200)); - - String output = response.as(String.class); - String expected = Main.ALL_GETS_TIMER_NAME + "_seconds_count " + expectedAllGets; - assertThat("Unable to find expected all-gets timer count " + expected + "; output is " + output, - output, containsString(expected)); // all gets; the put - // is not counted - assertThat("Unable to find expected all-gets timer sum", output, - containsString(Main.ALL_GETS_TIMER_NAME + "_seconds_sum")); - expected = Main.PERSONALIZED_GETS_COUNTER_NAME + "_total " + expectedPersonalizedGets; - assertThat("Unable to find expected counter result " + expected + "; output is " + output, - output, containsString(expected)); - response.close(); - } - - private JsonObject get() { - return get("/greet"); - } - - private JsonObject get(String path) { - JsonObject jsonObject = client.get() - .path(path) - .requestEntity(JsonObject.class); - expectedAllGets++; - return jsonObject; - } - - private JsonObject personalizedGet(String name) { - JsonObject result = get("/greet/" + name); - expectedPersonalizedGets++; - return result; - } -} diff --git a/examples/integrations/micronaut/data/pom.xml b/examples/integrations/micronaut/data/pom.xml index d53c303aafd..3c3dca008bd 100644 --- a/examples/integrations/micronaut/data/pom.xml +++ b/examples/integrations/micronaut/data/pom.xml @@ -28,7 +28,7 @@ ../../../../applications/mp/pom.xml helidon-examples-integrations-micronaut-data - Helidon Example Integration Micronaut Data + Helidon Examples Integration Micronaut Data diff --git a/examples/integrations/micronaut/pom.xml b/examples/integrations/micronaut/pom.xml index 07049c16f69..fa033131e44 100644 --- a/examples/integrations/micronaut/pom.xml +++ b/examples/integrations/micronaut/pom.xml @@ -29,7 +29,7 @@ io.helidon.examples.integrations.micronaut helidon-examples-integrations-micronaut-project pom - Helidon Micronaut Integration Examples + Helidon Examples Integration Micronaut data diff --git a/examples/integrations/microstream/greetings-mp/pom.xml b/examples/integrations/microstream/greetings-mp/pom.xml index 320cfd01226..ca72b8b7368 100644 --- a/examples/integrations/microstream/greetings-mp/pom.xml +++ b/examples/integrations/microstream/greetings-mp/pom.xml @@ -28,7 +28,7 @@ helidon-examples-integrations-microstream-greetings-mp - Helidon Microstream Integration Example Greetings mp + Helidon Examples Integration Microstream Greetings mp diff --git a/examples/integrations/microstream/greetings-se/pom.xml b/examples/integrations/microstream/greetings-se/pom.xml index 1aea4c520b4..a39c9a63946 100644 --- a/examples/integrations/microstream/greetings-se/pom.xml +++ b/examples/integrations/microstream/greetings-se/pom.xml @@ -28,7 +28,7 @@ helidon-examples-integrations-microstream-greetings-se - Helidon Microstream Integration Example Greetings se + Helidon Examples Integration Microstream Greetings se io.helidon.examples.integrations.microstream.greetings.se.Main @@ -36,20 +36,20 @@ - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver io.helidon.integrations.microstream helidon-integrations-microstream - io.helidon.nima.observe - helidon-nima-observe + io.helidon.webserver.observe + helidon-webserver-observe - io.helidon.nima.http.media - helidon-nima-http-media-jsonp + io.helidon.http.media + helidon-http-media-jsonp io.helidon.config @@ -64,8 +64,8 @@ helidon-metrics - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test diff --git a/examples/integrations/microstream/greetings-se/src/main/java/io/helidon/examples/integrations/microstream/greetings/se/GreetingService.java b/examples/integrations/microstream/greetings-se/src/main/java/io/helidon/examples/integrations/microstream/greetings/se/GreetingService.java index f0a0929ffac..fa549fe6af8 100644 --- a/examples/integrations/microstream/greetings-se/src/main/java/io/helidon/examples/integrations/microstream/greetings/se/GreetingService.java +++ b/examples/integrations/microstream/greetings-se/src/main/java/io/helidon/examples/integrations/microstream/greetings/se/GreetingService.java @@ -20,13 +20,13 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.logging.Logger; -import io.helidon.common.http.Http; import io.helidon.config.Config; +import io.helidon.http.Http; import io.helidon.integrations.microstream.core.EmbeddedStorageManagerBuilder; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import jakarta.json.Json; import jakarta.json.JsonArrayBuilder; diff --git a/examples/integrations/microstream/greetings-se/src/main/java/io/helidon/examples/integrations/microstream/greetings/se/Main.java b/examples/integrations/microstream/greetings-se/src/main/java/io/helidon/examples/integrations/microstream/greetings/se/Main.java index 56fb4bc8ec8..a7f0300a249 100644 --- a/examples/integrations/microstream/greetings-se/src/main/java/io/helidon/examples/integrations/microstream/greetings/se/Main.java +++ b/examples/integrations/microstream/greetings-se/src/main/java/io/helidon/examples/integrations/microstream/greetings/se/Main.java @@ -19,10 +19,10 @@ import io.helidon.config.ClasspathConfigSource; import io.helidon.config.Config; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.observe.ObserveFeature; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.observe.ObserveFeature; /** * Microstream demo with a simple rest application. diff --git a/examples/integrations/microstream/greetings-se/src/test/java/io/helidon/examples/integrations/microstream/greetings/se/MicrostreamExampleGreetingsSeTest.java b/examples/integrations/microstream/greetings-se/src/test/java/io/helidon/examples/integrations/microstream/greetings/se/MicrostreamExampleGreetingsSeTest.java index b8671ca6604..4c080135bc1 100644 --- a/examples/integrations/microstream/greetings-se/src/test/java/io/helidon/examples/integrations/microstream/greetings/se/MicrostreamExampleGreetingsSeTest.java +++ b/examples/integrations/microstream/greetings-se/src/test/java/io/helidon/examples/integrations/microstream/greetings/se/MicrostreamExampleGreetingsSeTest.java @@ -18,11 +18,11 @@ import java.nio.file.Path; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.WebServerConfig; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.WebServerConfig; import jakarta.json.JsonArray; import jakarta.json.JsonObject; diff --git a/examples/integrations/microstream/pom.xml b/examples/integrations/microstream/pom.xml index 3f4e453766e..7f4a45c971f 100644 --- a/examples/integrations/microstream/pom.xml +++ b/examples/integrations/microstream/pom.xml @@ -28,7 +28,7 @@ io.helidon.examples.integrations.microstream helidon-examples-integrations-microstream-project - Helidon Microstream Integration Examples + Helidon Examples Integration Microstreams pom diff --git a/examples/integrations/neo4j/pom.xml b/examples/integrations/neo4j/pom.xml index 3a3c60fef69..40d20723ebc 100644 --- a/examples/integrations/neo4j/pom.xml +++ b/examples/integrations/neo4j/pom.xml @@ -23,12 +23,12 @@ 4.0.0 io.helidon.applications - helidon-nima + helidon-se 4.0.0-SNAPSHOT - ../../../applications/nima/pom.xml + ../../../applications/se/pom.xml helidon-examples-integration-neo4j - Helidon Integrations Neo4j Example + Helidon Examples Integrations Neo4j io.helidon.examples.integrations.neo4j.Main @@ -37,36 +37,36 @@ - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver io.helidon.health helidon-health-checks - io.helidon.nima.http.media - helidon-nima-http-media-jsonp + io.helidon.http.media + helidon-http-media-jsonp - io.helidon.nima.http.media - helidon-nima-http-media-jsonb + io.helidon.http.media + helidon-http-media-jsonb io.helidon.config helidon-config-yaml - io.helidon.nima.observe - helidon-nima-observe + io.helidon.webserver.observe + helidon-webserver-observe - io.helidon.nima.observe - helidon-nima-observe-health + io.helidon.webserver.observe + helidon-webserver-observe-health - io.helidon.nima.observe - helidon-nima-observe-metrics + io.helidon.webserver.observe + helidon-webserver-observe-metrics io.helidon.metrics @@ -85,8 +85,8 @@ helidon-integrations-neo4j-metrics - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test diff --git a/examples/integrations/neo4j/src/main/java/io/helidon/examples/integrations/neo4j/Main.java b/examples/integrations/neo4j/src/main/java/io/helidon/examples/integrations/neo4j/Main.java index eeab73a859b..d9f78a8529f 100644 --- a/examples/integrations/neo4j/src/main/java/io/helidon/examples/integrations/neo4j/Main.java +++ b/examples/integrations/neo4j/src/main/java/io/helidon/examples/integrations/neo4j/Main.java @@ -25,14 +25,14 @@ import io.helidon.integrations.neo4j.health.Neo4jHealthCheck; import io.helidon.integrations.neo4j.metrics.Neo4jMetricsSupport; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.observe.ObserveFeature; -import io.helidon.nima.observe.health.HealthFeature; -import io.helidon.nima.observe.health.HealthObserveProvider; -import io.helidon.nima.webserver.WebServer; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.observe.ObserveFeature; +import io.helidon.webserver.observe.health.HealthFeature; +import io.helidon.webserver.observe.health.HealthObserveProvider; import org.neo4j.driver.Driver; -import static io.helidon.nima.webserver.http.HttpRouting.Builder; +import static io.helidon.webserver.http.HttpRouting.Builder; /** * The application main class. diff --git a/examples/integrations/neo4j/src/main/java/io/helidon/examples/integrations/neo4j/MovieService.java b/examples/integrations/neo4j/src/main/java/io/helidon/examples/integrations/neo4j/MovieService.java index 5c8a87611dd..b73879cdc67 100644 --- a/examples/integrations/neo4j/src/main/java/io/helidon/examples/integrations/neo4j/MovieService.java +++ b/examples/integrations/neo4j/src/main/java/io/helidon/examples/integrations/neo4j/MovieService.java @@ -17,10 +17,10 @@ package io.helidon.examples.integrations.neo4j; import io.helidon.examples.integrations.neo4j.domain.MovieRepository; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; /** * The Movie service. diff --git a/examples/integrations/neo4j/src/main/resources/logging.properties b/examples/integrations/neo4j/src/main/resources/logging.properties index 164c69e8d0b..41ffb45a3be 100644 --- a/examples/integrations/neo4j/src/main/resources/logging.properties +++ b/examples/integrations/neo4j/src/main/resources/logging.properties @@ -27,7 +27,7 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ .level=INFO # Component specific log levels -#io.helidon.nima.webserver.level=INFO +#io.helidon.webserver.level=INFO #io.helidon.config.level=INFO #io.helidon.security.level=INFO #io.helidon.common.level=INFO diff --git a/examples/integrations/neo4j/src/test/java/io/helidon/examples/integrations/neo4j/MainTest.java b/examples/integrations/neo4j/src/test/java/io/helidon/examples/integrations/neo4j/MainTest.java index 6a472d31081..2365576926b 100644 --- a/examples/integrations/neo4j/src/test/java/io/helidon/examples/integrations/neo4j/MainTest.java +++ b/examples/integrations/neo4j/src/test/java/io/helidon/examples/integrations/neo4j/MainTest.java @@ -16,12 +16,12 @@ package io.helidon.examples.integrations.neo4j; -import io.helidon.common.http.Http; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.http.Http; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.http.HttpRouting; import jakarta.json.JsonArray; import org.junit.jupiter.api.AfterAll; @@ -35,7 +35,7 @@ import static org.hamcrest.MatcherAssert.assertThat; /** - * Main test class for Neo4j Helidon Nima app. + * Main test class for Neo4j Helidon SE application. */ @ServerTest public class MainTest { diff --git a/examples/integrations/oci/atp-cdi/src/main/resources/logging.properties b/examples/integrations/oci/atp-cdi/src/main/resources/logging.properties index 80f8dd3f380..b4eb284e666 100644 --- a/examples/integrations/oci/atp-cdi/src/main/resources/logging.properties +++ b/examples/integrations/oci/atp-cdi/src/main/resources/logging.properties @@ -25,4 +25,4 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ io.helidon.level=INFO io.helidon.integrations.level=INFO -io.helidon.nima.webclient.level=INFO +io.helidon.webclient.level=INFO diff --git a/examples/integrations/oci/atp/README.md b/examples/integrations/oci/atp/README.md index bcba8b88a77..c3e27d7c6bf 100644 --- a/examples/integrations/oci/atp/README.md +++ b/examples/integrations/oci/atp/README.md @@ -1,4 +1,4 @@ -# Helidon ATP Nima Examples +# Helidon ATP SE Examples This example demonstrates how user can easily retrieve wallet from their ATP instance running in OCI and use information from that wallet to setup DataSource to do Database operations. diff --git a/examples/integrations/oci/atp/pom.xml b/examples/integrations/oci/atp/pom.xml index f502a804026..f701f584c40 100644 --- a/examples/integrations/oci/atp/pom.xml +++ b/examples/integrations/oci/atp/pom.xml @@ -30,8 +30,8 @@ io.helidon.examples.integrations.oci helidon-examples-integrations-oci-atp - Helidon Examples Integration OCI ATP Nima - Nima integration with OCI ATP. + Helidon Examples Integration OCI ATP + Integration with OCI ATP. io.helidon.examples.integrations.oci.atp.OciAtpMain @@ -39,8 +39,8 @@ - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver io.helidon.dbclient diff --git a/examples/integrations/oci/atp/src/main/java/io/helidon/examples/integrations/oci/atp/AtpService.java b/examples/integrations/oci/atp/src/main/java/io/helidon/examples/integrations/oci/atp/AtpService.java index ab827c2b0f8..e8595937361 100644 --- a/examples/integrations/oci/atp/src/main/java/io/helidon/examples/integrations/oci/atp/AtpService.java +++ b/examples/integrations/oci/atp/src/main/java/io/helidon/examples/integrations/oci/atp/AtpService.java @@ -32,15 +32,15 @@ import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManagerFactory; -import io.helidon.common.http.Http; import io.helidon.config.Config; import io.helidon.dbclient.DbClient; import io.helidon.dbclient.DbRow; import io.helidon.dbclient.jdbc.JdbcClientProvider; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.Http; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import com.oracle.bmc.database.Database; import com.oracle.bmc.database.model.GenerateAutonomousDatabaseWalletDetails; diff --git a/examples/integrations/oci/atp/src/main/java/io/helidon/examples/integrations/oci/atp/OciAtpMain.java b/examples/integrations/oci/atp/src/main/java/io/helidon/examples/integrations/oci/atp/OciAtpMain.java index 0227c0a2eed..b14edebdc66 100644 --- a/examples/integrations/oci/atp/src/main/java/io/helidon/examples/integrations/oci/atp/OciAtpMain.java +++ b/examples/integrations/oci/atp/src/main/java/io/helidon/examples/integrations/oci/atp/OciAtpMain.java @@ -20,7 +20,7 @@ import io.helidon.config.Config; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.webserver.WebServer; +import io.helidon.webserver.WebServer; import com.oracle.bmc.ConfigFileReader; import com.oracle.bmc.auth.AuthenticationDetailsProvider; diff --git a/examples/integrations/oci/atp/src/main/java/io/helidon/examples/integrations/oci/atp/package-info.java b/examples/integrations/oci/atp/src/main/java/io/helidon/examples/integrations/oci/atp/package-info.java index 35e3363181b..e09431d39be 100644 --- a/examples/integrations/oci/atp/src/main/java/io/helidon/examples/integrations/oci/atp/package-info.java +++ b/examples/integrations/oci/atp/src/main/java/io/helidon/examples/integrations/oci/atp/package-info.java @@ -15,6 +15,6 @@ */ /** - * Example of integration with OCI ATP in Nima application. + * Example of integration with OCI ATP in a Helidon SE application. */ package io.helidon.examples.integrations.oci.atp; diff --git a/examples/integrations/oci/atp/src/main/resources/logging.properties b/examples/integrations/oci/atp/src/main/resources/logging.properties index 80f8dd3f380..b4eb284e666 100644 --- a/examples/integrations/oci/atp/src/main/resources/logging.properties +++ b/examples/integrations/oci/atp/src/main/resources/logging.properties @@ -25,4 +25,4 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ io.helidon.level=INFO io.helidon.integrations.level=INFO -io.helidon.nima.webclient.level=INFO +io.helidon.webclient.level=INFO diff --git a/examples/integrations/oci/objectstorage-cdi/src/main/java/io/helidon/examples/integrations/oci/objectstorage/cdi/ObjectStorageResource.java b/examples/integrations/oci/objectstorage-cdi/src/main/java/io/helidon/examples/integrations/oci/objectstorage/cdi/ObjectStorageResource.java index a728a0de80d..b62fa0ed71e 100644 --- a/examples/integrations/oci/objectstorage-cdi/src/main/java/io/helidon/examples/integrations/oci/objectstorage/cdi/ObjectStorageResource.java +++ b/examples/integrations/oci/objectstorage-cdi/src/main/java/io/helidon/examples/integrations/oci/objectstorage/cdi/ObjectStorageResource.java @@ -24,7 +24,7 @@ import java.util.logging.Level; import java.util.logging.Logger; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import com.oracle.bmc.objectstorage.ObjectStorage; import com.oracle.bmc.objectstorage.requests.DeleteObjectRequest; diff --git a/examples/integrations/oci/objectstorage-cdi/src/main/resources/logging.properties b/examples/integrations/oci/objectstorage-cdi/src/main/resources/logging.properties index 80f8dd3f380..b4eb284e666 100644 --- a/examples/integrations/oci/objectstorage-cdi/src/main/resources/logging.properties +++ b/examples/integrations/oci/objectstorage-cdi/src/main/resources/logging.properties @@ -25,4 +25,4 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ io.helidon.level=INFO io.helidon.integrations.level=INFO -io.helidon.nima.webclient.level=INFO +io.helidon.webclient.level=INFO diff --git a/examples/integrations/oci/objectstorage/pom.xml b/examples/integrations/oci/objectstorage/pom.xml index f7df51ccec8..8c636de1471 100644 --- a/examples/integrations/oci/objectstorage/pom.xml +++ b/examples/integrations/oci/objectstorage/pom.xml @@ -31,7 +31,7 @@ io.helidon.examples.integrations.oci helidon-examples-integrations-oci-objectstorage Helidon Examples Integration OCI Object Storage - Nima integration with OCI Object Storage. + Integration with OCI Object Storage. io.helidon.examples.integrations.oci.objecstorage.OciObjectStorageMain @@ -39,8 +39,8 @@ - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver io.helidon.config diff --git a/examples/integrations/oci/objectstorage/src/main/java/io/helidon/examples/integrations/oci/objecstorage/ObjectStorageService.java b/examples/integrations/oci/objectstorage/src/main/java/io/helidon/examples/integrations/oci/objecstorage/ObjectStorageService.java index fa20a88b0b8..7b32d44a3bb 100644 --- a/examples/integrations/oci/objectstorage/src/main/java/io/helidon/examples/integrations/oci/objecstorage/ObjectStorageService.java +++ b/examples/integrations/oci/objectstorage/src/main/java/io/helidon/examples/integrations/oci/objecstorage/ObjectStorageService.java @@ -24,13 +24,13 @@ import java.util.logging.Level; import java.util.logging.Logger; -import io.helidon.common.http.Http; import io.helidon.config.Config; import io.helidon.config.ConfigException; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.Http; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import com.oracle.bmc.ConfigFileReader; import com.oracle.bmc.auth.AuthenticationDetailsProvider; diff --git a/examples/integrations/oci/objectstorage/src/main/java/io/helidon/examples/integrations/oci/objecstorage/OciObjectStorageMain.java b/examples/integrations/oci/objectstorage/src/main/java/io/helidon/examples/integrations/oci/objecstorage/OciObjectStorageMain.java index c2ec34a7f3a..5df3f1d19d9 100644 --- a/examples/integrations/oci/objectstorage/src/main/java/io/helidon/examples/integrations/oci/objecstorage/OciObjectStorageMain.java +++ b/examples/integrations/oci/objectstorage/src/main/java/io/helidon/examples/integrations/oci/objecstorage/OciObjectStorageMain.java @@ -25,8 +25,8 @@ import io.helidon.config.Config; import io.helidon.config.spi.ConfigSource; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.HttpRouting; import static io.helidon.config.ConfigSources.classpath; import static io.helidon.config.ConfigSources.file; diff --git a/examples/integrations/oci/objectstorage/src/main/java/io/helidon/examples/integrations/oci/objecstorage/package-info.java b/examples/integrations/oci/objectstorage/src/main/java/io/helidon/examples/integrations/oci/objecstorage/package-info.java index 1a91fa72fe8..ac79e32f44f 100644 --- a/examples/integrations/oci/objectstorage/src/main/java/io/helidon/examples/integrations/oci/objecstorage/package-info.java +++ b/examples/integrations/oci/objectstorage/src/main/java/io/helidon/examples/integrations/oci/objecstorage/package-info.java @@ -15,6 +15,6 @@ */ /** - * Example of integration with OCI object storage in Nima application. + * Example of integration with OCI object storage in a Helidon SE application. */ package io.helidon.examples.integrations.oci.objecstorage; diff --git a/examples/integrations/oci/objectstorage/src/main/resources/logging.properties b/examples/integrations/oci/objectstorage/src/main/resources/logging.properties index 80f8dd3f380..b4eb284e666 100644 --- a/examples/integrations/oci/objectstorage/src/main/resources/logging.properties +++ b/examples/integrations/oci/objectstorage/src/main/resources/logging.properties @@ -25,4 +25,4 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ io.helidon.level=INFO io.helidon.integrations.level=INFO -io.helidon.nima.webclient.level=INFO +io.helidon.webclient.level=INFO diff --git a/examples/integrations/oci/vault/pom.xml b/examples/integrations/oci/vault/pom.xml index 588d6642305..ae8ff57bc74 100644 --- a/examples/integrations/oci/vault/pom.xml +++ b/examples/integrations/oci/vault/pom.xml @@ -31,7 +31,7 @@ io.helidon.examples.integrations.oci helidon-examples-integrations-oci-vault Helidon Examples Integration OCI Vault - Nima integration with OCI Vault. + Integration with OCI Vault. io.helidon.examples.integrations.oci.vault.OciVaultMain @@ -39,8 +39,8 @@ - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver io.helidon.config diff --git a/examples/integrations/oci/vault/src/main/java/io/helidon/examples/integrations/oci/vault/OciVaultMain.java b/examples/integrations/oci/vault/src/main/java/io/helidon/examples/integrations/oci/vault/OciVaultMain.java index d53bfc777b1..8185f5c6aaa 100644 --- a/examples/integrations/oci/vault/src/main/java/io/helidon/examples/integrations/oci/vault/OciVaultMain.java +++ b/examples/integrations/oci/vault/src/main/java/io/helidon/examples/integrations/oci/vault/OciVaultMain.java @@ -20,7 +20,7 @@ import io.helidon.config.Config; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.webserver.WebServer; +import io.helidon.webserver.WebServer; import com.oracle.bmc.ConfigFileReader; import com.oracle.bmc.auth.AuthenticationDetailsProvider; diff --git a/examples/integrations/oci/vault/src/main/java/io/helidon/examples/integrations/oci/vault/VaultService.java b/examples/integrations/oci/vault/src/main/java/io/helidon/examples/integrations/oci/vault/VaultService.java index 3b7bf256858..6acaead52a4 100644 --- a/examples/integrations/oci/vault/src/main/java/io/helidon/examples/integrations/oci/vault/VaultService.java +++ b/examples/integrations/oci/vault/src/main/java/io/helidon/examples/integrations/oci/vault/VaultService.java @@ -24,11 +24,11 @@ import java.util.logging.Logger; import io.helidon.common.Base64Value; -import io.helidon.common.http.Http; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.Http; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import com.oracle.bmc.keymanagement.KmsCrypto; import com.oracle.bmc.keymanagement.model.DecryptDataDetails; diff --git a/examples/integrations/oci/vault/src/main/java/io/helidon/examples/integrations/oci/vault/package-info.java b/examples/integrations/oci/vault/src/main/java/io/helidon/examples/integrations/oci/vault/package-info.java index deea60af35b..82d96ad4736 100644 --- a/examples/integrations/oci/vault/src/main/java/io/helidon/examples/integrations/oci/vault/package-info.java +++ b/examples/integrations/oci/vault/src/main/java/io/helidon/examples/integrations/oci/vault/package-info.java @@ -15,6 +15,6 @@ */ /** - * Example of OCI Vault integration in a Nima application. + * Example of OCI Vault integration in a SE application. */ package io.helidon.examples.integrations.oci.vault; diff --git a/examples/integrations/pom.xml b/examples/integrations/pom.xml index a9dc60d189c..879d8c803f7 100644 --- a/examples/integrations/pom.xml +++ b/examples/integrations/pom.xml @@ -27,7 +27,7 @@ io.helidon.examples.integrations helidon-examples-integrations-project - Helidon Integrations Examples + Helidon Examples Integrations pom diff --git a/examples/integrations/vault/hcp/pom.xml b/examples/integrations/vault/hcp/pom.xml index f7941723f76..f6e242e8554 100644 --- a/examples/integrations/vault/hcp/pom.xml +++ b/examples/integrations/vault/hcp/pom.xml @@ -38,8 +38,8 @@ - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver io.helidon.integrations.vault diff --git a/examples/integrations/vault/hcp/src/main/java/io/helidon/examples/integrations/vault/hcp/CubbyholeService.java b/examples/integrations/vault/hcp/src/main/java/io/helidon/examples/integrations/vault/hcp/CubbyholeService.java index 27bccb74d22..4c07e430b99 100644 --- a/examples/integrations/vault/hcp/src/main/java/io/helidon/examples/integrations/vault/hcp/CubbyholeService.java +++ b/examples/integrations/vault/hcp/src/main/java/io/helidon/examples/integrations/vault/hcp/CubbyholeService.java @@ -19,14 +19,14 @@ import java.util.Map; import java.util.Optional; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.integrations.vault.Secret; import io.helidon.integrations.vault.secrets.cubbyhole.CubbyholeSecrets; import io.helidon.integrations.vault.sys.Sys; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; class CubbyholeService implements HttpService { private final Sys sys; diff --git a/examples/integrations/vault/hcp/src/main/java/io/helidon/examples/integrations/vault/hcp/Kv1Service.java b/examples/integrations/vault/hcp/src/main/java/io/helidon/examples/integrations/vault/hcp/Kv1Service.java index eb6ccf217d2..55770923621 100644 --- a/examples/integrations/vault/hcp/src/main/java/io/helidon/examples/integrations/vault/hcp/Kv1Service.java +++ b/examples/integrations/vault/hcp/src/main/java/io/helidon/examples/integrations/vault/hcp/Kv1Service.java @@ -19,14 +19,14 @@ import java.util.Map; import java.util.Optional; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.integrations.vault.Secret; import io.helidon.integrations.vault.secrets.kv1.Kv1Secrets; import io.helidon.integrations.vault.sys.Sys; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; class Kv1Service implements HttpService { private final Sys sys; diff --git a/examples/integrations/vault/hcp/src/main/java/io/helidon/examples/integrations/vault/hcp/Kv2Service.java b/examples/integrations/vault/hcp/src/main/java/io/helidon/examples/integrations/vault/hcp/Kv2Service.java index d0e05e2789a..5ef7fbb9d42 100644 --- a/examples/integrations/vault/hcp/src/main/java/io/helidon/examples/integrations/vault/hcp/Kv2Service.java +++ b/examples/integrations/vault/hcp/src/main/java/io/helidon/examples/integrations/vault/hcp/Kv2Service.java @@ -19,14 +19,14 @@ import java.util.Map; import java.util.Optional; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.integrations.vault.secrets.kv2.Kv2Secret; import io.helidon.integrations.vault.secrets.kv2.Kv2Secrets; import io.helidon.integrations.vault.sys.Sys; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; class Kv2Service implements HttpService { private final Sys sys; diff --git a/examples/integrations/vault/hcp/src/main/java/io/helidon/examples/integrations/vault/hcp/TransitService.java b/examples/integrations/vault/hcp/src/main/java/io/helidon/examples/integrations/vault/hcp/TransitService.java index 4d4b11fb2c0..5eb9e0376f2 100644 --- a/examples/integrations/vault/hcp/src/main/java/io/helidon/examples/integrations/vault/hcp/TransitService.java +++ b/examples/integrations/vault/hcp/src/main/java/io/helidon/examples/integrations/vault/hcp/TransitService.java @@ -31,10 +31,10 @@ import io.helidon.integrations.vault.secrets.transit.UpdateKeyConfig; import io.helidon.integrations.vault.secrets.transit.Verify; import io.helidon.integrations.vault.sys.Sys; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; class TransitService implements HttpService { private static final String ENCRYPTION_KEY = "encryption-key"; diff --git a/examples/integrations/vault/hcp/src/main/java/io/helidon/examples/integrations/vault/hcp/VaultMain.java b/examples/integrations/vault/hcp/src/main/java/io/helidon/examples/integrations/vault/hcp/VaultMain.java index ab3dd2c9b6b..b4d6c11b8d3 100644 --- a/examples/integrations/vault/hcp/src/main/java/io/helidon/examples/integrations/vault/hcp/VaultMain.java +++ b/examples/integrations/vault/hcp/src/main/java/io/helidon/examples/integrations/vault/hcp/VaultMain.java @@ -26,7 +26,7 @@ import io.helidon.integrations.vault.secrets.transit.TransitSecrets; import io.helidon.integrations.vault.sys.Sys; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.webserver.WebServer; +import io.helidon.webserver.WebServer; import static io.helidon.config.ConfigSources.classpath; import static io.helidon.config.ConfigSources.file; diff --git a/examples/jbatch/pom.xml b/examples/jbatch/pom.xml index fcb6c909d0f..82e3552d17b 100644 --- a/examples/jbatch/pom.xml +++ b/examples/jbatch/pom.xml @@ -28,7 +28,7 @@ io.helidon.examples.jbatch helidon-examples-jbatch - jbatch-example + Helidon Examples JBatch 2.1.0 diff --git a/examples/jbatch/src/main/java/io/helidon/jbatch/example/BatchResource.java b/examples/jbatch/src/main/java/io/helidon/examples/jbatch/BatchResource.java similarity index 97% rename from examples/jbatch/src/main/java/io/helidon/jbatch/example/BatchResource.java rename to examples/jbatch/src/main/java/io/helidon/examples/jbatch/BatchResource.java index 7d5189d081c..dd7d2aaa3c0 100644 --- a/examples/jbatch/src/main/java/io/helidon/jbatch/example/BatchResource.java +++ b/examples/jbatch/src/main/java/io/helidon/examples/jbatch/BatchResource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.jbatch.example; +package io.helidon.examples.jbatch; import java.util.ArrayList; import java.util.Arrays; diff --git a/examples/jbatch/src/main/java/io/helidon/jbatch/example/HelidonExecutorServiceProvider.java b/examples/jbatch/src/main/java/io/helidon/examples/jbatch/HelidonExecutorServiceProvider.java similarity index 91% rename from examples/jbatch/src/main/java/io/helidon/jbatch/example/HelidonExecutorServiceProvider.java rename to examples/jbatch/src/main/java/io/helidon/examples/jbatch/HelidonExecutorServiceProvider.java index d769b470c80..81ae527218e 100644 --- a/examples/jbatch/src/main/java/io/helidon/jbatch/example/HelidonExecutorServiceProvider.java +++ b/examples/jbatch/src/main/java/io/helidon/examples/jbatch/HelidonExecutorServiceProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.jbatch.example; +package io.helidon.examples.jbatch; import java.util.concurrent.ExecutorService; diff --git a/examples/jbatch/src/main/java/io/helidon/jbatch/example/jobs/MyBatchlet.java b/examples/jbatch/src/main/java/io/helidon/examples/jbatch/jobs/MyBatchlet.java similarity index 90% rename from examples/jbatch/src/main/java/io/helidon/jbatch/example/jobs/MyBatchlet.java rename to examples/jbatch/src/main/java/io/helidon/examples/jbatch/jobs/MyBatchlet.java index 77ef6bec1cb..f430b6dfa02 100644 --- a/examples/jbatch/src/main/java/io/helidon/jbatch/example/jobs/MyBatchlet.java +++ b/examples/jbatch/src/main/java/io/helidon/examples/jbatch/jobs/MyBatchlet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.jbatch.example.jobs; +package io.helidon.examples.jbatch.jobs; import jakarta.batch.api.AbstractBatchlet; diff --git a/examples/jbatch/src/main/java/io/helidon/jbatch/example/jobs/MyInputRecord.java b/examples/jbatch/src/main/java/io/helidon/examples/jbatch/jobs/MyInputRecord.java similarity index 90% rename from examples/jbatch/src/main/java/io/helidon/jbatch/example/jobs/MyInputRecord.java rename to examples/jbatch/src/main/java/io/helidon/examples/jbatch/jobs/MyInputRecord.java index 7a4aab9ba66..65e59b4fcc4 100644 --- a/examples/jbatch/src/main/java/io/helidon/jbatch/example/jobs/MyInputRecord.java +++ b/examples/jbatch/src/main/java/io/helidon/examples/jbatch/jobs/MyInputRecord.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.jbatch.example.jobs; +package io.helidon.examples.jbatch.jobs; /** * Example of an Input Record. diff --git a/examples/jbatch/src/main/java/io/helidon/jbatch/example/jobs/MyItemProcessor.java b/examples/jbatch/src/main/java/io/helidon/examples/jbatch/jobs/MyItemProcessor.java similarity index 90% rename from examples/jbatch/src/main/java/io/helidon/jbatch/example/jobs/MyItemProcessor.java rename to examples/jbatch/src/main/java/io/helidon/examples/jbatch/jobs/MyItemProcessor.java index 03cf082d0bf..a57516d36c5 100644 --- a/examples/jbatch/src/main/java/io/helidon/jbatch/example/jobs/MyItemProcessor.java +++ b/examples/jbatch/src/main/java/io/helidon/examples/jbatch/jobs/MyItemProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.jbatch.example.jobs; +package io.helidon.examples.jbatch.jobs; import jakarta.batch.api.chunk.ItemProcessor; diff --git a/examples/jbatch/src/main/java/io/helidon/jbatch/example/jobs/MyItemReader.java b/examples/jbatch/src/main/java/io/helidon/examples/jbatch/jobs/MyItemReader.java similarity index 92% rename from examples/jbatch/src/main/java/io/helidon/jbatch/example/jobs/MyItemReader.java rename to examples/jbatch/src/main/java/io/helidon/examples/jbatch/jobs/MyItemReader.java index a66d2626537..daad53e70a4 100644 --- a/examples/jbatch/src/main/java/io/helidon/jbatch/example/jobs/MyItemReader.java +++ b/examples/jbatch/src/main/java/io/helidon/examples/jbatch/jobs/MyItemReader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.jbatch.example.jobs; +package io.helidon.examples.jbatch.jobs; import java.util.StringTokenizer; diff --git a/examples/jbatch/src/main/java/io/helidon/jbatch/example/jobs/MyItemWriter.java b/examples/jbatch/src/main/java/io/helidon/examples/jbatch/jobs/MyItemWriter.java similarity index 89% rename from examples/jbatch/src/main/java/io/helidon/jbatch/example/jobs/MyItemWriter.java rename to examples/jbatch/src/main/java/io/helidon/examples/jbatch/jobs/MyItemWriter.java index 1d9a5927b5e..a4806af09f1 100644 --- a/examples/jbatch/src/main/java/io/helidon/jbatch/example/jobs/MyItemWriter.java +++ b/examples/jbatch/src/main/java/io/helidon/examples/jbatch/jobs/MyItemWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.jbatch.example.jobs; +package io.helidon.examples.jbatch.jobs; import java.util.List; diff --git a/examples/jbatch/src/main/java/io/helidon/jbatch/example/jobs/MyOutputRecord.java b/examples/jbatch/src/main/java/io/helidon/examples/jbatch/jobs/MyOutputRecord.java similarity index 90% rename from examples/jbatch/src/main/java/io/helidon/jbatch/example/jobs/MyOutputRecord.java rename to examples/jbatch/src/main/java/io/helidon/examples/jbatch/jobs/MyOutputRecord.java index 8fa06b333c4..09a751c0ed5 100644 --- a/examples/jbatch/src/main/java/io/helidon/jbatch/example/jobs/MyOutputRecord.java +++ b/examples/jbatch/src/main/java/io/helidon/examples/jbatch/jobs/MyOutputRecord.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.jbatch.example.jobs; +package io.helidon.examples.jbatch.jobs; /** * Example Output Processor. diff --git a/examples/jbatch/src/main/java/io/helidon/examples/jbatch/jobs/package-info.java b/examples/jbatch/src/main/java/io/helidon/examples/jbatch/jobs/package-info.java new file mode 100644 index 00000000000..406c301f930 --- /dev/null +++ b/examples/jbatch/src/main/java/io/helidon/examples/jbatch/jobs/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * JBatch specific classes. + */ +package io.helidon.examples.jbatch.jobs; diff --git a/examples/jbatch/src/main/java/io/helidon/examples/jbatch/package-info.java b/examples/jbatch/src/main/java/io/helidon/examples/jbatch/package-info.java new file mode 100644 index 00000000000..a7921e38241 --- /dev/null +++ b/examples/jbatch/src/main/java/io/helidon/examples/jbatch/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Example application showing support for JBatch and HelidonMP. + */ +package io.helidon.examples.jbatch; diff --git a/examples/jbatch/src/main/java/io/helidon/jbatch/example/jobs/package-info.java b/examples/jbatch/src/main/java/io/helidon/jbatch/example/jobs/package-info.java deleted file mode 100644 index d9ad3724f99..00000000000 --- a/examples/jbatch/src/main/java/io/helidon/jbatch/example/jobs/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * JBatch specific classes. - */ -package io.helidon.jbatch.example.jobs; diff --git a/examples/jbatch/src/main/java/io/helidon/jbatch/example/package-info.java b/examples/jbatch/src/main/java/io/helidon/jbatch/example/package-info.java deleted file mode 100644 index 41c8bfd6c14..00000000000 --- a/examples/jbatch/src/main/java/io/helidon/jbatch/example/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Example application showing support for JBatch and HelidonMP. - */ -package io.helidon.jbatch.example; diff --git a/examples/jbatch/src/main/resources/META-INF/batch-jobs/myJob.xml b/examples/jbatch/src/main/resources/META-INF/batch-jobs/myJob.xml index 3b470f22241..4788e859b2b 100644 --- a/examples/jbatch/src/main/resources/META-INF/batch-jobs/myJob.xml +++ b/examples/jbatch/src/main/resources/META-INF/batch-jobs/myJob.xml @@ -1,7 +1,7 @@ - - 4.0.0 - - io.helidon.applications - helidon-nima - 4.0.0-SNAPSHOT - ../../../applications/nima/pom.xml - - - io.helidon.examples.nima - helidon-nima-examples-basic - Helidon Níma Examples Basic - - - io.helidon.examples.nima.basic.BasicMain - - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-libs - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - integration-test - verify - - - - - - - diff --git a/examples/nima/basic/src/main/java/io/helidon/examples/nima/basic/package-info.java b/examples/nima/basic/src/main/java/io/helidon/examples/nima/basic/package-info.java deleted file mode 100644 index 1a25e406e94..00000000000 --- a/examples/nima/basic/src/main/java/io/helidon/examples/nima/basic/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Basic example. - */ -package io.helidon.examples.nima.basic; diff --git a/examples/nima/basic/src/main/resources/logging.properties b/examples/nima/basic/src/main/resources/logging.properties deleted file mode 100644 index 3a2ccac5c46..00000000000 --- a/examples/nima/basic/src/main/resources/logging.properties +++ /dev/null @@ -1,20 +0,0 @@ -# -# Copyright (c) 2022 Oracle and/or its affiliates. -# -# 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. -# -handlers=java.util.logging.ConsoleHandler -java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS.%1$tL %5$s%6$s%n -# Global logging level. Can be overridden by specific loggers -.level=INFO -io.helidon.nima.level=INFO diff --git a/examples/nima/basic/src/test/resources/logging-test.properties b/examples/nima/basic/src/test/resources/logging-test.properties deleted file mode 100644 index d3360e3eaa2..00000000000 --- a/examples/nima/basic/src/test/resources/logging-test.properties +++ /dev/null @@ -1,22 +0,0 @@ -# -# Copyright (c) 2022 Oracle and/or its affiliates. -# -# 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. -# -handlers=java.util.logging.ConsoleHandler -java.util.logging.ConsoleHandler.level=FINEST -java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter -# java.util.logging.SimpleFormatter.format = [%1$tc] %5$s %6$s%n -java.util.logging.SimpleFormatter.format=%1$tH:%1$tM:%1$tS %5$s%6$s%n -# Global logging level. Can be overridden by specific loggers -.level=WARNING diff --git a/examples/nima/echo/pom.xml b/examples/nima/echo/pom.xml deleted file mode 100644 index dc02e1aa5f2..00000000000 --- a/examples/nima/echo/pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - 4.0.0 - - io.helidon.applications - helidon-nima - 4.0.0-SNAPSHOT - ../../../applications/nima/pom.xml - - - io.helidon.examples.nima - helidon-nima-examples-echo - Helidon Níma Examples Echo - - - io.helidon.examples.nima.echo.EchoMain - - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.webclient - helidon-nima-webclient - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-libs - - - - - - diff --git a/examples/nima/echo/src/main/java/io/helidon/examples/nima/echo/package-info.java b/examples/nima/echo/src/main/java/io/helidon/examples/nima/echo/package-info.java deleted file mode 100644 index 09dd509da6b..00000000000 --- a/examples/nima/echo/src/main/java/io/helidon/examples/nima/echo/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Echo example. - */ -package io.helidon.examples.nima.echo; diff --git a/examples/nima/fault-tolerance/pom.xml b/examples/nima/fault-tolerance/pom.xml deleted file mode 100644 index 13c125ddb6f..00000000000 --- a/examples/nima/fault-tolerance/pom.xml +++ /dev/null @@ -1,138 +0,0 @@ - - - - 4.0.0 - - io.helidon.applications - helidon-se - 4.0.0-SNAPSHOT - ../../../applications/se/pom.xml - - - io.helidon.examples.nima - helidon-examples-nima-fault-tolerance - Helidon Examples Níma Fault Tolerance - - - io.helidon.Main - - - - - io.helidon - helidon - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.webclient - helidon-nima-webclient - - - io.helidon.inject - helidon-inject-api - - - io.helidon.inject - helidon-inject-runtime - - - io.helidon.inject.configdriven - helidon-inject-configdriven-runtime - - - io.helidon.config - helidon-config-yaml - - - io.helidon.nima.fault-tolerance - helidon-nima-fault-tolerance - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - true - - - io.helidon.inject - helidon-inject-processor - ${helidon.version} - - - io.helidon.nima.http - helidon-nima-http-processor - ${helidon.version} - - - io.helidon.nima.fault-tolerance - helidon-nima-fault-tolerance-processor - ${helidon.version} - - - - -Aio.helidon.inject.autoAddNonContractInterfaces=true - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-libs - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - integration-test - verify - - - - - - - diff --git a/examples/nima/fault-tolerance/src/main/java/io/helidon/examples/nima/faulttolerance/package-info.java b/examples/nima/fault-tolerance/src/main/java/io/helidon/examples/nima/faulttolerance/package-info.java deleted file mode 100644 index 98a75280d97..00000000000 --- a/examples/nima/fault-tolerance/src/main/java/io/helidon/examples/nima/faulttolerance/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Example showing usage of HTTP endpoints with Fault Tolerance annotations. - */ -package io.helidon.examples.nima.faulttolerance; diff --git a/examples/nima/fault-tolerance/src/test/java/io/helidon/examples/nima/faulttolerance/FaultToleranceTest.java b/examples/nima/fault-tolerance/src/test/java/io/helidon/examples/nima/faulttolerance/FaultToleranceTest.java deleted file mode 100644 index ac55853d11c..00000000000 --- a/examples/nima/fault-tolerance/src/test/java/io/helidon/examples/nima/faulttolerance/FaultToleranceTest.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.examples.nima.faulttolerance; - -import io.helidon.Main; -import io.helidon.common.http.Http; -import io.helidon.inject.api.InjectionServices; -import io.helidon.nima.webclient.api.ClientResponseTyped; -import io.helidon.nima.webclient.api.WebClient; -import io.helidon.nima.webserver.WebServer; - -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.startsWith; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.jupiter.api.Assertions.fail; - -class FaultToleranceTest { - private static WebClient webClient; - private static WebClient adminWebClient; - - @BeforeAll - static void init() { - Main.main(new String[0]); - WebServer webServer = InjectionServices.realizedServices() - .lookup(WebServer.class) - .get(); - - if (!webServer.isRunning()) { - fail("Webserver should be running, but is shut down"); - } - - webClient = WebClient.builder() - .baseUri("http://localhost:" + webServer.port()) - .build(); - - adminWebClient = WebClient.builder() - .baseUri("http://localhost:" + webServer.port("admin")) - .build(); - } - - @AfterAll - static void shutDown() { - InjectionServices.injectionServices() - .map(InjectionServices::shutdown); - } - - @Test - void testAdminEndpointIsOnAdminSocket() { - String response = adminWebClient.get("/admin") - .requestEntity(String.class); - - assertThat(response, startsWith("This is the admin endpoint")); - } - - @Test - void testAdminEndpointIsNotOnDefaultSocket() { - ClientResponseTyped response = webClient.get("/admin") - .request(String.class); - assertThat(response.entity(), response.status(), is(Http.Status.NOT_FOUND_404)); - } - - @Test - void testGreetSimple() { - String response = webClient.get("/greet") - .requestEntity(String.class); - assertThat(response, is("Hello World!")); - } - - @Test - void testGreetNamed() { - String response = webClient.get("/greet/helidon") - .requestEntity(String.class); - - assertThat(response, startsWith("Hello helidon! Requested host: localhost:")); - } - - @Test - void testGreetNamedFallback() { - String response = webClient.get("/greet/helidon") - .queryParam("throw", "true") - .requestEntity(String.class); - - assertThat(response, startsWith("Fallback for")); - } -} diff --git a/examples/nima/imperative/pom.xml b/examples/nima/imperative/pom.xml deleted file mode 100644 index c963c54cc04..00000000000 --- a/examples/nima/imperative/pom.xml +++ /dev/null @@ -1,88 +0,0 @@ - - - - 4.0.0 - - io.helidon.applications - helidon-se - 4.0.0-SNAPSHOT - ../../../applications/se/pom.xml - - - io.helidon.examples.nima - helidon-nima-examples-imperative - Helidon Níma Examples Imperative - Example of imperative ("pure" programmatic) approach using Helidon SE - - - io.helidon.examples.nima.imperative.ImperativeMain - - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.config - helidon-config-yaml - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-libs - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - integration-test - verify - - - - - - - diff --git a/examples/nima/imperative/src/main/java/io/helidon/examples/nima/imperative/ImperativeMain.java b/examples/nima/imperative/src/main/java/io/helidon/examples/nima/imperative/ImperativeMain.java deleted file mode 100644 index 864a9d097d1..00000000000 --- a/examples/nima/imperative/src/main/java/io/helidon/examples/nima/imperative/ImperativeMain.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.examples.nima.imperative; - -import io.helidon.common.config.Config; -import io.helidon.common.config.GlobalConfig; -import io.helidon.common.http.Http; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRouting; - -/** - * Main class of this example, starts the server. - */ -public final class ImperativeMain { - private ImperativeMain() { - } - - /** - * Start the example. - * - * @param args ignored - */ - public static void main(String[] args) { - Config config = GlobalConfig.config(); - - WebServer server = WebServer.create(ws -> ws.config(config.get("server")) - .routing(ImperativeMain::routing)) - .start(); - - System.out.println("Server started. Server configuration: " + server.prototype()); - } - - private static void routing(HttpRouting.Builder routing) { - Http.Method list = Http.Method.create("LIST"); - - routing.get("/", (req, res) -> res.send("Hello World!")) - .route(list, "/", (req, res) -> res.send("lll")) - .route(list, (req, res) -> res.send("listed")); - } -} diff --git a/examples/nima/imperative/src/main/java/io/helidon/examples/nima/imperative/package-info.java b/examples/nima/imperative/src/main/java/io/helidon/examples/nima/imperative/package-info.java deleted file mode 100644 index 11013cba776..00000000000 --- a/examples/nima/imperative/src/main/java/io/helidon/examples/nima/imperative/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Example showing usage of HTTP web-server with pure imperative programming (no injection, no inversion of control). - */ -package io.helidon.examples.nima.imperative; diff --git a/examples/nima/media/pom.xml b/examples/nima/media/pom.xml deleted file mode 100644 index eb2932634e5..00000000000 --- a/examples/nima/media/pom.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - - 4.0.0 - - io.helidon.applications - helidon-nima - 4.0.0-SNAPSHOT - ../../../applications/nima/pom.xml - - - io.helidon.examples.nima - helidon-nima-examples-media - Helidon Níma Examples Media - - - io.helidon.examples.nima.media.MediaMain - - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.http.media - helidon-nima-http-media-multipart - - - io.helidon.nima.http.media - helidon-nima-http-media-jsonp - - - io.helidon.nima.webserver - helidon-nima-webserver-static-content - - - jakarta.json - jakarta.json-api - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-libs - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - integration-test - verify - - - - - - - diff --git a/examples/nima/media/src/main/java/io/helidon/examples/nima/media/FileService.java b/examples/nima/media/src/main/java/io/helidon/examples/nima/media/FileService.java deleted file mode 100644 index ee1b0fbf565..00000000000 --- a/examples/nima/media/src/main/java/io/helidon/examples/nima/media/FileService.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.examples.nima.media; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardOpenOption; -import java.util.Map; -import java.util.stream.Stream; - -import io.helidon.common.http.ContentDisposition; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderNames; -import io.helidon.common.http.ServerResponseHeaders; -import io.helidon.common.media.type.MediaTypes; -import io.helidon.nima.http.media.multipart.MultiPart; -import io.helidon.nima.http.media.multipart.ReadablePart; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; - -import jakarta.json.Json; -import jakarta.json.JsonArrayBuilder; -import jakarta.json.JsonBuilderFactory; - -import static io.helidon.common.http.Http.Status.BAD_REQUEST_400; -import static io.helidon.common.http.Http.Status.MOVED_PERMANENTLY_301; -import static io.helidon.common.http.Http.Status.NOT_FOUND_404; - -/** - * File service. - */ -final class FileService implements HttpService { - private static final Http.Header UI_LOCATION = Http.Headers.createCached(HeaderNames.LOCATION, "/ui"); - private final JsonBuilderFactory jsonFactory; - private final Path storage; - - /** - * Create a new file upload service instance. - */ - FileService() { - jsonFactory = Json.createBuilderFactory(Map.of()); - storage = createStorage(); - System.out.println("Storage: " + storage); - } - - @Override - public void routing(HttpRules rules) { - rules.get("/", this::list) - .get("/{fname}", this::download) - .post("/", this::upload); - } - - private static Path createStorage() { - try { - return Files.createTempDirectory("fileupload"); - } catch (IOException ex) { - throw new RuntimeException(ex); - } - } - - private static Stream listFiles(Path storage) { - - try (Stream walk = Files.walk(storage)) { - return walk.filter(Files::isRegularFile) - .map(storage::relativize) - .map(Path::toString) - .toList() - .stream(); - } catch (IOException ex) { - throw new RuntimeException(ex); - } - } - - private static OutputStream newOutputStream(Path storage, String fname) { - try { - return Files.newOutputStream(storage.resolve(fname), - StandardOpenOption.CREATE, - StandardOpenOption.WRITE, - StandardOpenOption.TRUNCATE_EXISTING); - } catch (IOException ex) { - throw new RuntimeException(ex); - } - } - - private void list(ServerRequest req, ServerResponse res) { - JsonArrayBuilder arrayBuilder = jsonFactory.createArrayBuilder(); - listFiles(storage).forEach(arrayBuilder::add); - res.send(jsonFactory.createObjectBuilder().add("files", arrayBuilder).build()); - } - - private void download(ServerRequest req, ServerResponse res) { - Path filePath = storage.resolve(req.path().pathParameters().value("fname")); - if (!filePath.getParent().equals(storage)) { - res.status(BAD_REQUEST_400).send("Invalid file name"); - return; - } - if (!Files.exists(filePath)) { - res.status(NOT_FOUND_404).send(); - return; - } - if (!Files.isRegularFile(filePath)) { - res.status(BAD_REQUEST_400).send("Not a file"); - return; - } - ServerResponseHeaders headers = res.headers(); - headers.contentType(MediaTypes.APPLICATION_OCTET_STREAM); - headers.set(ContentDisposition.builder() - .filename(filePath.getFileName().toString()) - .build()); - res.send(filePath); - } - - private void upload(ServerRequest req, ServerResponse res) { - MultiPart mp = req.content().as(MultiPart.class); - - while (mp.hasNext()) { - ReadablePart part = mp.next(); - - if ("file[]".equals(part.name())) { - try (InputStream in = part.inputStream(); OutputStream out = newOutputStream(storage, part.fileName().get())) { - in.transferTo(out); - } catch (IOException e) { - throw new RuntimeException("Failed to write content", e); - } - } - } - - res.status(MOVED_PERMANENTLY_301) - .header(UI_LOCATION) - .send(); - } -} diff --git a/examples/nima/media/src/main/java/io/helidon/examples/nima/media/MediaMain.java b/examples/nima/media/src/main/java/io/helidon/examples/nima/media/MediaMain.java deleted file mode 100644 index dac375c2f78..00000000000 --- a/examples/nima/media/src/main/java/io/helidon/examples/nima/media/MediaMain.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.examples.nima.media; - -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderNames; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.staticcontent.StaticContentService; - -/** - * This application provides a simple file upload service with a UI to exercise multipart. - */ -public class MediaMain { - private static final Http.Header UI_LOCATION = Http.Headers.createCached(HeaderNames.LOCATION, "/ui"); - - private MediaMain() { - } - - /** - * Executes the example. - * - * @param args command line arguments, ignored - */ - public static void main(String[] args) { - WebServer server = WebServer.builder() - .routing(MediaMain::routing) - .port(8080) - .build() - .start(); - - System.out.println("WEB server is up! http://localhost:" + server.port()); - } - - /** - * Updates the routing rules. - * - * @param rules routing rules - */ - static void routing(HttpRules rules) { - rules.any("/", (req, res) -> { - res.status(Http.Status.MOVED_PERMANENTLY_301); - res.header(UI_LOCATION); - res.send(); - }) - .register("/ui", StaticContentService.builder("WEB") - .welcomeFileName("index.html") - .build()) - .register("/api", new FileService()); - } -} diff --git a/examples/nima/media/src/main/java/io/helidon/examples/nima/media/package-info.java b/examples/nima/media/src/main/java/io/helidon/examples/nima/media/package-info.java deleted file mode 100644 index d04dfed4c18..00000000000 --- a/examples/nima/media/src/main/java/io/helidon/examples/nima/media/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Media support example. - */ -package io.helidon.examples.nima.media; diff --git a/examples/nima/media/src/main/resources/WEB/index.html b/examples/nima/media/src/main/resources/WEB/index.html deleted file mode 100644 index 0bb040331d0..00000000000 --- a/examples/nima/media/src/main/resources/WEB/index.html +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - Helidon Examples Media Multipart - - - - - -

Uploaded files

-
- -

Upload (buffered)

-
- Select a file to upload: - - -
- -

Upload (stream)

-
- Select a file to upload: - - -
- - - - diff --git a/examples/nima/media/src/main/resources/logging.properties b/examples/nima/media/src/main/resources/logging.properties deleted file mode 100644 index 3a2ccac5c46..00000000000 --- a/examples/nima/media/src/main/resources/logging.properties +++ /dev/null @@ -1,20 +0,0 @@ -# -# Copyright (c) 2022 Oracle and/or its affiliates. -# -# 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. -# -handlers=java.util.logging.ConsoleHandler -java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS.%1$tL %5$s%6$s%n -# Global logging level. Can be overridden by specific loggers -.level=INFO -io.helidon.nima.level=INFO diff --git a/examples/nima/observe/pom.xml b/examples/nima/observe/pom.xml deleted file mode 100644 index b3d8168536e..00000000000 --- a/examples/nima/observe/pom.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - - 4.0.0 - - io.helidon.applications - helidon-nima - 4.0.0-SNAPSHOT - ../../../applications/nima/pom.xml - - - io.helidon.examples.nima - helidon-nima-examples-observe - Helidon Níma Examples Observe - - - io.helidon.examples.nima.observe.ObserveMain - - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.observe - helidon-nima-observe-health - - - io.helidon.nima.observe - helidon-nima-observe-config - - - io.helidon.nima.observe - helidon-nima-observe-info - - - io.helidon.nima.observe - helidon-nima-observe-log - - - io.helidon.security.integration - helidon-security-integration-nima - - - io.helidon.security.providers - helidon-security-providers-http-auth - - - io.helidon.nima.webserver - helidon-nima-webserver-context - - - io.helidon.config - helidon-config-yaml - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-libs - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - integration-test - verify - - - - - - - diff --git a/examples/nima/observe/src/main/java/io/helidon/examples/nima/observe/package-info.java b/examples/nima/observe/src/main/java/io/helidon/examples/nima/observe/package-info.java deleted file mode 100644 index 708f61aaf83..00000000000 --- a/examples/nima/observe/src/main/java/io/helidon/examples/nima/observe/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Observability example. - */ -package io.helidon.examples.nima.observe; diff --git a/examples/nima/observe/src/main/resources/application.yaml b/examples/nima/observe/src/main/resources/application.yaml deleted file mode 100644 index 0139c38d623..00000000000 --- a/examples/nima/observe/src/main/resources/application.yaml +++ /dev/null @@ -1,42 +0,0 @@ -# -# Copyright (c) 2022 Oracle and/or its affiliates. -# -# 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. -# - -server: - host: "127.0.0.1" - port: 8080 -observe: - info: - values: - name: "Observe Example" - version: "1.0.0" -security: - providers: - - http-basic-auth: - users: - - login: "admin" - password: "password" - roles: ["nima-observe"] - web-server: - paths: - - path: "/observe/log/*" - authenticate: true - - path: "/observe/config/*" - authenticate: true - -app: - greeting: "Hello!" - app-secret: "Do not print this in observe" - app-password: "Do not print this in observe" diff --git a/examples/nima/observe/src/main/resources/logging.properties b/examples/nima/observe/src/main/resources/logging.properties deleted file mode 100644 index bcecf0d6825..00000000000 --- a/examples/nima/observe/src/main/resources/logging.properties +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (c) 2022 Oracle and/or its affiliates. -# -# 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. -# -handlers=java.util.logging.ConsoleHandler -java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS.%1$tL %5$s%6$s%n -# Global logging level. Can be overridden by specific loggers -.level=INFO -io.helidon.nima.level=INFO - -java.util.logging.ConsoleHandler.level=ALL -# to enable security audit logging for Helidon: -# AUDIT.level=FINEST diff --git a/examples/nima/observe/src/test/resources/logging-test.properties b/examples/nima/observe/src/test/resources/logging-test.properties deleted file mode 100644 index d3360e3eaa2..00000000000 --- a/examples/nima/observe/src/test/resources/logging-test.properties +++ /dev/null @@ -1,22 +0,0 @@ -# -# Copyright (c) 2022 Oracle and/or its affiliates. -# -# 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. -# -handlers=java.util.logging.ConsoleHandler -java.util.logging.ConsoleHandler.level=FINEST -java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter -# java.util.logging.SimpleFormatter.format = [%1$tc] %5$s %6$s%n -java.util.logging.SimpleFormatter.format=%1$tH:%1$tM:%1$tS %5$s%6$s%n -# Global logging level. Can be overridden by specific loggers -.level=WARNING diff --git a/examples/nima/pom.xml b/examples/nima/pom.xml deleted file mode 100644 index 98039f82bc5..00000000000 --- a/examples/nima/pom.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - 4.0.0 - - io.helidon.examples - helidon-examples-project - 4.0.0-SNAPSHOT - - io.helidon.examples.nima - helidon-examples-nima-project - Helidon Examples Níma Project - pom - - - basic - quickstart - quickstart-standalone - echo - media - protocols - tracing - observe - static-content - fault-tolerance - imperative - - - diff --git a/examples/nima/protocols/pom.xml b/examples/nima/protocols/pom.xml deleted file mode 100644 index a04297d0b8c..00000000000 --- a/examples/nima/protocols/pom.xml +++ /dev/null @@ -1,114 +0,0 @@ - - - - 4.0.0 - - io.helidon.applications - helidon-nima - 4.0.0-SNAPSHOT - ../../../applications/nima/pom.xml - - - io.helidon.examples.nima - helidon-nima-examples-protocols - Helidon Níma Examples Protocols - - - io.helidon.examples.nima.protocols.ProtocolsMain - - - - - - javax.annotation - javax.annotation-api - 1.3.2 - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.grpc - helidon-nima-grpc-webserver - - - io.helidon.nima.http2 - helidon-nima-http2-webclient - - - io.helidon.nima.websocket - helidon-nima-websocket-webserver - - - io.helidon.nima.http2 - helidon-nima-http2-webserver - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - - - - - kr.motd.maven - os-maven-plugin - ${version.plugin.os} - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-libs - - - - - org.xolstice.maven.plugins - protobuf-maven-plugin - 0.6.1 - - - - compile - compile-custom - - - - - com.google.protobuf:protoc:3.5.1-1:exe:${os.detected.classifier} - grpc-java - io.grpc:protoc-gen-grpc-java:${version.lib.grpc}:exe:${os.detected.classifier} - - - - - - diff --git a/examples/nima/protocols/src/main/java/io/helidon/examples/nima/protocols/package-info.java b/examples/nima/protocols/src/main/java/io/helidon/examples/nima/protocols/package-info.java deleted file mode 100644 index d14e9b9cc5a..00000000000 --- a/examples/nima/protocols/src/main/java/io/helidon/examples/nima/protocols/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Various supported protocols example. - */ -package io.helidon.examples.nima.protocols; diff --git a/examples/nima/protocols/src/main/proto/strings.proto b/examples/nima/protocols/src/main/proto/strings.proto deleted file mode 100644 index 09312cf4f96..00000000000 --- a/examples/nima/protocols/src/main/proto/strings.proto +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2021 Oracle and/or its affiliates. - * - * 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. - */ - - -syntax = "proto3"; -option java_package = "io.helidon.examples.nima.grpc.strings"; - -service StringService { - rpc Upper (StringMessage) returns (StringMessage) {} - rpc Lower (StringMessage) returns (StringMessage) {} - rpc Split (StringMessage) returns (stream StringMessage) {} - rpc Join (stream StringMessage) returns (StringMessage) {} - rpc Echo (stream StringMessage) returns (stream StringMessage) {} -} - -message StringMessage { - string text = 1; -} diff --git a/examples/nima/protocols/src/main/resources/logging.properties b/examples/nima/protocols/src/main/resources/logging.properties deleted file mode 100644 index 3a2ccac5c46..00000000000 --- a/examples/nima/protocols/src/main/resources/logging.properties +++ /dev/null @@ -1,20 +0,0 @@ -# -# Copyright (c) 2022 Oracle and/or its affiliates. -# -# 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. -# -handlers=java.util.logging.ConsoleHandler -java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS.%1$tL %5$s%6$s%n -# Global logging level. Can be overridden by specific loggers -.level=INFO -io.helidon.nima.level=INFO diff --git a/examples/nima/quickstart-standalone/pom.xml b/examples/nima/quickstart-standalone/pom.xml deleted file mode 100644 index 9e4b18610db..00000000000 --- a/examples/nima/quickstart-standalone/pom.xml +++ /dev/null @@ -1,291 +0,0 @@ - - - - 4.0.0 - - io.helidon.examples.nima - helidon-nima-examples-quickstart-standalone - 4.0.0-SNAPSHOT - - Helidon Níma Examples Quickstart Standalone - Example demonstrating a standalone project without an application parent. - - - UTF-8 - UTF-8 - 21 - ${maven.compiler.source} - ${maven.compiler.source} - - 4.0.0-SNAPSHOT - io.helidon.examples.nima.quickstart.standalone.StandaloneQuickstartMain - - - 3.8.1 - 3.0.0 - 1.6.0 - 3.0.0-M5 - 4.0.0-M1 - 4.0.0-M1 - 3.0.2 - 1.5.0.Final - 2.7 - 3.0.0-M5 - - - - - - - io.helidon - helidon-dependencies - ${helidon.version} - pom - import - - - - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.webclient - helidon-nima-webclient - - - io.helidon.nima.http2 - helidon-nima-http2-webclient - - - io.helidon.nima.http2 - helidon-nima-http2-webserver - - - io.helidon.nima.http.media - helidon-nima-http-media-jsonp - - - io.helidon.nima.observe - helidon-nima-observe-health - - - io.helidon.config - helidon-config-yaml - - - io.helidon.health - helidon-health-checks - - - jakarta.json - jakarta.json-api - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - - - ${project.artifactId} - - - kr.motd.maven - os-maven-plugin - ${version.plugin.os} - - - - - - org.apache.maven.plugins - maven-surefire-plugin - ${version.plugin.surefire} - - false - false - - - - org.apache.maven.plugins - maven-failsafe-plugin - ${version.plugin.failsafe} - - false - true - - - - org.apache.maven.plugins - maven-dependency-plugin - ${version.plugin.dependency} - - - copy-libs - prepare-package - - copy-dependencies - - - ${project.build.directory}/libs - false - false - true - true - runtime - test - true - - - - - - org.apache.maven.plugins - maven-resources-plugin - ${version.plugin.resources} - - - org.apache.maven.plugins - maven-jar-plugin - ${version.plugin.jar} - - - - true - libs - ${mainClass} - false - - - - - - org.codehaus.mojo - exec-maven-plugin - ${version.plugin.exec} - - java - true - - -classpath - - ${mainClass} - - - - - io.helidon.build-tools - helidon-maven-plugin - ${version.plugin.helidon} - - - io.helidon.build-tools - helidon-cli-maven-plugin - ${version.plugin.helidon-cli} - - - org.apache.maven.plugins - maven-source-plugin - ${version.plugin.source} - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-libs - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - integration-test - verify - - - - - - - - - native-image - - - - io.helidon.build-tools - helidon-maven-plugin - - - - native-image - - - - - - - - - io.helidon.integrations.graal - helidon-graal-native-image-extension - - - - - jlink-image - - - - io.helidon.build-tools - helidon-maven-plugin - - - - jlink-image - - - - - - - - - diff --git a/examples/nima/quickstart-standalone/src/main/java/io/helidon/examples/nima/quickstart/standalone/GreetClientHttp.java b/examples/nima/quickstart-standalone/src/main/java/io/helidon/examples/nima/quickstart/standalone/GreetClientHttp.java deleted file mode 100644 index 43a6d3540ac..00000000000 --- a/examples/nima/quickstart-standalone/src/main/java/io/helidon/examples/nima/quickstart/standalone/GreetClientHttp.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.examples.nima.quickstart.standalone; - -import io.helidon.common.http.Http; -import io.helidon.nima.webclient.api.WebClient; - -/** - * Executable class that invokes HTTP/1 requests against the server. - */ -public class GreetClientHttp { - private GreetClientHttp() { - } - - /** - * Main method. - * - * @param args ignored - */ - public static void main(String[] args) { - WebClient client = WebClient.builder() - .baseUri("http://localhost:8080/greet") - .build(); - - String response = client.method(Http.Method.GET) - .requestEntity(String.class); - - System.out.println(response); - - response = client.get("Nima") - .requestEntity(String.class); - - System.out.println(response); - } -} diff --git a/examples/nima/quickstart-standalone/src/main/java/io/helidon/examples/nima/quickstart/standalone/GreetClientHttp2.java b/examples/nima/quickstart-standalone/src/main/java/io/helidon/examples/nima/quickstart/standalone/GreetClientHttp2.java deleted file mode 100644 index 37f270e60c9..00000000000 --- a/examples/nima/quickstart-standalone/src/main/java/io/helidon/examples/nima/quickstart/standalone/GreetClientHttp2.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.examples.nima.quickstart.standalone; - -/** - * Executable class that invokes server using HTTP/2 client. - */ -public class GreetClientHttp2 { - private GreetClientHttp2() { - } - - /** - * Main method. - * - * @param args ignored - */ - public static void main(String[] args) { - // TODO finish HTTP/2 client - throw new UnsupportedOperationException("HTTP/2 client is not yet implemented"); - /* - Http2Client client = WebClient.builder() - .build() - .protocol(Http2.PROTOCOL) - .baseUri("http://localhost:8080/greet") - .priorKnowledge(true); - - String response = client.method(Http.Method.GET) - .request() - .as(String.class); - - System.out.println(response); - - response = client.get("Nima") - .request() - .as(String.class); - - System.out.println(response); - */ - } -} diff --git a/examples/nima/quickstart-standalone/src/main/java/io/helidon/examples/nima/quickstart/standalone/GreetService.java b/examples/nima/quickstart-standalone/src/main/java/io/helidon/examples/nima/quickstart/standalone/GreetService.java deleted file mode 100644 index f710e0844e2..00000000000 --- a/examples/nima/quickstart-standalone/src/main/java/io/helidon/examples/nima/quickstart/standalone/GreetService.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2018, 2022 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.examples.nima.quickstart.standalone; - -import java.util.Collections; -import java.util.concurrent.atomic.AtomicReference; - -import io.helidon.common.http.Http; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; - -import jakarta.json.Json; -import jakarta.json.JsonBuilderFactory; -import jakarta.json.JsonObject; - -/** - * A simple service to greet you. Examples: - *

- * Get default greeting message: - * {@code curl -X GET http://localhost:8080/greet} - *

- * Get greeting message for Joe: - * {@code curl -X GET http://localhost:8080/greet/Joe} - *

- * Change greeting - * {@code curl -X PUT -H "Content-Type: application/json" -d '{"greeting" : "Howdy"}' http://localhost:8080/greet/greeting} - *

- * The message is returned as a JSON object - */ -class GreetService implements HttpService { - - private static final JsonBuilderFactory JSON = Json.createBuilderFactory(Collections.emptyMap()); - - /** - * The config value for the key {@code greeting}. - */ - private final AtomicReference greeting = new AtomicReference<>(); - - GreetService() { - greeting.set("Hello"); - } - - /** - * A service registers itself by updating the routing rules. - * - * @param rules the routing rules. - */ - @Override - public void routing(HttpRules rules) { - rules - .get("/", this::getDefaultMessageHandler) - .get("/{name}", this::getMessageHandler) - .put("/greeting", this::updateGreetingHandler); - } - - /** - * Return a worldly greeting message. - * - * @param request the server request - * @param response the server response - */ - private void getDefaultMessageHandler(ServerRequest request, - ServerResponse response) { - sendResponse(response, "World"); - } - - /** - * Return a greeting message using the name that was provided. - * - * @param request the server request - * @param response the server response - */ - private void getMessageHandler(ServerRequest request, - ServerResponse response) { - String name = request.path().pathParameters().value("name"); - sendResponse(response, name); - } - - private void sendResponse(ServerResponse response, String name) { - String msg = String.format("%s %s!", greeting.get(), name); - - JsonObject returnObject = JSON.createObjectBuilder() - .add("message", msg) - .build(); - response.send(returnObject); - } - - private void updateGreetingFromJson(JsonObject jo, ServerResponse response) { - - if (!jo.containsKey("greeting")) { - JsonObject jsonErrorObject = JSON.createObjectBuilder() - .add("error", "No greeting provided") - .build(); - response.status(Http.Status.BAD_REQUEST_400) - .send(jsonErrorObject); - return; - } - - greeting.set(jo.getString("greeting")); - response.status(Http.Status.NO_CONTENT_204).send(); - } - - /** - * Set the greeting to use in future messages. - * - * @param request the server request - * @param response the server response - */ - private void updateGreetingHandler(ServerRequest request, - ServerResponse response) { - updateGreetingFromJson(request.content().as(JsonObject.class), response); - } - -} diff --git a/examples/nima/quickstart-standalone/src/main/java/io/helidon/examples/nima/quickstart/standalone/StandaloneQuickstartMain.java b/examples/nima/quickstart-standalone/src/main/java/io/helidon/examples/nima/quickstart/standalone/StandaloneQuickstartMain.java deleted file mode 100644 index a02c5eee6e9..00000000000 --- a/examples/nima/quickstart-standalone/src/main/java/io/helidon/examples/nima/quickstart/standalone/StandaloneQuickstartMain.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.examples.nima.quickstart.standalone; - -import io.helidon.health.checks.DeadlockHealthCheck; -import io.helidon.health.checks.DiskSpaceHealthCheck; -import io.helidon.health.checks.HeapMemoryHealthCheck; -import io.helidon.logging.common.LogConfig; -import io.helidon.nima.observe.ObserveFeature; -import io.helidon.nima.observe.health.HealthFeature; -import io.helidon.nima.observe.health.HealthObserveProvider; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRouting; - -/** - * The application main class. - */ -public class StandaloneQuickstartMain { - /** - * Cannot be instantiated. - */ - private StandaloneQuickstartMain() { - } - - /** - * Application main entry point. - * - * @param args command line arguments. - */ - public static void main(String[] args) { - // load logging configuration - LogConfig.configureRuntime(); - - WebServer server = WebServer.builder() - .routing(StandaloneQuickstartMain::routing) - .build() - .start(); - - System.out.println("WEB server is up! http://localhost:" + server.port() + "/greet"); - } - - /** - * Updates HTTP Routing. - */ - static void routing(HttpRouting.Builder routing) { - ObserveFeature observe = ObserveFeature.builder() - .useSystemServices(true) - .addProvider(HealthObserveProvider.create(HealthFeature.builder() - .useSystemServices(false) - .addCheck(HeapMemoryHealthCheck.create()) - .addCheck(DiskSpaceHealthCheck.create()) - .addCheck(DeadlockHealthCheck.create()) - .build())) - .build(); - - GreetService greetService = new GreetService(); - - routing.register("/greet", greetService) - .addFeature(observe); - } -} diff --git a/examples/nima/quickstart-standalone/src/main/java/io/helidon/examples/nima/quickstart/standalone/package-info.java b/examples/nima/quickstart-standalone/src/main/java/io/helidon/examples/nima/quickstart/standalone/package-info.java deleted file mode 100644 index 8d885db1760..00000000000 --- a/examples/nima/quickstart-standalone/src/main/java/io/helidon/examples/nima/quickstart/standalone/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Standalone quickstart example. - */ -package io.helidon.examples.nima.quickstart.standalone; diff --git a/examples/nima/quickstart-standalone/src/main/resources/application.yaml b/examples/nima/quickstart-standalone/src/main/resources/application.yaml deleted file mode 100644 index a4b00b628b4..00000000000 --- a/examples/nima/quickstart-standalone/src/main/resources/application.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright (c) 2022 Oracle and/or its affiliates. -# -# 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. -# - -server: - host: "127.0.0.1" - port: 8080 diff --git a/examples/nima/quickstart-standalone/src/main/resources/logging.properties b/examples/nima/quickstart-standalone/src/main/resources/logging.properties deleted file mode 100644 index 3a2ccac5c46..00000000000 --- a/examples/nima/quickstart-standalone/src/main/resources/logging.properties +++ /dev/null @@ -1,20 +0,0 @@ -# -# Copyright (c) 2022 Oracle and/or its affiliates. -# -# 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. -# -handlers=java.util.logging.ConsoleHandler -java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS.%1$tL %5$s%6$s%n -# Global logging level. Can be overridden by specific loggers -.level=INFO -io.helidon.nima.level=INFO diff --git a/examples/nima/quickstart-standalone/src/test/java/io/helidon/examples/nima/quickstart/standalone/AbstractQuickstartTest.java b/examples/nima/quickstart-standalone/src/test/java/io/helidon/examples/nima/quickstart/standalone/AbstractQuickstartTest.java deleted file mode 100644 index d357fdc4a21..00000000000 --- a/examples/nima/quickstart-standalone/src/test/java/io/helidon/examples/nima/quickstart/standalone/AbstractQuickstartTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.examples.nima.quickstart.standalone; - -import io.helidon.common.http.Http; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.http.HttpRouting; - -import jakarta.json.JsonObject; -import org.junit.jupiter.api.Test; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; - -abstract class AbstractQuickstartTest { - private final Http1Client client; - - protected AbstractQuickstartTest(Http1Client client) { - this.client = client; - } - - @SetUpRoute - static void routing(HttpRouting.Builder builder) { - StandaloneQuickstartMain.routing(builder); - } - - @Test - void testRootRoute() { - try (Http1ClientResponse response = client.get("/greet") - .request()) { - - assertThat(response.status(), is(Http.Status.OK_200)); - JsonObject json = response.as(JsonObject.class); - assertThat(json.getString("message"), is("Hello World!")); - } - } - - @Test - void testHealthObserver() { - try (Http1ClientResponse response = client.get("/observe/health").request()) { - assertThat(response.status(), is(Http.Status.NO_CONTENT_204)); - } - } - - @Test - void testDeadlockHealthCheck() { - try (Http1ClientResponse response = client.get("/observe/health/live/deadlock").request()) { - assertThat(response.status(), is(Http.Status.NO_CONTENT_204)); - } - } - -} diff --git a/examples/nima/quickstart-standalone/src/test/java/io/helidon/examples/nima/quickstart/standalone/QuickstartRoutingIT.java b/examples/nima/quickstart-standalone/src/test/java/io/helidon/examples/nima/quickstart/standalone/QuickstartRoutingIT.java deleted file mode 100644 index b20470663fa..00000000000 --- a/examples/nima/quickstart-standalone/src/test/java/io/helidon/examples/nima/quickstart/standalone/QuickstartRoutingIT.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.examples.nima.quickstart.standalone; - -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.webclient.http1.Http1Client; - -@ServerTest -class QuickstartRoutingIT extends AbstractQuickstartTest { - QuickstartRoutingIT(Http1Client client) { - super(client); - } -} diff --git a/examples/nima/quickstart-standalone/src/test/java/io/helidon/examples/nima/quickstart/standalone/QuickstartRoutingTest.java b/examples/nima/quickstart-standalone/src/test/java/io/helidon/examples/nima/quickstart/standalone/QuickstartRoutingTest.java deleted file mode 100644 index 62be3870269..00000000000 --- a/examples/nima/quickstart-standalone/src/test/java/io/helidon/examples/nima/quickstart/standalone/QuickstartRoutingTest.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.examples.nima.quickstart.standalone; - -import io.helidon.nima.testing.junit5.webserver.DirectClient; -import io.helidon.nima.testing.junit5.webserver.RoutingTest; - -@RoutingTest -class QuickstartRoutingTest extends AbstractQuickstartTest { - QuickstartRoutingTest(DirectClient client) { - super(client); - } -} - - diff --git a/examples/nima/quickstart/pom.xml b/examples/nima/quickstart/pom.xml deleted file mode 100644 index db9152450fc..00000000000 --- a/examples/nima/quickstart/pom.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - - 4.0.0 - - io.helidon.applications - helidon-nima - 4.0.0-SNAPSHOT - ../../../applications/nima/pom.xml - - - io.helidon.examples.nima - helidon-nima-examples-quickstart - Helidon Níma Examples Quickstart - - - io.helidon.examples.nima.quickstart.QuickstartMain - - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.webclient - helidon-nima-webclient - - - io.helidon.nima.http2 - helidon-nima-http2-webclient - - - io.helidon.nima.http2 - helidon-nima-http2-webserver - - - io.helidon.nima.http.media - helidon-nima-http-media-jsonp - - - io.helidon.nima.observe - helidon-nima-observe-health - - - io.helidon.config - helidon-config-yaml - - - io.helidon.health - helidon-health-checks - - - jakarta.json - jakarta.json-api - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-libs - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - integration-test - verify - - - - - - - diff --git a/examples/nima/quickstart/src/main/java/io/helidon/examples/nima/quickstart/GreetClientHttp.java b/examples/nima/quickstart/src/main/java/io/helidon/examples/nima/quickstart/GreetClientHttp.java deleted file mode 100644 index 9efb40127c5..00000000000 --- a/examples/nima/quickstart/src/main/java/io/helidon/examples/nima/quickstart/GreetClientHttp.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.examples.nima.quickstart; - -import io.helidon.common.http.Http; -import io.helidon.nima.webclient.api.WebClient; - -/** - * Executable class that invokes HTTP/1 requests against the server. - */ -public class GreetClientHttp { - private GreetClientHttp() { - } - - /** - * Main method. - * - * @param args ignored - */ - public static void main(String[] args) { - WebClient client = WebClient.builder() - .baseUri("http://localhost:8080/greet") - .build(); - - String response = client.method(Http.Method.GET) - .requestEntity(String.class); - - System.out.println(response); - - response = client.get("Nima") - .requestEntity(String.class); - - System.out.println(response); - } -} diff --git a/examples/nima/quickstart/src/main/java/io/helidon/examples/nima/quickstart/GreetClientHttp2.java b/examples/nima/quickstart/src/main/java/io/helidon/examples/nima/quickstart/GreetClientHttp2.java deleted file mode 100644 index fbf8bbcc3bf..00000000000 --- a/examples/nima/quickstart/src/main/java/io/helidon/examples/nima/quickstart/GreetClientHttp2.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.examples.nima.quickstart; - -/** - * Executable class that invokes server using HTTP/2 client. - */ -public class GreetClientHttp2 { - private GreetClientHttp2() { - } - - /** - * Main method. - * - * @param args ignored - */ - public static void main(String[] args) { - // TODO finish HTTP/2 client - throw new UnsupportedOperationException("HTTP/2 client is not yet implemented"); - /* - Http2Client client = WebClient.builder() - .build() - .protocol(Http2.PROTOCOL) - .baseUri("http://localhost:8080/greet") - .priorKnowledge(true); - - String response = client.method(Http.Method.GET) - .request() - .as(String.class); - - System.out.println(response); - - response = client.get("Nima") - .request() - .as(String.class); - - System.out.println(response); - */ - } -} diff --git a/examples/nima/quickstart/src/main/java/io/helidon/examples/nima/quickstart/GreetService.java b/examples/nima/quickstart/src/main/java/io/helidon/examples/nima/quickstart/GreetService.java deleted file mode 100644 index c4e23963f6e..00000000000 --- a/examples/nima/quickstart/src/main/java/io/helidon/examples/nima/quickstart/GreetService.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2018, 2022 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.examples.nima.quickstart; - -import java.util.Collections; -import java.util.concurrent.atomic.AtomicReference; - -import io.helidon.common.http.Http; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; - -import jakarta.json.Json; -import jakarta.json.JsonBuilderFactory; -import jakarta.json.JsonObject; - -/** - * A simple service to greet you. Examples: - *

- * Get default greeting message: - * {@code curl -X GET http://localhost:8080/greet} - *

- * Get greeting message for Joe: - * {@code curl -X GET http://localhost:8080/greet/Joe} - *

- * Change greeting - * {@code curl -X PUT -H "Content-Type: application/json" -d '{"greeting" : "Howdy"}' http://localhost:8080/greet/greeting} - *

- * The message is returned as a JSON object - */ -class GreetService implements HttpService { - - private static final JsonBuilderFactory JSON = Json.createBuilderFactory(Collections.emptyMap()); - - /** - * The config value for the key {@code greeting}. - */ - private final AtomicReference greeting = new AtomicReference<>(); - - GreetService() { - greeting.set("Hello"); - } - - /** - * A service registers itself by updating the routing rules. - * - * @param rules the routing rules. - */ - @Override - public void routing(HttpRules rules) { - rules - .get("/", this::getDefaultMessageHandler) - .get("/{name}", this::getMessageHandler) - .put("/greeting", this::updateGreetingHandler); - } - - /** - * Return a worldly greeting message. - * - * @param request the server request - * @param response the server response - */ - private void getDefaultMessageHandler(ServerRequest request, - ServerResponse response) { - sendResponse(response, "World"); - } - - /** - * Return a greeting message using the name that was provided. - * - * @param request the server request - * @param response the server response - */ - private void getMessageHandler(ServerRequest request, - ServerResponse response) { - String name = request.path().pathParameters().value("name"); - sendResponse(response, name); - } - - private void sendResponse(ServerResponse response, String name) { - String msg = String.format("%s %s!", greeting.get(), name); - - JsonObject returnObject = JSON.createObjectBuilder() - .add("message", msg) - .build(); - response.send(returnObject); - } - - private void updateGreetingFromJson(JsonObject jo, ServerResponse response) { - - if (!jo.containsKey("greeting")) { - JsonObject jsonErrorObject = JSON.createObjectBuilder() - .add("error", "No greeting provided") - .build(); - response.status(Http.Status.BAD_REQUEST_400) - .send(jsonErrorObject); - return; - } - - greeting.set(jo.getString("greeting")); - response.status(Http.Status.NO_CONTENT_204).send(); - } - - /** - * Set the greeting to use in future messages. - * - * @param request the server request - * @param response the server response - */ - private void updateGreetingHandler(ServerRequest request, - ServerResponse response) { - updateGreetingFromJson(request.content().as(JsonObject.class), response); - } - -} diff --git a/examples/nima/quickstart/src/main/java/io/helidon/examples/nima/quickstart/QuickstartMain.java b/examples/nima/quickstart/src/main/java/io/helidon/examples/nima/quickstart/QuickstartMain.java deleted file mode 100644 index 7d59044424f..00000000000 --- a/examples/nima/quickstart/src/main/java/io/helidon/examples/nima/quickstart/QuickstartMain.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.examples.nima.quickstart; - -import io.helidon.health.checks.DeadlockHealthCheck; -import io.helidon.health.checks.DiskSpaceHealthCheck; -import io.helidon.health.checks.HeapMemoryHealthCheck; -import io.helidon.logging.common.LogConfig; -import io.helidon.nima.observe.ObserveFeature; -import io.helidon.nima.observe.health.HealthFeature; -import io.helidon.nima.observe.health.HealthObserveProvider; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRouting; - -/** - * The application main class. - */ -public class QuickstartMain { - /** - * Cannot be instantiated. - */ - private QuickstartMain() { - } - - /** - * Application main entry point. - * - * @param args command line arguments. - */ - public static void main(String[] args) { - // load logging configuration - LogConfig.configureRuntime(); - - WebServer server = WebServer.builder() - .routing(QuickstartMain::routing) - .build() - .start(); - - System.out.println("WEB server is up! http://localhost:" + server.port() + "/greet"); - } - - /** - * Updates HTTP Routing. - */ - static void routing(HttpRouting.Builder routing) { - ObserveFeature observe = ObserveFeature.builder() - .useSystemServices(false) - .addProvider(HealthObserveProvider.create(HealthFeature.builder() - .useSystemServices(false) - .addCheck(HeapMemoryHealthCheck.create()) - .addCheck(DiskSpaceHealthCheck.create()) - .addCheck(DeadlockHealthCheck.create()) - .build())) - .build(); - - GreetService greetService = new GreetService(); - - routing.register("/greet", greetService) - .addFeature(observe); - } -} diff --git a/examples/nima/quickstart/src/main/java/io/helidon/examples/nima/quickstart/package-info.java b/examples/nima/quickstart/src/main/java/io/helidon/examples/nima/quickstart/package-info.java deleted file mode 100644 index 7639cc1e929..00000000000 --- a/examples/nima/quickstart/src/main/java/io/helidon/examples/nima/quickstart/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Standalone quickstart example. - */ -package io.helidon.examples.nima.quickstart; diff --git a/examples/nima/quickstart/src/main/resources/application.yaml b/examples/nima/quickstart/src/main/resources/application.yaml deleted file mode 100644 index a4b00b628b4..00000000000 --- a/examples/nima/quickstart/src/main/resources/application.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright (c) 2022 Oracle and/or its affiliates. -# -# 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. -# - -server: - host: "127.0.0.1" - port: 8080 diff --git a/examples/nima/quickstart/src/main/resources/logging.properties b/examples/nima/quickstart/src/main/resources/logging.properties deleted file mode 100644 index 3a2ccac5c46..00000000000 --- a/examples/nima/quickstart/src/main/resources/logging.properties +++ /dev/null @@ -1,20 +0,0 @@ -# -# Copyright (c) 2022 Oracle and/or its affiliates. -# -# 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. -# -handlers=java.util.logging.ConsoleHandler -java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS.%1$tL %5$s%6$s%n -# Global logging level. Can be overridden by specific loggers -.level=INFO -io.helidon.nima.level=INFO diff --git a/examples/nima/quickstart/src/test/java/io/helidon/examples/nima/quickstart/AbstractQuickstartTest.java b/examples/nima/quickstart/src/test/java/io/helidon/examples/nima/quickstart/AbstractQuickstartTest.java deleted file mode 100644 index 43ebcb86f20..00000000000 --- a/examples/nima/quickstart/src/test/java/io/helidon/examples/nima/quickstart/AbstractQuickstartTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.examples.nima.quickstart; - -import io.helidon.common.http.Http; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.http.HttpRouting; - -import jakarta.json.JsonObject; -import org.junit.jupiter.api.Test; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; - -abstract class AbstractQuickstartTest { - private final Http1Client client; - - protected AbstractQuickstartTest(Http1Client client) { - this.client = client; - } - - @SetUpRoute - static void routing(HttpRouting.Builder builder) { - QuickstartMain.routing(builder); - } - - @Test - void testRootRoute() { - try (Http1ClientResponse response = client.get("/greet") - .request()) { - - assertThat(response.status(), is(Http.Status.OK_200)); - JsonObject json = response.as(JsonObject.class); - assertThat(json.getString("message"), is("Hello World!")); - } - } - - @Test - void testHealthObserver() { - try (Http1ClientResponse response = client.get("/observe/health").request()) { - assertThat(response.status(), is(Http.Status.NO_CONTENT_204)); - } - } - - @Test - void testDeadlockHealthCheck() { - try (Http1ClientResponse response = client.get("/observe/health/live/deadlock").request()) { - assertThat(response.status(), is(Http.Status.NO_CONTENT_204)); - } - } - -} diff --git a/examples/nima/quickstart/src/test/java/io/helidon/examples/nima/quickstart/QuickstartRoutingIT.java b/examples/nima/quickstart/src/test/java/io/helidon/examples/nima/quickstart/QuickstartRoutingIT.java deleted file mode 100644 index ecb6796bbb2..00000000000 --- a/examples/nima/quickstart/src/test/java/io/helidon/examples/nima/quickstart/QuickstartRoutingIT.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.examples.nima.quickstart; - -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.webclient.http1.Http1Client; - -@ServerTest -class QuickstartRoutingIT extends AbstractQuickstartTest { - QuickstartRoutingIT(Http1Client client) { - super(client); - } -} diff --git a/examples/nima/quickstart/src/test/java/io/helidon/examples/nima/quickstart/QuickstartRoutingTest.java b/examples/nima/quickstart/src/test/java/io/helidon/examples/nima/quickstart/QuickstartRoutingTest.java deleted file mode 100644 index c1899da0a6f..00000000000 --- a/examples/nima/quickstart/src/test/java/io/helidon/examples/nima/quickstart/QuickstartRoutingTest.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.examples.nima.quickstart; - -import io.helidon.nima.testing.junit5.webserver.DirectClient; -import io.helidon.nima.testing.junit5.webserver.RoutingTest; - -@RoutingTest -class QuickstartRoutingTest extends AbstractQuickstartTest { - QuickstartRoutingTest(DirectClient client) { - super(client); - } -} - - diff --git a/examples/nima/quickstart/src/test/resources/logging-test.properties b/examples/nima/quickstart/src/test/resources/logging-test.properties deleted file mode 100644 index d3360e3eaa2..00000000000 --- a/examples/nima/quickstart/src/test/resources/logging-test.properties +++ /dev/null @@ -1,22 +0,0 @@ -# -# Copyright (c) 2022 Oracle and/or its affiliates. -# -# 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. -# -handlers=java.util.logging.ConsoleHandler -java.util.logging.ConsoleHandler.level=FINEST -java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter -# java.util.logging.SimpleFormatter.format = [%1$tc] %5$s %6$s%n -java.util.logging.SimpleFormatter.format=%1$tH:%1$tM:%1$tS %5$s%6$s%n -# Global logging level. Can be overridden by specific loggers -.level=WARNING diff --git a/examples/nima/static-content/pom.xml b/examples/nima/static-content/pom.xml deleted file mode 100644 index 40afe601091..00000000000 --- a/examples/nima/static-content/pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - 4.0.0 - - io.helidon.applications - helidon-nima - 4.0.0-SNAPSHOT - ../../../applications/nima/pom.xml - - - io.helidon.examples.nima - helidon-nima-examples-staticcontent - Helidon Níma Examples Static Content - - - io.helidon.examples.nima.staticcontent.StaticContentMain - - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.webserver - helidon-nima-webserver-static-content - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-libs - - - - - - diff --git a/examples/nima/static-content/src/main/java/io/helidon/examples/nima/staticcontent/StaticContentMain.java b/examples/nima/static-content/src/main/java/io/helidon/examples/nima/staticcontent/StaticContentMain.java deleted file mode 100644 index 68e1c4f02fe..00000000000 --- a/examples/nima/static-content/src/main/java/io/helidon/examples/nima/staticcontent/StaticContentMain.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.examples.nima.staticcontent; - -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.staticcontent.StaticContentService; - -/** - * Static content example. - */ -public class StaticContentMain { - private StaticContentMain() { - } - - /** - * Main methods. - * - * @param args ignored - */ - public static void main(String[] args) { - WebServer.builder() - .host("127.0.0.1") - .port(8080) - .routing(StaticContentMain::routing) - .build() - .start(); - System.out.println("You can access static content on http://localhost:8080/favicon.ico"); - System.out.println("You can access static endpoint on http://localhost:8080/api/greet"); - } - - static void routing(HttpRouting.Builder routing) { - // register static content on root path of the server - // use classpath /web to look for resources - routing.register("/", StaticContentService.builder("web")) - .get("/api/greet", (req, res) -> res.send("Hello World!")); - } -} - diff --git a/examples/nima/static-content/src/main/java/io/helidon/examples/nima/staticcontent/package-info.java b/examples/nima/static-content/src/main/java/io/helidon/examples/nima/staticcontent/package-info.java deleted file mode 100644 index eee4d8befbf..00000000000 --- a/examples/nima/static-content/src/main/java/io/helidon/examples/nima/staticcontent/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Static content example. Uses static content from classpath. - */ -package io.helidon.examples.nima.staticcontent; diff --git a/examples/nima/tracing/pom.xml b/examples/nima/tracing/pom.xml deleted file mode 100644 index 86e1d0a7632..00000000000 --- a/examples/nima/tracing/pom.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - 4.0.0 - - io.helidon.applications - helidon-nima - 4.0.0-SNAPSHOT - ../../../applications/nima/pom.xml - - - io.helidon.examples.nima - helidon-nima-examples-tracing - Helidon Níma Examples Tracing - - - io.helidon.examples.nima.tracing.TracingMain - - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.http2 - helidon-nima-http2-webserver - - - io.helidon.nima.webserver - helidon-nima-webserver-tracing - - - io.helidon.nima.webclient - helidon-nima-webclient - - - io.helidon.nima.webclient - helidon-nima-webclient-tracing - - - io.helidon.tracing.providers - helidon-tracing-providers-jaeger - - - io.helidon.config - helidon-config-yaml - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-libs - - - - - - diff --git a/examples/nima/tracing/src/main/java/io/helidon/examples/nima/tracing/package-info.java b/examples/nima/tracing/src/main/java/io/helidon/examples/nima/tracing/package-info.java deleted file mode 100644 index 6b72b1d1b75..00000000000 --- a/examples/nima/tracing/src/main/java/io/helidon/examples/nima/tracing/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Tracing example. - */ -package io.helidon.examples.nima.tracing; diff --git a/examples/nima/tracing/src/main/resources/application.yaml b/examples/nima/tracing/src/main/resources/application.yaml deleted file mode 100644 index b9ae3e22db1..00000000000 --- a/examples/nima/tracing/src/main/resources/application.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# -# Copyright (c) 2022 Oracle and/or its affiliates. -# -# 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. -# - -tracing: - service: "helidon-server" - sampler-type: "const" - sampler-param: 1 \ No newline at end of file diff --git a/examples/nima/tracing/src/main/resources/logging.properties b/examples/nima/tracing/src/main/resources/logging.properties deleted file mode 100644 index 3a2ccac5c46..00000000000 --- a/examples/nima/tracing/src/main/resources/logging.properties +++ /dev/null @@ -1,20 +0,0 @@ -# -# Copyright (c) 2022 Oracle and/or its affiliates. -# -# 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. -# -handlers=java.util.logging.ConsoleHandler -java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS.%1$tL %5$s%6$s%n -# Global logging level. Can be overridden by specific loggers -.level=INFO -io.helidon.nima.level=INFO diff --git a/examples/openapi-tools/pom.xml b/examples/openapi-tools/pom.xml index cc7e8c56605..664fd17670f 100644 --- a/examples/openapi-tools/pom.xml +++ b/examples/openapi-tools/pom.xml @@ -29,7 +29,7 @@ pom io.helidon.examples.openapi.tools helidon-examples-openapi-tools-project - Helidon OpenApi Tools Examples + Helidon Examples OpenApi Tools diff --git a/examples/openapi/pom.xml b/examples/openapi/pom.xml index 8f2a18102d7..d39d96915fa 100644 --- a/examples/openapi/pom.xml +++ b/examples/openapi/pom.xml @@ -48,20 +48,20 @@ - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.nima.http.media - helidon-nima-http-media-jsonp + io.helidon.http.media + helidon-http-media-jsonp - io.helidon.nima.observe - helidon-nima-observe-health + io.helidon.webserver.observe + helidon-webserver-observe-health - io.helidon.nima.observe - helidon-nima-observe-metrics + io.helidon.webserver.observe + helidon-webserver-observe-metrics io.helidon.metrics @@ -89,13 +89,13 @@ test - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test - io.helidon.nima.webclient - helidon-nima-webclient + io.helidon.webclient + helidon-webclient test diff --git a/examples/openapi/src/main/java/io/helidon/examples/openapi/GreetService.java b/examples/openapi/src/main/java/io/helidon/examples/openapi/GreetService.java index c44d3572171..6fb9eff26fd 100644 --- a/examples/openapi/src/main/java/io/helidon/examples/openapi/GreetService.java +++ b/examples/openapi/src/main/java/io/helidon/examples/openapi/GreetService.java @@ -18,12 +18,12 @@ import java.util.Map; -import io.helidon.common.http.Http; import io.helidon.config.Config; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.Http; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import jakarta.json.Json; import jakarta.json.JsonBuilderFactory; diff --git a/examples/openapi/src/main/java/io/helidon/examples/openapi/Main.java b/examples/openapi/src/main/java/io/helidon/examples/openapi/Main.java index 5b181f95443..e3cb960487e 100644 --- a/examples/openapi/src/main/java/io/helidon/examples/openapi/Main.java +++ b/examples/openapi/src/main/java/io/helidon/examples/openapi/Main.java @@ -18,11 +18,11 @@ import io.helidon.config.Config; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.observe.ObserveFeature; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.http.HttpRouting; import io.helidon.openapi.OpenApiFeature; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.observe.ObserveFeature; /** * Simple Hello World rest application. diff --git a/examples/openapi/src/main/resources/logging.properties b/examples/openapi/src/main/resources/logging.properties index b41579b07df..c0b8486695d 100644 --- a/examples/openapi/src/main/resources/logging.properties +++ b/examples/openapi/src/main/resources/logging.properties @@ -27,7 +27,7 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ .level=INFO # Component specific log levels -#io.helidon.nima.webserver.level=INFO +#io.helidon.webserver.level=INFO #io.helidon.config.level=INFO #io.helidon.security.level=INFO #io.helidon.common.level=INFO diff --git a/examples/openapi/src/test/java/io/helidon/examples/openapi/MainTest.java b/examples/openapi/src/test/java/io/helidon/examples/openapi/MainTest.java index efced9bf3eb..fbed258d3e7 100644 --- a/examples/openapi/src/test/java/io/helidon/examples/openapi/MainTest.java +++ b/examples/openapi/src/test/java/io/helidon/examples/openapi/MainTest.java @@ -18,14 +18,14 @@ import java.util.Map; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.common.media.type.MediaTypes; import io.helidon.examples.openapi.internal.SimpleAPIModelReader; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.WebServerConfig; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.WebServerConfig; import jakarta.json.Json; import jakarta.json.JsonBuilderFactory; diff --git a/examples/pom.xml b/examples/pom.xml index b946f2e25e4..fe4adbd9d43 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -41,28 +41,28 @@ config + cors + dbclient + employee-app + fault-tolerance graphql health - quickstarts - microprofile + integrations + inject + jbatch + logging media + messaging + metrics + microprofile openapi openapi-tools + quickstarts security todo-app translator-app - webserver - integrations - employee-app - dbclient webclient - cors - messaging - logging - metrics - jbatch - nima - inject + webserver diff --git a/examples/quickstarts/README.md b/examples/quickstarts/README.md index 33b80c93b54..83f2f7d6eec 100644 --- a/examples/quickstarts/README.md +++ b/examples/quickstarts/README.md @@ -1,4 +1,4 @@ -# Helidon Quickstart Examples +# Helidon Examples Quickstart These are the examples used by the Helidon Getting Started guide, and the quickstart Maven archetypes. All examples implement the same diff --git a/examples/quickstarts/helidon-quickstart-mp/pom.xml b/examples/quickstarts/helidon-quickstart-mp/pom.xml index e214a8b1100..4d31166d077 100644 --- a/examples/quickstarts/helidon-quickstart-mp/pom.xml +++ b/examples/quickstarts/helidon-quickstart-mp/pom.xml @@ -29,7 +29,7 @@ io.helidon.examples helidon-quickstart-mp - Helidon Quickstart MP Example + Helidon Examples Quickstart MP diff --git a/examples/quickstarts/helidon-quickstart-mp/src/main/resources/logging.properties b/examples/quickstarts/helidon-quickstart-mp/src/main/resources/logging.properties index 64bcc6ce960..da1998a9d36 100644 --- a/examples/quickstarts/helidon-quickstart-mp/src/main/resources/logging.properties +++ b/examples/quickstarts/helidon-quickstart-mp/src/main/resources/logging.properties @@ -30,7 +30,7 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ org.jboss.level=WARNING # Component specific log levels -#io.helidon.nima.webserver.level=INFO +#io.helidon.webserver.level=INFO #io.helidon.config.level=INFO #io.helidon.security.level=INFO #io.helidon.microprofile.level=INFO diff --git a/examples/quickstarts/helidon-quickstart-se/build.gradle b/examples/quickstarts/helidon-quickstart-se/build.gradle index d019d9b8233..8de33e9e1a7 100644 --- a/examples/quickstarts/helidon-quickstart-se/build.gradle +++ b/examples/quickstarts/helidon-quickstart-se/build.gradle @@ -47,15 +47,15 @@ repositories { dependencies { // import Helidon BOM implementation enforcedPlatform("io.helidon:helidon-dependencies:${project.helidonversion}") - implementation 'io.helidon.nima.webserver:helidon-nima-webserver' - implementation 'io.helidon.nima.http.media:helidon-nima-http-media-jsonp' - implementation 'io.helidon.nima.observe:helidon-nima-observe-health' + implementation 'io.helidon.webserver:helidon-webserver' + implementation 'io.helidon.http.media:helidon-http-media-jsonp' + implementation 'io.helidon.webserver.observe:helidon-observe-health' implementation 'io.helidon.config:helidon-config-yaml' implementation 'io.helidon.health:helidon-health-checks' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' - testImplementation 'io.helidon.nima.testing.junit5:helidon-nima-testing-junit5-webserver' - testImplementation 'io.helidon.nima.webclient:helidon-nima-webclient' + testImplementation 'io.helidon.webserver.testing.junit5:helidon-webserver-testing-junit5' + testImplementation 'io.helidon.webclient:helidon-webclient' testImplementation 'org.hamcrest:hamcrest-all' } diff --git a/examples/quickstarts/helidon-quickstart-se/pom.xml b/examples/quickstarts/helidon-quickstart-se/pom.xml index be5296bba47..aeb93222cca 100644 --- a/examples/quickstarts/helidon-quickstart-se/pom.xml +++ b/examples/quickstarts/helidon-quickstart-se/pom.xml @@ -30,7 +30,7 @@ io.helidon.examples helidon-quickstart-se 4.0.0-SNAPSHOT - Helidon Quickstart SE Example + Helidon Examples Quickstart SE io.helidon.examples.quickstart.se.Main @@ -38,20 +38,20 @@ - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.nima.http.media - helidon-nima-http-media-jsonp + io.helidon.http.media + helidon-http-media-jsonp - io.helidon.nima.observe - helidon-nima-observe-health + io.helidon.webserver.observe + helidon-webserver-observe-health - io.helidon.nima.observe - helidon-nima-observe-metrics + io.helidon.webserver.observe + helidon-webserver-observe-metrics io.helidon.metrics @@ -79,13 +79,13 @@ test - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test - io.helidon.nima.webclient - helidon-nima-webclient + io.helidon.webclient + helidon-webclient test diff --git a/examples/quickstarts/helidon-quickstart-se/src/main/java/io/helidon/examples/quickstart/se/GreetService.java b/examples/quickstarts/helidon-quickstart-se/src/main/java/io/helidon/examples/quickstart/se/GreetService.java index 26ec5df3aad..5aad051edbe 100644 --- a/examples/quickstarts/helidon-quickstart-se/src/main/java/io/helidon/examples/quickstart/se/GreetService.java +++ b/examples/quickstarts/helidon-quickstart-se/src/main/java/io/helidon/examples/quickstart/se/GreetService.java @@ -19,11 +19,11 @@ import java.util.Collections; import java.util.concurrent.atomic.AtomicReference; -import io.helidon.common.http.Http; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.Http; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import jakarta.json.Json; import jakarta.json.JsonBuilderFactory; diff --git a/examples/quickstarts/helidon-quickstart-se/src/main/java/io/helidon/examples/quickstart/se/Main.java b/examples/quickstarts/helidon-quickstart-se/src/main/java/io/helidon/examples/quickstart/se/Main.java index d11ab6ebb0f..ea1dc5e31e3 100644 --- a/examples/quickstarts/helidon-quickstart-se/src/main/java/io/helidon/examples/quickstart/se/Main.java +++ b/examples/quickstarts/helidon-quickstart-se/src/main/java/io/helidon/examples/quickstart/se/Main.java @@ -17,10 +17,10 @@ package io.helidon.examples.quickstart.se; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.observe.ObserveFeature; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRouting; import io.helidon.openapi.OpenApiFeature; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.observe.ObserveFeature; /** * The application main class. diff --git a/examples/quickstarts/helidon-quickstart-se/src/main/resources/logging.properties b/examples/quickstarts/helidon-quickstart-se/src/main/resources/logging.properties index b761cfd92e6..175767778e7 100644 --- a/examples/quickstarts/helidon-quickstart-se/src/main/resources/logging.properties +++ b/examples/quickstarts/helidon-quickstart-se/src/main/resources/logging.properties @@ -19,4 +19,4 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS.%1$ # Global logging level. Can be overridden by specific loggers .level=INFO -io.helidon.nima.level=INFO +io.helidon.level=INFO diff --git a/examples/quickstarts/helidon-quickstart-se/src/test/java/io/helidon/examples/quickstart/se/MainTest.java b/examples/quickstarts/helidon-quickstart-se/src/test/java/io/helidon/examples/quickstart/se/MainTest.java index 30d3415cb35..52cf71d2aa7 100644 --- a/examples/quickstarts/helidon-quickstart-se/src/test/java/io/helidon/examples/quickstart/se/MainTest.java +++ b/examples/quickstarts/helidon-quickstart-se/src/test/java/io/helidon/examples/quickstart/se/MainTest.java @@ -16,12 +16,12 @@ package io.helidon.examples.quickstart.se; -import io.helidon.common.http.Http; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.http.Http; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.http.HttpRouting; import jakarta.json.JsonObject; import org.junit.jupiter.api.Test; diff --git a/examples/quickstarts/helidon-standalone-quickstart-mp/README.md b/examples/quickstarts/helidon-standalone-quickstart-mp/README.md index 5a7d5c00cf2..f0d0ad8e4e7 100644 --- a/examples/quickstarts/helidon-standalone-quickstart-mp/README.md +++ b/examples/quickstarts/helidon-standalone-quickstart-mp/README.md @@ -1,4 +1,4 @@ -# Helidon Standalone Quickstart MP Example +# Helidon Examples Standalone Quickstart MP This example implements a simple Hello World REST service using MicroProfile with a standalone Maven pom. diff --git a/examples/quickstarts/helidon-standalone-quickstart-mp/pom.xml b/examples/quickstarts/helidon-standalone-quickstart-mp/pom.xml index ab7d4a2eaac..4daa728610f 100644 --- a/examples/quickstarts/helidon-standalone-quickstart-mp/pom.xml +++ b/examples/quickstarts/helidon-standalone-quickstart-mp/pom.xml @@ -23,7 +23,7 @@ io.helidon.examples.quickstarts helidon-standalone-quickstart-mp 4.0.0-SNAPSHOT - Helidon Standalone Quickstart MP Example + Helidon Examples Standalone Quickstart MP 4.0.0-SNAPSHOT diff --git a/examples/quickstarts/helidon-standalone-quickstart-mp/src/main/resources/logging.properties b/examples/quickstarts/helidon-standalone-quickstart-mp/src/main/resources/logging.properties index 0c4c6e54932..7b5bc371f29 100644 --- a/examples/quickstarts/helidon-standalone-quickstart-mp/src/main/resources/logging.properties +++ b/examples/quickstarts/helidon-standalone-quickstart-mp/src/main/resources/logging.properties @@ -31,7 +31,7 @@ org.jboss.level=WARNING # # Component specific log levels -#io.helidon.nima.webserver.level=INFO +#io.helidon.webserver.level=INFO #io.helidon.config.level=INFO #io.helidon.security.level=INFO #io.helidon.microprofile.level=INFO diff --git a/examples/quickstarts/helidon-standalone-quickstart-se/README.md b/examples/quickstarts/helidon-standalone-quickstart-se/README.md index 08887994d89..708fea5f8e4 100644 --- a/examples/quickstarts/helidon-standalone-quickstart-se/README.md +++ b/examples/quickstarts/helidon-standalone-quickstart-se/README.md @@ -1,4 +1,4 @@ -# Helidon Standalone Quickstart SE Example +# Helidon Examples Standalone Quickstart SE This project implements a simple Hello World REST service using Helidon SE with a standalone Maven pom. diff --git a/examples/quickstarts/helidon-standalone-quickstart-se/pom.xml b/examples/quickstarts/helidon-standalone-quickstart-se/pom.xml index acbb8f6f524..63de209661f 100644 --- a/examples/quickstarts/helidon-standalone-quickstart-se/pom.xml +++ b/examples/quickstarts/helidon-standalone-quickstart-se/pom.xml @@ -24,7 +24,7 @@ io.helidon.examples.quickstarts helidon-standalone-quickstart-se 4.0.0-SNAPSHOT - Helidon Standalone Quickstart SE Example + Helidon Examples Standalone Quickstart SE 4.0.0-SNAPSHOT @@ -64,20 +64,20 @@ - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.nima.http.media - helidon-nima-http-media-jsonp + io.helidon.http.media + helidon-http-media-jsonp - io.helidon.nima.observe - helidon-nima-observe-health + io.helidon.webserver.observe + helidon-webserver-observe-health - io.helidon.nima.observe - helidon-nima-observe-metrics + io.helidon.webserver.observe + helidon-webserver-observe-metrics io.helidon.metrics @@ -101,13 +101,13 @@ test - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test - io.helidon.nima.webclient - helidon-nima-webclient + io.helidon.webclient + helidon-webclient test diff --git a/examples/quickstarts/helidon-standalone-quickstart-se/src/main/java/io/helidon/examples/quickstart/se/GreetService.java b/examples/quickstarts/helidon-standalone-quickstart-se/src/main/java/io/helidon/examples/quickstart/se/GreetService.java index 26ec5df3aad..5aad051edbe 100644 --- a/examples/quickstarts/helidon-standalone-quickstart-se/src/main/java/io/helidon/examples/quickstart/se/GreetService.java +++ b/examples/quickstarts/helidon-standalone-quickstart-se/src/main/java/io/helidon/examples/quickstart/se/GreetService.java @@ -19,11 +19,11 @@ import java.util.Collections; import java.util.concurrent.atomic.AtomicReference; -import io.helidon.common.http.Http; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.Http; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import jakarta.json.Json; import jakarta.json.JsonBuilderFactory; diff --git a/examples/quickstarts/helidon-standalone-quickstart-se/src/main/java/io/helidon/examples/quickstart/se/Main.java b/examples/quickstarts/helidon-standalone-quickstart-se/src/main/java/io/helidon/examples/quickstart/se/Main.java index 923af659af6..fb1809677bb 100644 --- a/examples/quickstarts/helidon-standalone-quickstart-se/src/main/java/io/helidon/examples/quickstart/se/Main.java +++ b/examples/quickstarts/helidon-standalone-quickstart-se/src/main/java/io/helidon/examples/quickstart/se/Main.java @@ -17,9 +17,9 @@ package io.helidon.examples.quickstart.se; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.observe.ObserveFeature; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.observe.ObserveFeature; /** * The application main class. diff --git a/examples/quickstarts/helidon-standalone-quickstart-se/src/main/resources/logging.properties b/examples/quickstarts/helidon-standalone-quickstart-se/src/main/resources/logging.properties index b761cfd92e6..175767778e7 100644 --- a/examples/quickstarts/helidon-standalone-quickstart-se/src/main/resources/logging.properties +++ b/examples/quickstarts/helidon-standalone-quickstart-se/src/main/resources/logging.properties @@ -19,4 +19,4 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS.%1$ # Global logging level. Can be overridden by specific loggers .level=INFO -io.helidon.nima.level=INFO +io.helidon.level=INFO diff --git a/examples/quickstarts/helidon-standalone-quickstart-se/src/test/java/io/helidon/examples/quickstart/se/MainTest.java b/examples/quickstarts/helidon-standalone-quickstart-se/src/test/java/io/helidon/examples/quickstart/se/MainTest.java index ad546580caa..3d33b31ed54 100644 --- a/examples/quickstarts/helidon-standalone-quickstart-se/src/test/java/io/helidon/examples/quickstart/se/MainTest.java +++ b/examples/quickstarts/helidon-standalone-quickstart-se/src/test/java/io/helidon/examples/quickstart/se/MainTest.java @@ -16,12 +16,12 @@ package io.helidon.examples.quickstart.se; -import io.helidon.common.http.Http; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.http.Http; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.http.HttpRouting; import jakarta.json.JsonObject; import org.junit.jupiter.api.Test; diff --git a/examples/quickstarts/pom.xml b/examples/quickstarts/pom.xml index 0a5d34d9530..ca67dfe3831 100644 --- a/examples/quickstarts/pom.xml +++ b/examples/quickstarts/pom.xml @@ -27,7 +27,7 @@ io.helidon.examples.quickstarts examples-quickstarts-project - Helidon Quickstart Examples + Helidon Examples Quickstart pom diff --git a/examples/security/attribute-based-access-control/pom.xml b/examples/security/attribute-based-access-control/pom.xml index b569ba3be76..f751d29c92d 100644 --- a/examples/security/attribute-based-access-control/pom.xml +++ b/examples/security/attribute-based-access-control/pom.xml @@ -29,14 +29,14 @@ io.helidon.examples.security helidon-examples-security-abac - Helidon Security Examples ABAC + Helidon Examples Security ABAC Example of attribute based access control. - io.helidon.security.examples.abac.AbacJerseyMain + io.helidon.examples.security.abac.AbacJerseyMain diff --git a/examples/security/attribute-based-access-control/src/main/java/io/helidon/security/examples/abac/AbacApplication.java b/examples/security/attribute-based-access-control/src/main/java/io/helidon/examples/security/abac/AbacApplication.java similarity index 90% rename from examples/security/attribute-based-access-control/src/main/java/io/helidon/security/examples/abac/AbacApplication.java rename to examples/security/attribute-based-access-control/src/main/java/io/helidon/examples/security/abac/AbacApplication.java index 47ea7961ee9..69e7ab95b28 100644 --- a/examples/security/attribute-based-access-control/src/main/java/io/helidon/security/examples/abac/AbacApplication.java +++ b/examples/security/attribute-based-access-control/src/main/java/io/helidon/examples/security/abac/AbacApplication.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021 Oracle and/or its affiliates. + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.security.examples.abac; +package io.helidon.examples.security.abac; import java.util.Set; diff --git a/examples/security/attribute-based-access-control/src/main/java/io/helidon/security/examples/abac/AbacExplicitResource.java b/examples/security/attribute-based-access-control/src/main/java/io/helidon/examples/security/abac/AbacExplicitResource.java similarity index 97% rename from examples/security/attribute-based-access-control/src/main/java/io/helidon/security/examples/abac/AbacExplicitResource.java rename to examples/security/attribute-based-access-control/src/main/java/io/helidon/examples/security/abac/AbacExplicitResource.java index 5e9120745fa..313d2c32934 100644 --- a/examples/security/attribute-based-access-control/src/main/java/io/helidon/security/examples/abac/AbacExplicitResource.java +++ b/examples/security/attribute-based-access-control/src/main/java/io/helidon/examples/security/abac/AbacExplicitResource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021 Oracle and/or its affiliates. + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.security.examples.abac; +package io.helidon.examples.security.abac; import java.time.DayOfWeek; diff --git a/examples/security/attribute-based-access-control/src/main/java/io/helidon/security/examples/abac/AbacJerseyMain.java b/examples/security/attribute-based-access-control/src/main/java/io/helidon/examples/security/abac/AbacJerseyMain.java similarity index 95% rename from examples/security/attribute-based-access-control/src/main/java/io/helidon/security/examples/abac/AbacJerseyMain.java rename to examples/security/attribute-based-access-control/src/main/java/io/helidon/examples/security/abac/AbacJerseyMain.java index 9536c13bd0a..b1d9aa7ba09 100644 --- a/examples/security/attribute-based-access-control/src/main/java/io/helidon/security/examples/abac/AbacJerseyMain.java +++ b/examples/security/attribute-based-access-control/src/main/java/io/helidon/examples/security/abac/AbacJerseyMain.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021 Oracle and/or its affiliates. + * Copyright (c) 2018, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.security.examples.abac; +package io.helidon.examples.security.abac; import io.helidon.config.Config; import io.helidon.microprofile.server.Server; diff --git a/examples/security/attribute-based-access-control/src/main/java/io/helidon/security/examples/abac/AbacResource.java b/examples/security/attribute-based-access-control/src/main/java/io/helidon/examples/security/abac/AbacResource.java similarity index 96% rename from examples/security/attribute-based-access-control/src/main/java/io/helidon/security/examples/abac/AbacResource.java rename to examples/security/attribute-based-access-control/src/main/java/io/helidon/examples/security/abac/AbacResource.java index 475509cc86f..50bc7dbf97e 100644 --- a/examples/security/attribute-based-access-control/src/main/java/io/helidon/security/examples/abac/AbacResource.java +++ b/examples/security/attribute-based-access-control/src/main/java/io/helidon/examples/security/abac/AbacResource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021 Oracle and/or its affiliates. + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.security.examples.abac; +package io.helidon.examples.security.abac; import java.time.DayOfWeek; diff --git a/examples/security/attribute-based-access-control/src/main/java/io/helidon/security/examples/abac/AtnProvider.java b/examples/security/attribute-based-access-control/src/main/java/io/helidon/examples/security/abac/AtnProvider.java similarity index 99% rename from examples/security/attribute-based-access-control/src/main/java/io/helidon/security/examples/abac/AtnProvider.java rename to examples/security/attribute-based-access-control/src/main/java/io/helidon/examples/security/abac/AtnProvider.java index ca2ab9e8747..bd3a34df0f6 100644 --- a/examples/security/attribute-based-access-control/src/main/java/io/helidon/security/examples/abac/AtnProvider.java +++ b/examples/security/attribute-based-access-control/src/main/java/io/helidon/examples/security/abac/AtnProvider.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.security.examples.abac; +package io.helidon.examples.security.abac; import java.lang.annotation.Annotation; import java.lang.annotation.Documented; diff --git a/examples/security/attribute-based-access-control/src/main/java/io/helidon/examples/security/abac/package-info.java b/examples/security/attribute-based-access-control/src/main/java/io/helidon/examples/security/abac/package-info.java new file mode 100644 index 00000000000..19f2fcbcb69 --- /dev/null +++ b/examples/security/attribute-based-access-control/src/main/java/io/helidon/examples/security/abac/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2018, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Example of Attribute based access control (ABAC). + */ +package io.helidon.examples.security.abac; diff --git a/examples/security/attribute-based-access-control/src/main/java/io/helidon/security/examples/abac/package-info.java b/examples/security/attribute-based-access-control/src/main/java/io/helidon/security/examples/abac/package-info.java deleted file mode 100644 index 34c99f05d42..00000000000 --- a/examples/security/attribute-based-access-control/src/main/java/io/helidon/security/examples/abac/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2018, 2021 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Example of Attribute based access control (ABAC). - */ -package io.helidon.security.examples.abac; diff --git a/examples/security/basic-auth-with-static-content/pom.xml b/examples/security/basic-auth-with-static-content/pom.xml index 9ae3d147131..093608d606c 100644 --- a/examples/security/basic-auth-with-static-content/pom.xml +++ b/examples/security/basic-auth-with-static-content/pom.xml @@ -29,7 +29,7 @@ io.helidon.examples.security helidon-examples-security-webserver-basic-auth - Helidon Security Examples HTTP Basic Authentication with Static Content + Helidon Examples Security HTTP Basic Auth with Static Content This example demonstrates Integration of Web Server based application with Security component, HTTP Basic @@ -37,13 +37,13 @@ - io.helidon.security.examples.webserver.basic.BasicExampleConfigMain + io.helidon.examples.security.basicauth.BasicExampleConfigMain - io.helidon.security.integration - helidon-security-integration-nima + io.helidon.webserver + helidon-webserver-security io.helidon.config @@ -54,12 +54,12 @@ helidon-security-providers-http-auth - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.nima.webserver - helidon-nima-webserver-static-content + io.helidon.webserver + helidon-webserver-static-content io.helidon.config @@ -70,13 +70,13 @@ helidon-config-yaml - io.helidon.nima.webclient - helidon-nima-webclient-security + io.helidon.webclient + helidon-webclient-security test - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test diff --git a/examples/security/basic-auth-with-static-content/src/main/java/io/helidon/security/examples/webserver/basic/BasicExampleBuilderMain.java b/examples/security/basic-auth-with-static-content/src/main/java/io/helidon/examples/security/basicauth/BasicExampleBuilderMain.java similarity index 93% rename from examples/security/basic-auth-with-static-content/src/main/java/io/helidon/security/examples/webserver/basic/BasicExampleBuilderMain.java rename to examples/security/basic-auth-with-static-content/src/main/java/io/helidon/examples/security/basicauth/BasicExampleBuilderMain.java index 14610b49cac..5e477ee680e 100644 --- a/examples/security/basic-auth-with-static-content/src/main/java/io/helidon/security/examples/webserver/basic/BasicExampleBuilderMain.java +++ b/examples/security/basic-auth-with-static-content/src/main/java/io/helidon/examples/security/basicauth/BasicExampleBuilderMain.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.security.examples.webserver.basic; +package io.helidon.examples.security.basicauth; import java.util.Arrays; import java.util.HashMap; @@ -23,17 +23,17 @@ import java.util.Set; import java.util.concurrent.TimeUnit; -import io.helidon.common.http.HttpMediaTypes; +import io.helidon.http.HttpMediaTypes; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.context.ContextFeature; -import io.helidon.nima.webserver.staticcontent.StaticContentService; import io.helidon.security.Security; import io.helidon.security.SecurityContext; -import io.helidon.security.integration.nima.SecurityFeature; import io.helidon.security.providers.httpauth.HttpBasicAuthProvider; import io.helidon.security.providers.httpauth.SecureUserStore; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.context.ContextFeature; +import io.helidon.webserver.security.SecurityFeature; +import io.helidon.webserver.staticcontent.StaticContentService; /** * Example using {@link io.helidon.common.Builder} approach instead of configuration based approach. diff --git a/examples/security/basic-auth-with-static-content/src/main/java/io/helidon/security/examples/webserver/basic/BasicExampleConfigMain.java b/examples/security/basic-auth-with-static-content/src/main/java/io/helidon/examples/security/basicauth/BasicExampleConfigMain.java similarity index 90% rename from examples/security/basic-auth-with-static-content/src/main/java/io/helidon/security/examples/webserver/basic/BasicExampleConfigMain.java rename to examples/security/basic-auth-with-static-content/src/main/java/io/helidon/examples/security/basicauth/BasicExampleConfigMain.java index e42e6b3a5da..f9ebffa6333 100644 --- a/examples/security/basic-auth-with-static-content/src/main/java/io/helidon/security/examples/webserver/basic/BasicExampleConfigMain.java +++ b/examples/security/basic-auth-with-static-content/src/main/java/io/helidon/examples/security/basicauth/BasicExampleConfigMain.java @@ -14,20 +14,20 @@ * limitations under the License. */ -package io.helidon.security.examples.webserver.basic; +package io.helidon.examples.security.basicauth; import java.util.Optional; import java.util.concurrent.TimeUnit; -import io.helidon.common.http.HttpMediaTypes; import io.helidon.config.Config; +import io.helidon.http.HttpMediaTypes; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.context.ContextFeature; -import io.helidon.nima.webserver.staticcontent.StaticContentService; import io.helidon.security.SecurityContext; -import io.helidon.security.integration.nima.SecurityFeature; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.context.ContextFeature; +import io.helidon.webserver.security.SecurityFeature; +import io.helidon.webserver.staticcontent.StaticContentService; /** * Example using configuration based approach. diff --git a/examples/security/basic-auth-with-static-content/src/main/java/io/helidon/examples/security/basicauth/package-info.java b/examples/security/basic-auth-with-static-content/src/main/java/io/helidon/examples/security/basicauth/package-info.java new file mode 100644 index 00000000000..6dfa24d18cc --- /dev/null +++ b/examples/security/basic-auth-with-static-content/src/main/java/io/helidon/examples/security/basicauth/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Example of basic authentication used with static content. + */ +package io.helidon.examples.security.basicauth; diff --git a/examples/security/basic-auth-with-static-content/src/main/java/io/helidon/security/examples/webserver/basic/package-info.java b/examples/security/basic-auth-with-static-content/src/main/java/io/helidon/security/examples/webserver/basic/package-info.java deleted file mode 100644 index 95bf9df0bd5..00000000000 --- a/examples/security/basic-auth-with-static-content/src/main/java/io/helidon/security/examples/webserver/basic/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2020 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Example of basic authentication used with static content. - */ -package io.helidon.security.examples.webserver.basic; diff --git a/examples/security/basic-auth-with-static-content/src/test/java/io/helidon/security/examples/webserver/basic/BasicExampleBuilderTest.java b/examples/security/basic-auth-with-static-content/src/test/java/io/helidon/examples/security/basicauth/BasicExampleBuilderTest.java similarity index 85% rename from examples/security/basic-auth-with-static-content/src/test/java/io/helidon/security/examples/webserver/basic/BasicExampleBuilderTest.java rename to examples/security/basic-auth-with-static-content/src/test/java/io/helidon/examples/security/basicauth/BasicExampleBuilderTest.java index f66893bb006..369fe835890 100644 --- a/examples/security/basic-auth-with-static-content/src/test/java/io/helidon/security/examples/webserver/basic/BasicExampleBuilderTest.java +++ b/examples/security/basic-auth-with-static-content/src/test/java/io/helidon/examples/security/basicauth/BasicExampleBuilderTest.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.security.examples.webserver.basic; +package io.helidon.examples.security.basicauth; import java.net.URI; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webserver.WebServerConfig; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webserver.WebServerConfig; /** * Unit test for {@link BasicExampleBuilderMain}. diff --git a/examples/security/basic-auth-with-static-content/src/test/java/io/helidon/security/examples/webserver/basic/BasicExampleConfigTest.java b/examples/security/basic-auth-with-static-content/src/test/java/io/helidon/examples/security/basicauth/BasicExampleConfigTest.java similarity index 85% rename from examples/security/basic-auth-with-static-content/src/test/java/io/helidon/security/examples/webserver/basic/BasicExampleConfigTest.java rename to examples/security/basic-auth-with-static-content/src/test/java/io/helidon/examples/security/basicauth/BasicExampleConfigTest.java index 9ba97bb0016..94dcf7a6839 100644 --- a/examples/security/basic-auth-with-static-content/src/test/java/io/helidon/security/examples/webserver/basic/BasicExampleConfigTest.java +++ b/examples/security/basic-auth-with-static-content/src/test/java/io/helidon/examples/security/basicauth/BasicExampleConfigTest.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.security.examples.webserver.basic; +package io.helidon.examples.security.basicauth; import java.net.URI; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webserver.WebServerConfig; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webserver.WebServerConfig; /** * Unit test for {@link BasicExampleConfigMain}. diff --git a/examples/security/basic-auth-with-static-content/src/test/java/io/helidon/security/examples/webserver/basic/BasicExampleTest.java b/examples/security/basic-auth-with-static-content/src/test/java/io/helidon/examples/security/basicauth/BasicExampleTest.java similarity index 94% rename from examples/security/basic-auth-with-static-content/src/test/java/io/helidon/security/examples/webserver/basic/BasicExampleTest.java rename to examples/security/basic-auth-with-static-content/src/test/java/io/helidon/examples/security/basicauth/BasicExampleTest.java index a03b29ce75e..7b3cc73014e 100644 --- a/examples/security/basic-auth-with-static-content/src/test/java/io/helidon/security/examples/webserver/basic/BasicExampleTest.java +++ b/examples/security/basic-auth-with-static-content/src/test/java/io/helidon/examples/security/basicauth/BasicExampleTest.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package io.helidon.security.examples.webserver.basic; +package io.helidon.examples.security.basicauth; import java.net.URI; import java.util.Set; -import io.helidon.common.http.Http; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webclient.security.WebClientSecurity; +import io.helidon.http.Http; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webclient.security.WebClientSecurity; import io.helidon.security.Security; import io.helidon.security.providers.httpauth.HttpBasicAuthProvider; diff --git a/examples/security/google-login/pom.xml b/examples/security/google-login/pom.xml index fdef5e5e53c..927ff586eae 100644 --- a/examples/security/google-login/pom.xml +++ b/examples/security/google-login/pom.xml @@ -29,20 +29,20 @@ io.helidon.examples.security helidon-examples-security-google-login - Helidon Security Examples Google Login + Helidon Examples Security Google Login Example of Google login button integration with Security. - io.helidon.security.examples.google.GoogleConfigMain + io.helidon.examples.security.google.GoogleConfigMain - io.helidon.security.integration - helidon-security-integration-nima + io.helidon.webserver + helidon-webserver-security io.helidon.security.providers @@ -53,20 +53,20 @@ helidon-config-encryption - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.nima.webserver - helidon-nima-webserver-static-content + io.helidon.webserver + helidon-webserver-static-content io.helidon.bundles helidon-bundles-config - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test diff --git a/examples/security/google-login/src/main/java/io/helidon/security/examples/google/GoogleBuilderMain.java b/examples/security/google-login/src/main/java/io/helidon/examples/security/google/GoogleBuilderMain.java similarity index 89% rename from examples/security/google-login/src/main/java/io/helidon/security/examples/google/GoogleBuilderMain.java rename to examples/security/google-login/src/main/java/io/helidon/examples/security/google/GoogleBuilderMain.java index 361c4c5f1e3..3b35d01b441 100644 --- a/examples/security/google-login/src/main/java/io/helidon/security/examples/google/GoogleBuilderMain.java +++ b/examples/security/google-login/src/main/java/io/helidon/examples/security/google/GoogleBuilderMain.java @@ -14,22 +14,22 @@ * limitations under the License. */ -package io.helidon.security.examples.google; +package io.helidon.examples.security.google; import java.util.Optional; import java.util.concurrent.TimeUnit; -import io.helidon.common.http.HttpMediaTypes; +import io.helidon.http.HttpMediaTypes; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.context.ContextFeature; -import io.helidon.nima.webserver.staticcontent.StaticContentService; import io.helidon.security.Security; import io.helidon.security.SecurityContext; import io.helidon.security.Subject; -import io.helidon.security.integration.nima.SecurityFeature; import io.helidon.security.providers.google.login.GoogleTokenProvider; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.context.ContextFeature; +import io.helidon.webserver.security.SecurityFeature; +import io.helidon.webserver.staticcontent.StaticContentService; /** * Google login button example main class using builders. diff --git a/examples/security/google-login/src/main/java/io/helidon/security/examples/google/GoogleConfigMain.java b/examples/security/google-login/src/main/java/io/helidon/examples/security/google/GoogleConfigMain.java similarity index 89% rename from examples/security/google-login/src/main/java/io/helidon/security/examples/google/GoogleConfigMain.java rename to examples/security/google-login/src/main/java/io/helidon/examples/security/google/GoogleConfigMain.java index 29b281d181a..1c194f8a261 100644 --- a/examples/security/google-login/src/main/java/io/helidon/security/examples/google/GoogleConfigMain.java +++ b/examples/security/google-login/src/main/java/io/helidon/examples/security/google/GoogleConfigMain.java @@ -14,21 +14,21 @@ * limitations under the License. */ -package io.helidon.security.examples.google; +package io.helidon.examples.security.google; import java.util.Optional; import java.util.concurrent.TimeUnit; -import io.helidon.common.http.HttpMediaTypes; import io.helidon.config.Config; +import io.helidon.http.HttpMediaTypes; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.context.ContextFeature; -import io.helidon.nima.webserver.staticcontent.StaticContentService; import io.helidon.security.SecurityContext; import io.helidon.security.Subject; -import io.helidon.security.integration.nima.SecurityFeature; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.context.ContextFeature; +import io.helidon.webserver.security.SecurityFeature; +import io.helidon.webserver.staticcontent.StaticContentService; import static io.helidon.config.ConfigSources.classpath; import static io.helidon.config.ConfigSources.file; diff --git a/examples/security/google-login/src/main/java/io/helidon/examples/security/google/package-info.java b/examples/security/google-login/src/main/java/io/helidon/examples/security/google/package-info.java new file mode 100644 index 00000000000..44ad9e8fde2 --- /dev/null +++ b/examples/security/google-login/src/main/java/io/helidon/examples/security/google/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2018, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Example of integration of Google Login button with security. + */ +package io.helidon.examples.security.google; diff --git a/examples/security/google-login/src/main/java/io/helidon/security/examples/google/package-info.java b/examples/security/google-login/src/main/java/io/helidon/security/examples/google/package-info.java deleted file mode 100644 index eeef4147c5b..00000000000 --- a/examples/security/google-login/src/main/java/io/helidon/security/examples/google/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2018, 2021 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Example of integration of Google Login button with security. - */ -package io.helidon.security.examples.google; diff --git a/examples/security/google-login/src/test/java/io/helidon/security/examples/google/GoogleBuilderMainTest.java b/examples/security/google-login/src/test/java/io/helidon/examples/security/google/GoogleBuilderMainTest.java similarity index 78% rename from examples/security/google-login/src/test/java/io/helidon/security/examples/google/GoogleBuilderMainTest.java rename to examples/security/google-login/src/test/java/io/helidon/examples/security/google/GoogleBuilderMainTest.java index a4259957417..10afcd2fab4 100644 --- a/examples/security/google-login/src/test/java/io/helidon/security/examples/google/GoogleBuilderMainTest.java +++ b/examples/security/google-login/src/test/java/io/helidon/examples/security/google/GoogleBuilderMainTest.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.security.examples.google; +package io.helidon.examples.security.google; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webserver.WebServerConfig; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webserver.WebServerConfig; /** * Unit test for {@link GoogleBuilderMain}. diff --git a/examples/security/google-login/src/test/java/io/helidon/security/examples/google/GoogleConfigMainTest.java b/examples/security/google-login/src/test/java/io/helidon/examples/security/google/GoogleConfigMainTest.java similarity index 78% rename from examples/security/google-login/src/test/java/io/helidon/security/examples/google/GoogleConfigMainTest.java rename to examples/security/google-login/src/test/java/io/helidon/examples/security/google/GoogleConfigMainTest.java index 5f5477f842c..cc60df9b764 100644 --- a/examples/security/google-login/src/test/java/io/helidon/security/examples/google/GoogleConfigMainTest.java +++ b/examples/security/google-login/src/test/java/io/helidon/examples/security/google/GoogleConfigMainTest.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.security.examples.google; +package io.helidon.examples.security.google; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webserver.WebServerConfig; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webserver.WebServerConfig; /** * Unit test for {@link GoogleConfigMain}. diff --git a/examples/security/google-login/src/test/java/io/helidon/security/examples/google/GoogleMainTest.java b/examples/security/google-login/src/test/java/io/helidon/examples/security/google/GoogleMainTest.java similarity index 88% rename from examples/security/google-login/src/test/java/io/helidon/security/examples/google/GoogleMainTest.java rename to examples/security/google-login/src/test/java/io/helidon/examples/security/google/GoogleMainTest.java index 3d8827ac72d..b1691adf143 100644 --- a/examples/security/google-login/src/test/java/io/helidon/security/examples/google/GoogleMainTest.java +++ b/examples/security/google-login/src/test/java/io/helidon/examples/security/google/GoogleMainTest.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.helidon.security.examples.google; +package io.helidon.examples.security.google; -import io.helidon.common.http.Http; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; +import io.helidon.http.Http; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; import org.junit.jupiter.api.Test; diff --git a/examples/security/idcs-login/pom.xml b/examples/security/idcs-login/pom.xml index ca8dc02b1f5..7a04d84bac9 100644 --- a/examples/security/idcs-login/pom.xml +++ b/examples/security/idcs-login/pom.xml @@ -29,24 +29,24 @@ io.helidon.examples.security helidon-examples-security-oidc - Helidon Security Examples IDCS Login + Helidon Examples Security IDCS Login Example of login with IDCS using the OIDC provider, storing the identity in a cookie - io.helidon.security.examples.idcs.IdcsMain + io.helidon.examples.security.idcs.IdcsMain - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.nima.http.media - helidon-nima-http-media-jsonp + io.helidon.http.media + helidon-http-media-jsonp @@ -78,8 +78,8 @@ - io.helidon.security.integration - helidon-security-integration-nima + io.helidon.webserver + helidon-webserver-security diff --git a/examples/security/idcs-login/src/main/java/io/helidon/security/examples/idcs/IdcsBuilderMain.java b/examples/security/idcs-login/src/main/java/io/helidon/examples/security/idcs/IdcsBuilderMain.java similarity index 95% rename from examples/security/idcs-login/src/main/java/io/helidon/security/examples/idcs/IdcsBuilderMain.java rename to examples/security/idcs-login/src/main/java/io/helidon/examples/security/idcs/IdcsBuilderMain.java index ec45a0d3bd4..0a1d6cc3470 100644 --- a/examples/security/idcs-login/src/main/java/io/helidon/security/examples/idcs/IdcsBuilderMain.java +++ b/examples/security/idcs-login/src/main/java/io/helidon/examples/security/idcs/IdcsBuilderMain.java @@ -14,25 +14,25 @@ * limitations under the License. */ -package io.helidon.security.examples.idcs; +package io.helidon.examples.security.idcs; import java.net.URI; import java.util.Optional; import java.util.concurrent.TimeUnit; -import io.helidon.common.http.HttpMediaTypes; import io.helidon.config.Config; +import io.helidon.http.HttpMediaTypes; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; import io.helidon.security.Security; import io.helidon.security.SecurityContext; import io.helidon.security.Subject; -import io.helidon.security.integration.nima.SecurityFeature; import io.helidon.security.providers.idcs.mapper.IdcsRoleMapperProvider; import io.helidon.security.providers.oidc.OidcFeature; import io.helidon.security.providers.oidc.OidcProvider; import io.helidon.security.providers.oidc.common.OidcConfig; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.security.SecurityFeature; import static io.helidon.config.ConfigSources.classpath; import static io.helidon.config.ConfigSources.file; diff --git a/examples/security/idcs-login/src/main/java/io/helidon/security/examples/idcs/IdcsMain.java b/examples/security/idcs-login/src/main/java/io/helidon/examples/security/idcs/IdcsMain.java similarity index 94% rename from examples/security/idcs-login/src/main/java/io/helidon/security/examples/idcs/IdcsMain.java rename to examples/security/idcs-login/src/main/java/io/helidon/examples/security/idcs/IdcsMain.java index 7a60b6b3dab..366b5dae9bb 100644 --- a/examples/security/idcs-login/src/main/java/io/helidon/security/examples/idcs/IdcsMain.java +++ b/examples/security/idcs-login/src/main/java/io/helidon/examples/security/idcs/IdcsMain.java @@ -14,22 +14,22 @@ * limitations under the License. */ -package io.helidon.security.examples.idcs; +package io.helidon.examples.security.idcs; import java.util.Optional; import java.util.concurrent.TimeUnit; import io.helidon.common.context.Contexts; -import io.helidon.common.http.HttpMediaTypes; import io.helidon.config.Config; +import io.helidon.http.HttpMediaTypes; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; import io.helidon.security.Security; import io.helidon.security.SecurityContext; import io.helidon.security.Subject; -import io.helidon.security.integration.nima.SecurityFeature; import io.helidon.security.providers.oidc.OidcFeature; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.security.SecurityFeature; import static io.helidon.config.ConfigSources.classpath; import static io.helidon.config.ConfigSources.file; diff --git a/examples/security/idcs-login/src/main/java/io/helidon/examples/security/idcs/package-info.java b/examples/security/idcs-login/src/main/java/io/helidon/examples/security/idcs/package-info.java new file mode 100644 index 00000000000..715b09269c1 --- /dev/null +++ b/examples/security/idcs-login/src/main/java/io/helidon/examples/security/idcs/package-info.java @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2018, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Example showcasing integration of web server with IDCS server, using Open ID Connect security provider. + * There is another example in "microprofile" directory that shows the same integration for + * a MicroProfile based application. + */ +package io.helidon.examples.security.idcs; diff --git a/examples/security/idcs-login/src/main/java/io/helidon/security/examples/idcs/package-info.java b/examples/security/idcs-login/src/main/java/io/helidon/security/examples/idcs/package-info.java deleted file mode 100644 index 34bfc6b52f5..00000000000 --- a/examples/security/idcs-login/src/main/java/io/helidon/security/examples/idcs/package-info.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2018, 2021 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Example showcasing integration of web server with IDCS server, using Open ID Connect security provider. - * There is another example in "microprofile" directory that shows the same integration for - * a MicroProfile based application. - */ -package io.helidon.security.examples.idcs; diff --git a/examples/security/nohttp-programmatic/pom.xml b/examples/security/nohttp-programmatic/pom.xml deleted file mode 100644 index 669f85d66b4..00000000000 --- a/examples/security/nohttp-programmatic/pom.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - 4.0.0 - - io.helidon.applications - helidon-se - 4.0.0-SNAPSHOT - ../../../applications/se/pom.xml - - io.helidon.examples.security - helidon-examples-security-nohttp-programmatic - Helidon Security Examples No-HTTP programmatic - - - Example of programmatic security without an HTTP resource. - - - - io.helidon.security.examples.security.ProgrammaticSecurity - - - - - io.helidon.security - helidon-security - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-libs - - - - - - diff --git a/examples/security/nohttp-programmatic/src/main/java/io/helidon/security/examples/security/package-info.java b/examples/security/nohttp-programmatic/src/main/java/io/helidon/security/examples/security/package-info.java deleted file mode 100644 index 24e45212b9b..00000000000 --- a/examples/security/nohttp-programmatic/src/main/java/io/helidon/security/examples/security/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2018, 2021 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Example of programmatic approach to security. - */ -package io.helidon.security.examples.security; diff --git a/examples/security/nohttp-programmatic/src/main/resources/logging.properties b/examples/security/nohttp-programmatic/src/main/resources/logging.properties deleted file mode 100644 index 28f6591733f..00000000000 --- a/examples/security/nohttp-programmatic/src/main/resources/logging.properties +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright (c) 2018, 2022 Oracle and/or its affiliates. -# -# 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. -# - -handlers=io.helidon.logging.jul.HelidonConsoleHandler -.level=INFO -AUDIT.level=FINEST diff --git a/examples/security/outbound-override/pom.xml b/examples/security/outbound-override/pom.xml index 763a21574ba..df82556ec83 100644 --- a/examples/security/outbound-override/pom.xml +++ b/examples/security/outbound-override/pom.xml @@ -29,7 +29,7 @@ io.helidon.examples.security 4.0.0 helidon-examples-security-outbound-override - Helidon Security Examples Outbound Override + Helidon Examples Security Outbound Override io.helidon.security.examples.outbound.OutboundOverrideExample @@ -37,20 +37,20 @@ - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.security.integration - helidon-security-integration-nima + io.helidon.webserver + helidon-webserver-security - io.helidon.nima.webclient - helidon-nima-webclient + io.helidon.webclient + helidon-webclient - io.helidon.nima.webclient - helidon-nima-webclient-security + io.helidon.webclient + helidon-webclient-security io.helidon.security.providers @@ -65,8 +65,8 @@ helidon-bundles-config - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test diff --git a/examples/security/outbound-override/src/main/java/io/helidon/security/examples/outbound/JwtOverrideService.java b/examples/security/outbound-override/src/main/java/io/helidon/security/examples/outbound/JwtOverrideService.java index 0ae54e7349b..f891315f3e4 100644 --- a/examples/security/outbound-override/src/main/java/io/helidon/security/examples/outbound/JwtOverrideService.java +++ b/examples/security/outbound-override/src/main/java/io/helidon/security/examples/outbound/JwtOverrideService.java @@ -15,15 +15,15 @@ */ package io.helidon.security.examples.outbound; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.security.WebClientSecurity; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; import io.helidon.security.SecurityContext; import io.helidon.security.providers.jwt.JwtProvider; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.security.WebClientSecurity; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; final class JwtOverrideService implements HttpService { diff --git a/examples/security/outbound-override/src/main/java/io/helidon/security/examples/outbound/OutboundOverrideExample.java b/examples/security/outbound-override/src/main/java/io/helidon/security/examples/outbound/OutboundOverrideExample.java index d4cb846cf4e..714c8c0a974 100644 --- a/examples/security/outbound-override/src/main/java/io/helidon/security/examples/outbound/OutboundOverrideExample.java +++ b/examples/security/outbound-override/src/main/java/io/helidon/security/examples/outbound/OutboundOverrideExample.java @@ -19,13 +19,13 @@ import io.helidon.config.Config; import io.helidon.config.ConfigSources; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.context.ContextFeature; import io.helidon.security.Principal; import io.helidon.security.SecurityContext; import io.helidon.security.Subject; -import io.helidon.security.integration.nima.SecurityFeature; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.context.ContextFeature; +import io.helidon.webserver.security.SecurityFeature; /** * Creates two services. diff --git a/examples/security/outbound-override/src/main/java/io/helidon/security/examples/outbound/OutboundOverrideJwtExample.java b/examples/security/outbound-override/src/main/java/io/helidon/security/examples/outbound/OutboundOverrideJwtExample.java index 06ad02c5ccd..f2fb672c8d3 100644 --- a/examples/security/outbound-override/src/main/java/io/helidon/security/examples/outbound/OutboundOverrideJwtExample.java +++ b/examples/security/outbound-override/src/main/java/io/helidon/security/examples/outbound/OutboundOverrideJwtExample.java @@ -17,16 +17,16 @@ import java.util.concurrent.TimeUnit; -import io.helidon.common.http.Http; import io.helidon.config.Config; import io.helidon.config.ConfigSources; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.context.ContextFeature; +import io.helidon.http.Http; import io.helidon.security.Principal; import io.helidon.security.SecurityContext; import io.helidon.security.Subject; -import io.helidon.security.integration.nima.SecurityFeature; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.context.ContextFeature; +import io.helidon.webserver.security.SecurityFeature; /** * Creates two services. diff --git a/examples/security/outbound-override/src/main/java/io/helidon/security/examples/outbound/OverrideService.java b/examples/security/outbound-override/src/main/java/io/helidon/security/examples/outbound/OverrideService.java index 26405140f45..545926f5f25 100644 --- a/examples/security/outbound-override/src/main/java/io/helidon/security/examples/outbound/OverrideService.java +++ b/examples/security/outbound-override/src/main/java/io/helidon/security/examples/outbound/OverrideService.java @@ -15,15 +15,15 @@ */ package io.helidon.security.examples.outbound; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.security.WebClientSecurity; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; import io.helidon.security.SecurityContext; import io.helidon.security.providers.httpauth.HttpBasicAuthProvider; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.security.WebClientSecurity; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; class OverrideService implements HttpService { diff --git a/examples/security/outbound-override/src/test/java/io/helidon/security/examples/outbound/OutboundOverrideExampleTest.java b/examples/security/outbound-override/src/test/java/io/helidon/security/examples/outbound/OutboundOverrideExampleTest.java index 4a26a6274b5..c0244134b45 100644 --- a/examples/security/outbound-override/src/test/java/io/helidon/security/examples/outbound/OutboundOverrideExampleTest.java +++ b/examples/security/outbound-override/src/test/java/io/helidon/security/examples/outbound/OutboundOverrideExampleTest.java @@ -17,12 +17,12 @@ import java.net.URI; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.security.WebClientSecurity; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.security.WebClientSecurity; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; import io.helidon.security.Security; import io.helidon.security.providers.httpauth.HttpBasicAuthProvider; diff --git a/examples/security/outbound-override/src/test/java/io/helidon/security/examples/outbound/OutboundOverrideJwtExampleTest.java b/examples/security/outbound-override/src/test/java/io/helidon/security/examples/outbound/OutboundOverrideJwtExampleTest.java index 0aa741c6ee7..580c38dd79c 100644 --- a/examples/security/outbound-override/src/test/java/io/helidon/security/examples/outbound/OutboundOverrideJwtExampleTest.java +++ b/examples/security/outbound-override/src/test/java/io/helidon/security/examples/outbound/OutboundOverrideJwtExampleTest.java @@ -17,14 +17,13 @@ import java.net.URI; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientRequest; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webclient.security.WebClientSecurity; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webclient.security.WebClientSecurity; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; import io.helidon.security.Security; import io.helidon.security.providers.httpauth.HttpBasicAuthProvider; diff --git a/examples/security/pom.xml b/examples/security/pom.xml index cfedfd7e333..a805022eb11 100644 --- a/examples/security/pom.xml +++ b/examples/security/pom.xml @@ -28,7 +28,7 @@ io.helidon.examples.security helidon-examples-security-project - Helidon Security Examples + Helidon Examples Security pom @@ -36,15 +36,15 @@ - nohttp-programmatic - webserver-digest-auth - webserver-signatures - google-login - spi-examples attribute-based-access-control + basic-auth-with-static-content + google-login idcs-login outbound-override - basic-auth-with-static-content + programmatic + spi-examples vaults + webserver-digest-auth + webserver-signatures diff --git a/examples/security/nohttp-programmatic/README.md b/examples/security/programmatic/README.md similarity index 100% rename from examples/security/nohttp-programmatic/README.md rename to examples/security/programmatic/README.md diff --git a/examples/security/programmatic/pom.xml b/examples/security/programmatic/pom.xml new file mode 100644 index 00000000000..65855646ccd --- /dev/null +++ b/examples/security/programmatic/pom.xml @@ -0,0 +1,62 @@ + + + + + 4.0.0 + + io.helidon.applications + helidon-se + 4.0.0-SNAPSHOT + ../../../applications/se/pom.xml + + io.helidon.examples.security + helidon-examples-security-nohttp-programmatic + Helidon Examples Security No-HTTP programmatic + + + Example of programmatic security without an HTTP resource. + + + + io.helidon.examples.security.programmatic.ProgrammaticSecurity + + + + + io.helidon.security + helidon-security + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-libs + + + + + + diff --git a/examples/security/nohttp-programmatic/src/main/java/io/helidon/security/examples/security/MyProvider.java b/examples/security/programmatic/src/main/java/io/helidon/examples/security/programmatic/MyProvider.java similarity index 99% rename from examples/security/nohttp-programmatic/src/main/java/io/helidon/security/examples/security/MyProvider.java rename to examples/security/programmatic/src/main/java/io/helidon/examples/security/programmatic/MyProvider.java index 7eb3ed82dec..28ef5f5b0ed 100644 --- a/examples/security/nohttp-programmatic/src/main/java/io/helidon/security/examples/security/MyProvider.java +++ b/examples/security/programmatic/src/main/java/io/helidon/examples/security/programmatic/MyProvider.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.security.examples.security; +package io.helidon.examples.security.programmatic; import java.nio.charset.StandardCharsets; import java.util.Base64; diff --git a/examples/security/nohttp-programmatic/src/main/java/io/helidon/security/examples/security/ProgrammaticSecurity.java b/examples/security/programmatic/src/main/java/io/helidon/examples/security/programmatic/ProgrammaticSecurity.java similarity index 98% rename from examples/security/nohttp-programmatic/src/main/java/io/helidon/security/examples/security/ProgrammaticSecurity.java rename to examples/security/programmatic/src/main/java/io/helidon/examples/security/programmatic/ProgrammaticSecurity.java index f2f144c767e..fac90c64987 100644 --- a/examples/security/nohttp-programmatic/src/main/java/io/helidon/security/examples/security/ProgrammaticSecurity.java +++ b/examples/security/programmatic/src/main/java/io/helidon/examples/security/programmatic/ProgrammaticSecurity.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021 Oracle and/or its affiliates. + * Copyright (c) 2018, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.security.examples.security; +package io.helidon.examples.security.programmatic; import java.nio.charset.StandardCharsets; import java.util.Base64; diff --git a/examples/security/programmatic/src/main/java/io/helidon/examples/security/programmatic/package-info.java b/examples/security/programmatic/src/main/java/io/helidon/examples/security/programmatic/package-info.java new file mode 100644 index 00000000000..0ed2a116082 --- /dev/null +++ b/examples/security/programmatic/src/main/java/io/helidon/examples/security/programmatic/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2018, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Example of programmatic approach to security. + */ +package io.helidon.examples.security.programmatic; diff --git a/examples/security/programmatic/src/main/resources/logging.properties b/examples/security/programmatic/src/main/resources/logging.properties new file mode 100644 index 00000000000..993d3d42d45 --- /dev/null +++ b/examples/security/programmatic/src/main/resources/logging.properties @@ -0,0 +1,19 @@ +# +# Copyright (c) 2018, 2023 Oracle and/or its affiliates. +# +# 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. +# + +handlers=io.helidon.logging.jul.HelidonConsoleHandler +.level=INFO +AUDIT.level=FINEST diff --git a/examples/security/spi-examples/pom.xml b/examples/security/spi-examples/pom.xml index ba4f668a69f..2e73d0eb537 100644 --- a/examples/security/spi-examples/pom.xml +++ b/examples/security/spi-examples/pom.xml @@ -29,7 +29,7 @@ io.helidon.examples.security helidon-examples-security-spi - Helidon Security Examples SPI Implementation + Helidon Examples Security SPI Implementation Example of implementation of custom providers and other SPI implementations diff --git a/examples/security/vaults/pom.xml b/examples/security/vaults/pom.xml index 12996128ee1..2a48b65428a 100644 --- a/examples/security/vaults/pom.xml +++ b/examples/security/vaults/pom.xml @@ -29,7 +29,7 @@ io.helidon.examples.security helidon-examples-security-vaults - Helidon Security Examples Vaults + Helidon Examples Security Vaults This example demonstrates usage of vault implementations - OCI, Hashicorp Vault, and Config based vault @@ -61,8 +61,8 @@ helidon-security-providers-config-vault - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver io.helidon.integrations.vault.secrets diff --git a/examples/security/vaults/src/main/java/io/helidon/examples/security/vaults/DigestService.java b/examples/security/vaults/src/main/java/io/helidon/examples/security/vaults/DigestService.java index 7eb309501d3..e42da009b16 100644 --- a/examples/security/vaults/src/main/java/io/helidon/examples/security/vaults/DigestService.java +++ b/examples/security/vaults/src/main/java/io/helidon/examples/security/vaults/DigestService.java @@ -16,11 +16,11 @@ package io.helidon.examples.security.vaults; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; import io.helidon.security.Security; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import static java.nio.charset.StandardCharsets.UTF_8; diff --git a/examples/security/vaults/src/main/java/io/helidon/examples/security/vaults/EncryptionService.java b/examples/security/vaults/src/main/java/io/helidon/examples/security/vaults/EncryptionService.java index 7f65daf9a6b..8ec0970a7f7 100644 --- a/examples/security/vaults/src/main/java/io/helidon/examples/security/vaults/EncryptionService.java +++ b/examples/security/vaults/src/main/java/io/helidon/examples/security/vaults/EncryptionService.java @@ -16,11 +16,11 @@ package io.helidon.examples.security.vaults; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; import io.helidon.security.Security; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import static java.nio.charset.StandardCharsets.UTF_8; diff --git a/examples/security/vaults/src/main/java/io/helidon/examples/security/vaults/SecretsService.java b/examples/security/vaults/src/main/java/io/helidon/examples/security/vaults/SecretsService.java index beb7386917f..7e2f812aeb6 100644 --- a/examples/security/vaults/src/main/java/io/helidon/examples/security/vaults/SecretsService.java +++ b/examples/security/vaults/src/main/java/io/helidon/examples/security/vaults/SecretsService.java @@ -16,11 +16,11 @@ package io.helidon.examples.security.vaults; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; import io.helidon.security.Security; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; class SecretsService implements HttpService { private final Security security; diff --git a/examples/security/vaults/src/main/java/io/helidon/examples/security/vaults/VaultsExampleMain.java b/examples/security/vaults/src/main/java/io/helidon/examples/security/vaults/VaultsExampleMain.java index a79a79f30a7..315954f7d5c 100644 --- a/examples/security/vaults/src/main/java/io/helidon/examples/security/vaults/VaultsExampleMain.java +++ b/examples/security/vaults/src/main/java/io/helidon/examples/security/vaults/VaultsExampleMain.java @@ -18,8 +18,8 @@ import io.helidon.config.Config; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.webserver.WebServer; import io.helidon.security.Security; +import io.helidon.webserver.WebServer; import static io.helidon.config.ConfigSources.classpath; import static io.helidon.config.ConfigSources.file; diff --git a/examples/security/webserver-digest-auth/pom.xml b/examples/security/webserver-digest-auth/pom.xml index a0f722634fc..db9610de06e 100644 --- a/examples/security/webserver-digest-auth/pom.xml +++ b/examples/security/webserver-digest-auth/pom.xml @@ -29,7 +29,7 @@ io.helidon.examples.security helidon-examples-security-webserver-digest-auth - Helidon Security Examples Digest Authentication + Helidon Examples Security Digest Authentication This example demonstrates Integration of Web Server based application with Security component and Digest @@ -37,17 +37,17 @@ - io.helidon.security.examples.webserver.digest.DigestExampleConfigMain + io.helidon.examples.security.digest.DigestExampleConfigMain - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.security.integration - helidon-security-integration-nima + io.helidon.webserver + helidon-webserver-security io.helidon.config @@ -66,13 +66,13 @@ helidon-config-yaml - io.helidon.nima.webclient - helidon-nima-webclient + io.helidon.webclient + helidon-webclient test - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test diff --git a/examples/security/webserver-digest-auth/src/main/java/io/helidon/security/examples/webserver/digest/DigestExampleBuilderMain.java b/examples/security/webserver-digest-auth/src/main/java/io/helidon/examples/security/digest/DigestExampleBuilderMain.java similarity index 95% rename from examples/security/webserver-digest-auth/src/main/java/io/helidon/security/examples/webserver/digest/DigestExampleBuilderMain.java rename to examples/security/webserver-digest-auth/src/main/java/io/helidon/examples/security/digest/DigestExampleBuilderMain.java index d362b722ec5..a4bf7170367 100644 --- a/examples/security/webserver-digest-auth/src/main/java/io/helidon/security/examples/webserver/digest/DigestExampleBuilderMain.java +++ b/examples/security/webserver-digest-auth/src/main/java/io/helidon/examples/security/digest/DigestExampleBuilderMain.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.security.examples.webserver.digest; +package io.helidon.examples.security.digest; import java.nio.charset.StandardCharsets; import java.security.MessageDigest; @@ -26,17 +26,17 @@ import java.util.Set; import java.util.concurrent.TimeUnit; -import io.helidon.common.http.HttpMediaTypes; +import io.helidon.http.HttpMediaTypes; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.context.ContextFeature; import io.helidon.security.Security; import io.helidon.security.SecurityContext; -import io.helidon.security.integration.nima.SecurityFeature; import io.helidon.security.providers.httpauth.HttpDigest; import io.helidon.security.providers.httpauth.HttpDigestAuthProvider; import io.helidon.security.providers.httpauth.SecureUserStore; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.context.ContextFeature; +import io.helidon.webserver.security.SecurityFeature; /** * Example of HTTP digest authentication with WebServer fully configured programmatically. diff --git a/examples/security/webserver-digest-auth/src/main/java/io/helidon/security/examples/webserver/digest/DigestExampleConfigMain.java b/examples/security/webserver-digest-auth/src/main/java/io/helidon/examples/security/digest/DigestExampleConfigMain.java similarity index 91% rename from examples/security/webserver-digest-auth/src/main/java/io/helidon/security/examples/webserver/digest/DigestExampleConfigMain.java rename to examples/security/webserver-digest-auth/src/main/java/io/helidon/examples/security/digest/DigestExampleConfigMain.java index 9daa2074eff..495412239a2 100644 --- a/examples/security/webserver-digest-auth/src/main/java/io/helidon/security/examples/webserver/digest/DigestExampleConfigMain.java +++ b/examples/security/webserver-digest-auth/src/main/java/io/helidon/examples/security/digest/DigestExampleConfigMain.java @@ -14,19 +14,19 @@ * limitations under the License. */ -package io.helidon.security.examples.webserver.digest; +package io.helidon.examples.security.digest; import java.util.Optional; import java.util.concurrent.TimeUnit; -import io.helidon.common.http.HttpMediaTypes; import io.helidon.config.Config; +import io.helidon.http.HttpMediaTypes; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.context.ContextFeature; import io.helidon.security.SecurityContext; -import io.helidon.security.integration.nima.SecurityFeature; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.context.ContextFeature; +import io.helidon.webserver.security.SecurityFeature; /** * Example of HTTP digest authentication with Web Server fully configured in config file. diff --git a/examples/security/webserver-digest-auth/src/main/java/io/helidon/examples/security/digest/package-info.java b/examples/security/webserver-digest-auth/src/main/java/io/helidon/examples/security/digest/package-info.java new file mode 100644 index 00000000000..7403fd34d8a --- /dev/null +++ b/examples/security/webserver-digest-auth/src/main/java/io/helidon/examples/security/digest/package-info.java @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2018, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Example of Digest authentication on top of RX web server. + * + * @see io.helidon.examples.security.digest.DigestExampleConfigMain Configuration based example + * @see io.helidon.examples.security.digest.DigestExampleBuilderMain Programmatic example + */ +package io.helidon.examples.security.digest; diff --git a/examples/security/webserver-digest-auth/src/main/java/io/helidon/security/examples/webserver/digest/package-info.java b/examples/security/webserver-digest-auth/src/main/java/io/helidon/security/examples/webserver/digest/package-info.java deleted file mode 100644 index 775d49bbfee..00000000000 --- a/examples/security/webserver-digest-auth/src/main/java/io/helidon/security/examples/webserver/digest/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2018, 2021 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Example of Digest authentication on top of RX web server. - * - * @see io.helidon.security.examples.webserver.digest.DigestExampleConfigMain Configuration based example - * @see io.helidon.security.examples.webserver.digest.DigestExampleBuilderMain Programmatic example - */ -package io.helidon.security.examples.webserver.digest; diff --git a/examples/security/webserver-digest-auth/src/test/java/io/helidon/security/examples/webserver/digest/DigestAuthenticator.java b/examples/security/webserver-digest-auth/src/test/java/io/helidon/examples/security/digest/DigestAuthenticator.java similarity index 99% rename from examples/security/webserver-digest-auth/src/test/java/io/helidon/security/examples/webserver/digest/DigestAuthenticator.java rename to examples/security/webserver-digest-auth/src/test/java/io/helidon/examples/security/digest/DigestAuthenticator.java index bb53bcc2844..04bf5c9186e 100644 --- a/examples/security/webserver-digest-auth/src/test/java/io/helidon/security/examples/webserver/digest/DigestAuthenticator.java +++ b/examples/security/webserver-digest-auth/src/test/java/io/helidon/examples/security/digest/DigestAuthenticator.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.security.examples.webserver.digest; +package io.helidon.examples.security.digest; import java.nio.charset.StandardCharsets; import java.security.MessageDigest; diff --git a/examples/security/webserver-digest-auth/src/test/java/io/helidon/security/examples/webserver/digest/DigestExampleBuilderTest.java b/examples/security/webserver-digest-auth/src/test/java/io/helidon/examples/security/digest/DigestExampleBuilderTest.java similarity index 78% rename from examples/security/webserver-digest-auth/src/test/java/io/helidon/security/examples/webserver/digest/DigestExampleBuilderTest.java rename to examples/security/webserver-digest-auth/src/test/java/io/helidon/examples/security/digest/DigestExampleBuilderTest.java index c9eebfba20a..7f49c17ca44 100644 --- a/examples/security/webserver-digest-auth/src/test/java/io/helidon/security/examples/webserver/digest/DigestExampleBuilderTest.java +++ b/examples/security/webserver-digest-auth/src/test/java/io/helidon/examples/security/digest/DigestExampleBuilderTest.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.security.examples.webserver.digest; +package io.helidon.examples.security.digest; import java.net.URI; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webserver.WebServerConfig; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webserver.WebServerConfig; /** * Unit test for {@link DigestExampleBuilderMain}. diff --git a/examples/security/webserver-digest-auth/src/test/java/io/helidon/security/examples/webserver/digest/DigestExampleConfigTest.java b/examples/security/webserver-digest-auth/src/test/java/io/helidon/examples/security/digest/DigestExampleConfigTest.java similarity index 78% rename from examples/security/webserver-digest-auth/src/test/java/io/helidon/security/examples/webserver/digest/DigestExampleConfigTest.java rename to examples/security/webserver-digest-auth/src/test/java/io/helidon/examples/security/digest/DigestExampleConfigTest.java index ff0157a7f85..64957fd856b 100644 --- a/examples/security/webserver-digest-auth/src/test/java/io/helidon/security/examples/webserver/digest/DigestExampleConfigTest.java +++ b/examples/security/webserver-digest-auth/src/test/java/io/helidon/examples/security/digest/DigestExampleConfigTest.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.security.examples.webserver.digest; +package io.helidon.examples.security.digest; import java.net.URI; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webserver.WebServerConfig; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webserver.WebServerConfig; /** * Unit test for {@link DigestExampleConfigMain}. diff --git a/examples/security/webserver-digest-auth/src/test/java/io/helidon/security/examples/webserver/digest/DigestExampleTest.java b/examples/security/webserver-digest-auth/src/test/java/io/helidon/examples/security/digest/DigestExampleTest.java similarity index 92% rename from examples/security/webserver-digest-auth/src/test/java/io/helidon/security/examples/webserver/digest/DigestExampleTest.java rename to examples/security/webserver-digest-auth/src/test/java/io/helidon/examples/security/digest/DigestExampleTest.java index 8cd110cdec7..d43d6f2ceab 100644 --- a/examples/security/webserver-digest-auth/src/test/java/io/helidon/security/examples/webserver/digest/DigestExampleTest.java +++ b/examples/security/webserver-digest-auth/src/test/java/io/helidon/examples/security/digest/DigestExampleTest.java @@ -14,19 +14,19 @@ * limitations under the License. */ -package io.helidon.security.examples.webserver.digest; +package io.helidon.examples.security.digest; import java.net.URI; import java.util.Set; -import io.helidon.common.http.Http; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; +import io.helidon.http.Http; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; import org.junit.jupiter.api.Test; -import static io.helidon.security.examples.webserver.digest.WebClientAuthenticationService.HTTP_AUTHENTICATION_PASSWORD; -import static io.helidon.security.examples.webserver.digest.WebClientAuthenticationService.HTTP_AUTHENTICATION_USERNAME; +import static io.helidon.examples.security.digest.WebClientAuthenticationService.HTTP_AUTHENTICATION_PASSWORD; +import static io.helidon.examples.security.digest.WebClientAuthenticationService.HTTP_AUTHENTICATION_USERNAME; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.not; diff --git a/examples/security/webserver-digest-auth/src/test/java/io/helidon/security/examples/webserver/digest/WebClientAuthenticationService.java b/examples/security/webserver-digest-auth/src/test/java/io/helidon/examples/security/digest/WebClientAuthenticationService.java similarity index 89% rename from examples/security/webserver-digest-auth/src/test/java/io/helidon/security/examples/webserver/digest/WebClientAuthenticationService.java rename to examples/security/webserver-digest-auth/src/test/java/io/helidon/examples/security/digest/WebClientAuthenticationService.java index 45fb6fbebba..fff71d63cf5 100644 --- a/examples/security/webserver-digest-auth/src/test/java/io/helidon/security/examples/webserver/digest/WebClientAuthenticationService.java +++ b/examples/security/webserver-digest-auth/src/test/java/io/helidon/examples/security/digest/WebClientAuthenticationService.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.security.examples.webserver.digest; +package io.helidon.examples.security.digest; import java.util.Map; -import io.helidon.common.http.Http; -import io.helidon.nima.webclient.api.WebClientServiceRequest; -import io.helidon.nima.webclient.api.WebClientServiceResponse; -import io.helidon.nima.webclient.spi.WebClientService; +import io.helidon.http.Http; +import io.helidon.webclient.api.WebClientServiceRequest; +import io.helidon.webclient.api.WebClientServiceResponse; +import io.helidon.webclient.spi.WebClientService; /** * Web client service that supports digest authentication. diff --git a/examples/security/webserver-signatures/pom.xml b/examples/security/webserver-signatures/pom.xml index 40d69c86265..d20dc57e277 100644 --- a/examples/security/webserver-signatures/pom.xml +++ b/examples/security/webserver-signatures/pom.xml @@ -29,7 +29,7 @@ io.helidon.examples.security helidon-examples-security-webserver-signatures - Helidon Security Examples HTTP Signatures + Helidon Examples Security HTTP Signatures This example demonstrates Integration of Web Server based application with Security component and HTTP @@ -37,25 +37,25 @@ - io.helidon.security.examples.signatures.SignatureExampleConfigMain + io.helidon.examples.security.signatures.SignatureExampleConfigMain - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.security.integration - helidon-security-integration-nima + io.helidon.webserver + helidon-webserver-security io.helidon.security.providers helidon-security-providers-http-sign - io.helidon.nima.webclient - helidon-nima-webclient-security + io.helidon.webclient + helidon-webclient-security io.helidon.bundles @@ -70,8 +70,8 @@ helidon-config-hocon - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test diff --git a/examples/security/webserver-signatures/src/main/java/io/helidon/security/examples/signatures/Service1.java b/examples/security/webserver-signatures/src/main/java/io/helidon/examples/security/signatures/Service1.java similarity index 82% rename from examples/security/webserver-signatures/src/main/java/io/helidon/security/examples/signatures/Service1.java rename to examples/security/webserver-signatures/src/main/java/io/helidon/examples/security/signatures/Service1.java index bc4f8a91fd3..429dd65bc0d 100644 --- a/examples/security/webserver-signatures/src/main/java/io/helidon/security/examples/signatures/Service1.java +++ b/examples/security/webserver-signatures/src/main/java/io/helidon/examples/security/signatures/Service1.java @@ -13,20 +13,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.security.examples.signatures; +package io.helidon.examples.security.signatures; import io.helidon.common.LazyValue; import io.helidon.common.context.Contexts; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpMediaTypes; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.Http; +import io.helidon.http.HttpMediaTypes; import io.helidon.security.SecurityContext; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; class Service1 implements HttpService { diff --git a/examples/security/webserver-signatures/src/main/java/io/helidon/security/examples/signatures/Service2.java b/examples/security/webserver-signatures/src/main/java/io/helidon/examples/security/signatures/Service2.java similarity index 82% rename from examples/security/webserver-signatures/src/main/java/io/helidon/security/examples/signatures/Service2.java rename to examples/security/webserver-signatures/src/main/java/io/helidon/examples/security/signatures/Service2.java index 6c5e1a76cfb..82f1092c187 100644 --- a/examples/security/webserver-signatures/src/main/java/io/helidon/security/examples/signatures/Service2.java +++ b/examples/security/webserver-signatures/src/main/java/io/helidon/examples/security/signatures/Service2.java @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.security.examples.signatures; +package io.helidon.examples.security.signatures; import java.util.Optional; -import io.helidon.common.http.HttpMediaTypes; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.HttpMediaTypes; import io.helidon.security.SecurityContext; import io.helidon.security.Subject; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; class Service2 implements HttpService { diff --git a/examples/security/webserver-signatures/src/main/java/io/helidon/security/examples/signatures/SignatureExampleBuilderMain.java b/examples/security/webserver-signatures/src/main/java/io/helidon/examples/security/signatures/SignatureExampleBuilderMain.java similarity index 96% rename from examples/security/webserver-signatures/src/main/java/io/helidon/security/examples/signatures/SignatureExampleBuilderMain.java rename to examples/security/webserver-signatures/src/main/java/io/helidon/examples/security/signatures/SignatureExampleBuilderMain.java index c302ffb0cd8..b09b211a57e 100644 --- a/examples/security/webserver-signatures/src/main/java/io/helidon/security/examples/signatures/SignatureExampleBuilderMain.java +++ b/examples/security/webserver-signatures/src/main/java/io/helidon/examples/security/signatures/SignatureExampleBuilderMain.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.helidon.security.examples.signatures; +package io.helidon.examples.security.signatures; import java.util.Arrays; import java.util.Collection; @@ -27,14 +27,9 @@ import io.helidon.common.configurable.Resource; import io.helidon.common.pki.Keys; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.context.ContextFeature; -import io.helidon.nima.webserver.http.HttpRouting; import io.helidon.security.CompositeProviderFlag; import io.helidon.security.CompositeProviderSelectionPolicy; import io.helidon.security.Security; -import io.helidon.security.integration.nima.SecurityFeature; import io.helidon.security.providers.common.OutboundConfig; import io.helidon.security.providers.common.OutboundTarget; import io.helidon.security.providers.httpauth.HttpBasicAuthProvider; @@ -42,6 +37,11 @@ import io.helidon.security.providers.httpsign.HttpSignProvider; import io.helidon.security.providers.httpsign.InboundClientDefinition; import io.helidon.security.providers.httpsign.OutboundTargetDefinition; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.context.ContextFeature; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.security.SecurityFeature; /** * Example of authentication of service with http signatures, using configuration file as much as possible. diff --git a/examples/security/webserver-signatures/src/main/java/io/helidon/security/examples/signatures/SignatureExampleConfigMain.java b/examples/security/webserver-signatures/src/main/java/io/helidon/examples/security/signatures/SignatureExampleConfigMain.java similarity index 91% rename from examples/security/webserver-signatures/src/main/java/io/helidon/security/examples/signatures/SignatureExampleConfigMain.java rename to examples/security/webserver-signatures/src/main/java/io/helidon/examples/security/signatures/SignatureExampleConfigMain.java index c8846e80fc7..b0f0e676f0f 100644 --- a/examples/security/webserver-signatures/src/main/java/io/helidon/security/examples/signatures/SignatureExampleConfigMain.java +++ b/examples/security/webserver-signatures/src/main/java/io/helidon/examples/security/signatures/SignatureExampleConfigMain.java @@ -14,17 +14,17 @@ * limitations under the License. */ -package io.helidon.security.examples.signatures; +package io.helidon.examples.security.signatures; import java.util.concurrent.TimeUnit; import io.helidon.config.Config; import io.helidon.config.ConfigSources; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.context.ContextFeature; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.security.integration.nima.SecurityFeature; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.context.ContextFeature; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.security.SecurityFeature; /** * Example of authentication of service with http signatures, using configuration file as much as possible. diff --git a/examples/security/webserver-signatures/src/main/java/io/helidon/examples/security/signatures/package-info.java b/examples/security/webserver-signatures/src/main/java/io/helidon/examples/security/signatures/package-info.java new file mode 100644 index 00000000000..16061e6356e --- /dev/null +++ b/examples/security/webserver-signatures/src/main/java/io/helidon/examples/security/signatures/package-info.java @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2018, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Example of HTTP Signatures (both inbound and outbound). + * Based on RFC draft: https://tools.ietf + * .org/html/draft-cavage-http-signatures-03 + */ +package io.helidon.examples.security.signatures; diff --git a/examples/security/webserver-signatures/src/main/java/io/helidon/security/examples/signatures/package-info.java b/examples/security/webserver-signatures/src/main/java/io/helidon/security/examples/signatures/package-info.java deleted file mode 100644 index c8338448c4e..00000000000 --- a/examples/security/webserver-signatures/src/main/java/io/helidon/security/examples/signatures/package-info.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2018, 2021 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Example of HTTP Signatures (both inbound and outbound). - * Based on RFC draft: https://tools.ietf - * .org/html/draft-cavage-http-signatures-03 - */ -package io.helidon.security.examples.signatures; diff --git a/examples/security/webserver-signatures/src/test/java/io/helidon/security/examples/signatures/SignatureExampleBuilderMainTest.java b/examples/security/webserver-signatures/src/test/java/io/helidon/examples/security/signatures/SignatureExampleBuilderMainTest.java similarity index 79% rename from examples/security/webserver-signatures/src/test/java/io/helidon/security/examples/signatures/SignatureExampleBuilderMainTest.java rename to examples/security/webserver-signatures/src/test/java/io/helidon/examples/security/signatures/SignatureExampleBuilderMainTest.java index 0bbfa68a235..e054f19d881 100644 --- a/examples/security/webserver-signatures/src/test/java/io/helidon/security/examples/signatures/SignatureExampleBuilderMainTest.java +++ b/examples/security/webserver-signatures/src/test/java/io/helidon/examples/security/signatures/SignatureExampleBuilderMainTest.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.security.examples.signatures; +package io.helidon.examples.security.signatures; import java.net.URI; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; /** * Unit test for {@link SignatureExampleBuilderMain}. diff --git a/examples/security/webserver-signatures/src/test/java/io/helidon/security/examples/signatures/SignatureExampleConfigMainTest.java b/examples/security/webserver-signatures/src/test/java/io/helidon/examples/security/signatures/SignatureExampleConfigMainTest.java similarity index 79% rename from examples/security/webserver-signatures/src/test/java/io/helidon/security/examples/signatures/SignatureExampleConfigMainTest.java rename to examples/security/webserver-signatures/src/test/java/io/helidon/examples/security/signatures/SignatureExampleConfigMainTest.java index e7425941fc4..e14fab44ada 100644 --- a/examples/security/webserver-signatures/src/test/java/io/helidon/security/examples/signatures/SignatureExampleConfigMainTest.java +++ b/examples/security/webserver-signatures/src/test/java/io/helidon/examples/security/signatures/SignatureExampleConfigMainTest.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.security.examples.signatures; +package io.helidon.examples.security.signatures; import java.net.URI; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; /** * Unit test for {@link SignatureExampleBuilderMain}. diff --git a/examples/security/webserver-signatures/src/test/java/io/helidon/security/examples/signatures/SignatureExampleTest.java b/examples/security/webserver-signatures/src/test/java/io/helidon/examples/security/signatures/SignatureExampleTest.java similarity index 89% rename from examples/security/webserver-signatures/src/test/java/io/helidon/security/examples/signatures/SignatureExampleTest.java rename to examples/security/webserver-signatures/src/test/java/io/helidon/examples/security/signatures/SignatureExampleTest.java index 4d876c3fd98..8d1a3450c4d 100644 --- a/examples/security/webserver-signatures/src/test/java/io/helidon/security/examples/signatures/SignatureExampleTest.java +++ b/examples/security/webserver-signatures/src/test/java/io/helidon/examples/security/signatures/SignatureExampleTest.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package io.helidon.security.examples.signatures; +package io.helidon.examples.security.signatures; import java.net.URI; import java.util.Set; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webclient.security.WebClientSecurity; -import io.helidon.nima.webserver.WebServer; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webclient.security.WebClientSecurity; +import io.helidon.webserver.WebServer; import io.helidon.security.Security; import io.helidon.security.providers.httpauth.HttpBasicAuthProvider; diff --git a/examples/todo-app/backend/pom.xml b/examples/todo-app/backend/pom.xml index eefcf340e1d..5793100a8db 100644 --- a/examples/todo-app/backend/pom.xml +++ b/examples/todo-app/backend/pom.xml @@ -36,7 +36,7 @@ - io.helidon.demo.todos.backend.Main + io.helidon.examples.todos.backend.Main 3.10.2 4.3.1.0 4.9.0 diff --git a/examples/todo-app/backend/src/main/java/io/helidon/demo/todos/backend/Main.java b/examples/todo-app/backend/src/main/java/io/helidon/demo/todos/backend/Main.java deleted file mode 100644 index 2fadfca8ff6..00000000000 --- a/examples/todo-app/backend/src/main/java/io/helidon/demo/todos/backend/Main.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2017, 2022 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.demo.todos.backend; - -import java.util.List; - -import io.helidon.config.Config; -import io.helidon.logging.common.LogConfig; -import io.helidon.microprofile.server.Server; - -import static io.helidon.config.ConfigSources.classpath; -import static io.helidon.config.ConfigSources.environmentVariables; -import static io.helidon.config.ConfigSources.file; - -/** - * Main class to start the service. - */ -public final class Main { - - /** - * Cannot be instantiated. - */ - private Main() { - } - - /** - * Application main entry point. - * - * @param args command line arguments - */ - public static void main(final String[] args) { - - // load logging configuration - LogConfig.configureRuntime(); - - Config config = buildConfig(); - - // as we need to use custom filter - // we need to build Server with custom config - Server server = Server.builder() - .config(config) - .build(); - - server.start(); - } - - /** - * Load the configuration from all sources. - * @return the configuration root - */ - static Config buildConfig() { - return Config.builder() - .sources(List.of( - environmentVariables(), - // expected on development machine - // to override props for dev - file("dev.yaml").optional(), - // expected in k8s runtime - // to configure testing/production values - file("prod.yaml").optional(), - // in jar file - // (see src/main/resources/application.yaml) - classpath("application.yaml"))) - // support for passwords in configuration -// .addFilter(SecureConfigFilter.fromConfig()) - .build(); - } -} diff --git a/examples/todo-app/backend/src/main/java/io/helidon/demo/todos/backend/package-info.java b/examples/todo-app/backend/src/main/java/io/helidon/demo/todos/backend/package-info.java deleted file mode 100644 index 55439852c06..00000000000 --- a/examples/todo-app/backend/src/main/java/io/helidon/demo/todos/backend/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2017, 2021 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * TODOs Demo application backend. - */ -package io.helidon.demo.todos.backend; diff --git a/examples/todo-app/backend/src/main/java/io/helidon/demo/todos/backend/DbService.java b/examples/todo-app/backend/src/main/java/io/helidon/examples/todos/backend/DbService.java similarity index 99% rename from examples/todo-app/backend/src/main/java/io/helidon/demo/todos/backend/DbService.java rename to examples/todo-app/backend/src/main/java/io/helidon/examples/todos/backend/DbService.java index 4752ccebb1f..2c744e373fc 100644 --- a/examples/todo-app/backend/src/main/java/io/helidon/demo/todos/backend/DbService.java +++ b/examples/todo-app/backend/src/main/java/io/helidon/examples/todos/backend/DbService.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021 Oracle and/or its affiliates. + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.demo.todos.backend; +package io.helidon.examples.todos.backend; import java.util.ArrayList; import java.util.Date; diff --git a/examples/todo-app/backend/src/main/java/io/helidon/demo/todos/backend/JaxRsBackendResource.java b/examples/todo-app/backend/src/main/java/io/helidon/examples/todos/backend/JaxRsBackendResource.java similarity index 98% rename from examples/todo-app/backend/src/main/java/io/helidon/demo/todos/backend/JaxRsBackendResource.java rename to examples/todo-app/backend/src/main/java/io/helidon/examples/todos/backend/JaxRsBackendResource.java index d6efe1cf7fc..7e15f5023c2 100644 --- a/examples/todo-app/backend/src/main/java/io/helidon/demo/todos/backend/JaxRsBackendResource.java +++ b/examples/todo-app/backend/src/main/java/io/helidon/examples/todos/backend/JaxRsBackendResource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022 Oracle and/or its affiliates. + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.demo.todos.backend; +package io.helidon.examples.todos.backend; import java.util.Collections; import java.util.UUID; diff --git a/examples/todo-app/backend/src/main/java/io/helidon/examples/todos/backend/Main.java b/examples/todo-app/backend/src/main/java/io/helidon/examples/todos/backend/Main.java new file mode 100644 index 00000000000..281d6722d2d --- /dev/null +++ b/examples/todo-app/backend/src/main/java/io/helidon/examples/todos/backend/Main.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.examples.todos.backend; + +import java.util.List; + +import io.helidon.config.Config; +import io.helidon.logging.common.LogConfig; +import io.helidon.microprofile.server.Server; + +import static io.helidon.config.ConfigSources.classpath; +import static io.helidon.config.ConfigSources.environmentVariables; +import static io.helidon.config.ConfigSources.file; + +/** + * Main class to start the service. + */ +public final class Main { + + /** + * Cannot be instantiated. + */ + private Main() { + } + + /** + * Application main entry point. + * + * @param args command line arguments + */ + public static void main(final String[] args) { + + // load logging configuration + LogConfig.configureRuntime(); + + Config config = buildConfig(); + + // as we need to use custom filter + // we need to build Server with custom config + Server server = Server.builder() + .config(config) + .build(); + + server.start(); + } + + /** + * Load the configuration from all sources. + * @return the configuration root + */ + static Config buildConfig() { + return Config.builder() + .sources(List.of( + environmentVariables(), + // expected on development machine + // to override props for dev + file("dev.yaml").optional(), + // expected in k8s runtime + // to configure testing/production values + file("prod.yaml").optional(), + // in jar file + // (see src/main/resources/application.yaml) + classpath("application.yaml"))) + // support for passwords in configuration +// .addFilter(SecureConfigFilter.fromConfig()) + .build(); + } +} diff --git a/examples/todo-app/backend/src/main/java/io/helidon/demo/todos/backend/Todo.java b/examples/todo-app/backend/src/main/java/io/helidon/examples/todos/backend/Todo.java similarity index 98% rename from examples/todo-app/backend/src/main/java/io/helidon/demo/todos/backend/Todo.java rename to examples/todo-app/backend/src/main/java/io/helidon/examples/todos/backend/Todo.java index f4262bf5629..12128f391b6 100644 --- a/examples/todo-app/backend/src/main/java/io/helidon/demo/todos/backend/Todo.java +++ b/examples/todo-app/backend/src/main/java/io/helidon/examples/todos/backend/Todo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021 Oracle and/or its affiliates. + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.demo.todos.backend; +package io.helidon.examples.todos.backend; import java.time.Instant; import java.time.format.DateTimeFormatter; diff --git a/examples/todo-app/backend/src/main/java/io/helidon/examples/todos/backend/package-info.java b/examples/todo-app/backend/src/main/java/io/helidon/examples/todos/backend/package-info.java new file mode 100644 index 00000000000..662a11d74f9 --- /dev/null +++ b/examples/todo-app/backend/src/main/java/io/helidon/examples/todos/backend/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * TODOs Demo application backend. + */ +package io.helidon.examples.todos.backend; diff --git a/examples/todo-app/backend/src/main/resources/logging.properties b/examples/todo-app/backend/src/main/resources/logging.properties index 0dbac3eb301..3543f0f4e1c 100644 --- a/examples/todo-app/backend/src/main/resources/logging.properties +++ b/examples/todo-app/backend/src/main/resources/logging.properties @@ -20,7 +20,7 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ #All log level details .level=WARNING -io.helidon.nima.webserver.level=INFO +io.helidon.webserver.level=INFO io.helidon.security.level=INFO io.helidon.tracing.level=FINE AUDIT.level=FINEST diff --git a/examples/todo-app/backend/src/test/java/io/helidon/demo/todos/backend/BackendTests.java b/examples/todo-app/backend/src/test/java/io/helidon/examples/todos/backend/BackendTests.java similarity index 98% rename from examples/todo-app/backend/src/test/java/io/helidon/demo/todos/backend/BackendTests.java rename to examples/todo-app/backend/src/test/java/io/helidon/examples/todos/backend/BackendTests.java index 519b6b6d86a..1ff2b1acc21 100644 --- a/examples/todo-app/backend/src/test/java/io/helidon/demo/todos/backend/BackendTests.java +++ b/examples/todo-app/backend/src/test/java/io/helidon/examples/todos/backend/BackendTests.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.helidon.demo.todos.backend; +package io.helidon.examples.todos.backend; import java.io.IOException; import java.util.Base64; import java.util.Properties; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.config.mp.MpConfigSources; import io.helidon.config.yaml.mp.YamlMpConfigSource; import io.helidon.microprofile.tests.junit5.Configuration; diff --git a/examples/todo-app/frontend/pom.xml b/examples/todo-app/frontend/pom.xml index 15ee08c7957..c65ead66da7 100644 --- a/examples/todo-app/frontend/pom.xml +++ b/examples/todo-app/frontend/pom.xml @@ -36,7 +36,7 @@ - io.helidon.demo.todos.frontend.Main + io.helidon.examples.todos.frontend.Main ${mainClass} v12.16.1 6.13.4 @@ -46,24 +46,24 @@ - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.nima.webclient - helidon-nima-webclient-security + io.helidon.webclient + helidon-webclient-security - io.helidon.nima.http.media - helidon-nima-http-media-jsonp + io.helidon.http.media + helidon-http-media-jsonp - io.helidon.nima.observe - helidon-nima-observe + io.helidon.webserver.observe + helidon-webserver-observe - io.helidon.security.integration - helidon-security-integration-nima + io.helidon.webserver + helidon-webserver-security io.helidon.common @@ -74,12 +74,12 @@ helidon-metrics - io.helidon.nima.webserver - helidon-nima-webserver-static-content + io.helidon.webserver + helidon-webserver-static-content - io.helidon.nima.webserver - helidon-nima-webserver-access-log + io.helidon.webserver + helidon-webserver-access-log io.helidon.tracing @@ -102,8 +102,8 @@ helidon-security-providers-google-login - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test diff --git a/examples/todo-app/frontend/src/main/java/io/helidon/demo/todos/frontend/Main.java b/examples/todo-app/frontend/src/main/java/io/helidon/demo/todos/frontend/Main.java deleted file mode 100644 index 6e1f68aaea1..00000000000 --- a/examples/todo-app/frontend/src/main/java/io/helidon/demo/todos/frontend/Main.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2017, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.demo.todos.frontend; - -import java.util.List; - -import io.helidon.config.Config; -import io.helidon.config.FileSystemWatcher; -import io.helidon.logging.common.LogConfig; -import io.helidon.nima.observe.ObserveFeature; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.security.WebClientSecurity; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.accesslog.AccessLogFeature; -import io.helidon.nima.webserver.staticcontent.StaticContentService; -import io.helidon.security.Security; -import io.helidon.security.integration.nima.SecurityFeature; -import io.helidon.tracing.Tracer; -import io.helidon.tracing.TracerBuilder; - -import static io.helidon.config.ConfigSources.classpath; -import static io.helidon.config.ConfigSources.environmentVariables; -import static io.helidon.config.ConfigSources.file; -import static io.helidon.config.PollingStrategies.regular; -import static java.time.Duration.ofSeconds; - -/** - * Main class to start the service. - */ -public final class Main { - - /** - * Interval for config polling. - */ - private static final Long POLLING_INTERVAL = 5L; - - /** - * Cannot be instantiated. - */ - private Main() { - } - - /** - * Application main entry point. - * - * @param args command line arguments - */ - public static void main(final String[] args) { - - // load logging configuration - LogConfig.configureRuntime(); - - // needed for default connection of Jersey client - // to allow our headers to be set - System.setProperty("sun.net.http.allowRestrictedHeaders", "true"); - - // to allow us to set host header explicitly - System.setProperty("sun.net.http.allowRestrictedHeaders", "true"); - - WebServerConfig.Builder builder = WebServer.builder(); - setup(builder); - WebServer server = builder.build(); - - // start the web server - server.start(); - System.out.println("WEB server is up! http://localhost:" + server.port()); - } - - private static void setup(WebServerConfig.Builder server) { - - Config config = buildConfig(); - - Security security = Security.create(config.get("security")); - - Http1Client client = Http1Client.builder().baseUri(config.get("services.backend.endpoint").asString().get()) - .addService(WebClientSecurity.create()) - .build(); - - BackendServiceClient bsc = new BackendServiceClient(client); - - Tracer tracer = TracerBuilder.create(config.get("tracing")).build(); - - server.config(config.get("webserver")) - .routing(routing -> routing - .addFeature(AccessLogFeature.create()) - .addFeature(ObserveFeature.create()) - .addFeature(SecurityFeature.create(security, config.get("security"))) - // register static content support (on "/") - .register(StaticContentService.builder("/WEB").welcomeFileName("index.html")) - // register API handler (on "/api") - this path is secured (see application.yaml) - .register("/api", new TodosHandler(bsc, tracer)) - // and a simple environment handler to see where we are - .register("/env", new EnvHandler(config))); - } - - /** - * Load the configuration from all sources. - * @return the configuration root - */ - private static Config buildConfig() { - return Config.builder() - .sources(List.of( - environmentVariables(), - // expected on development machine - // to override props for dev - file("dev.yaml") - .changeWatcher(FileSystemWatcher.create()) - .optional(), - // expected in k8s runtime - // to configure testing/production values - file("prod.yaml") - .pollingStrategy(regular( - ofSeconds(POLLING_INTERVAL))) - .optional(), - // in jar file - // (see src/main/resources/application.yaml) - classpath("application.yaml"))) - .build(); - } -} diff --git a/examples/todo-app/frontend/src/main/java/io/helidon/demo/todos/frontend/package-info.java b/examples/todo-app/frontend/src/main/java/io/helidon/demo/todos/frontend/package-info.java deleted file mode 100644 index 666616a7b8c..00000000000 --- a/examples/todo-app/frontend/src/main/java/io/helidon/demo/todos/frontend/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2018, 2021 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * TODOs Demo application frontend. - */ -package io.helidon.demo.todos.frontend; diff --git a/examples/todo-app/frontend/src/main/java/io/helidon/demo/todos/frontend/BackendServiceClient.java b/examples/todo-app/frontend/src/main/java/io/helidon/examples/todos/frontend/BackendServiceClient.java similarity index 94% rename from examples/todo-app/frontend/src/main/java/io/helidon/demo/todos/frontend/BackendServiceClient.java rename to examples/todo-app/frontend/src/main/java/io/helidon/examples/todos/frontend/BackendServiceClient.java index 216e6904d14..c0386f9ad57 100644 --- a/examples/todo-app/frontend/src/main/java/io/helidon/demo/todos/frontend/BackendServiceClient.java +++ b/examples/todo-app/frontend/src/main/java/io/helidon/examples/todos/frontend/BackendServiceClient.java @@ -14,17 +14,17 @@ * limitations under the License. */ -package io.helidon.demo.todos.frontend; +package io.helidon.examples.todos.frontend; import java.util.Optional; -import io.helidon.common.http.Http; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.Http; import io.helidon.tracing.Span; import io.helidon.tracing.SpanContext; import io.helidon.tracing.Tracer; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.http.ServerResponse; import jakarta.json.JsonArray; import jakarta.json.JsonObject; diff --git a/examples/todo-app/frontend/src/main/java/io/helidon/demo/todos/frontend/EnvHandler.java b/examples/todo-app/frontend/src/main/java/io/helidon/examples/todos/frontend/EnvHandler.java similarity index 90% rename from examples/todo-app/frontend/src/main/java/io/helidon/demo/todos/frontend/EnvHandler.java rename to examples/todo-app/frontend/src/main/java/io/helidon/examples/todos/frontend/EnvHandler.java index 763c2eab62e..7289259575f 100644 --- a/examples/todo-app/frontend/src/main/java/io/helidon/demo/todos/frontend/EnvHandler.java +++ b/examples/todo-app/frontend/src/main/java/io/helidon/examples/todos/frontend/EnvHandler.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.helidon.demo.todos.frontend; +package io.helidon.examples.todos.frontend; import io.helidon.config.Config; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; /** * Handles response to current environment name. diff --git a/examples/todo-app/frontend/src/main/java/io/helidon/examples/todos/frontend/Main.java b/examples/todo-app/frontend/src/main/java/io/helidon/examples/todos/frontend/Main.java new file mode 100644 index 00000000000..2b1d2215159 --- /dev/null +++ b/examples/todo-app/frontend/src/main/java/io/helidon/examples/todos/frontend/Main.java @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.examples.todos.frontend; + +import java.util.List; + +import io.helidon.config.Config; +import io.helidon.config.FileSystemWatcher; +import io.helidon.logging.common.LogConfig; +import io.helidon.security.Security; +import io.helidon.tracing.Tracer; +import io.helidon.tracing.TracerBuilder; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.security.WebClientSecurity; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.accesslog.AccessLogFeature; +import io.helidon.webserver.observe.ObserveFeature; +import io.helidon.webserver.security.SecurityFeature; +import io.helidon.webserver.staticcontent.StaticContentService; + +import static io.helidon.config.ConfigSources.classpath; +import static io.helidon.config.ConfigSources.environmentVariables; +import static io.helidon.config.ConfigSources.file; +import static io.helidon.config.PollingStrategies.regular; +import static java.time.Duration.ofSeconds; + +/** + * Main class to start the service. + */ +public final class Main { + + /** + * Interval for config polling. + */ + private static final Long POLLING_INTERVAL = 5L; + + /** + * Cannot be instantiated. + */ + private Main() { + } + + /** + * Application main entry point. + * + * @param args command line arguments + */ + public static void main(final String[] args) { + + // load logging configuration + LogConfig.configureRuntime(); + + // needed for default connection of Jersey client + // to allow our headers to be set + System.setProperty("sun.net.http.allowRestrictedHeaders", "true"); + + // to allow us to set host header explicitly + System.setProperty("sun.net.http.allowRestrictedHeaders", "true"); + + WebServerConfig.Builder builder = WebServer.builder(); + setup(builder); + WebServer server = builder.build(); + + // start the web server + server.start(); + System.out.println("WEB server is up! http://localhost:" + server.port()); + } + + private static void setup(WebServerConfig.Builder server) { + + Config config = buildConfig(); + + Security security = Security.create(config.get("security")); + + Http1Client client = Http1Client.builder().baseUri(config.get("services.backend.endpoint").asString().get()) + .addService(WebClientSecurity.create()) + .build(); + + BackendServiceClient bsc = new BackendServiceClient(client); + + Tracer tracer = TracerBuilder.create(config.get("tracing")).build(); + + server.config(config.get("webserver")) + .routing(routing -> routing + .addFeature(AccessLogFeature.create()) + .addFeature(ObserveFeature.create()) + .addFeature(SecurityFeature.create(security, config.get("security"))) + // register static content support (on "/") + .register(StaticContentService.builder("/WEB").welcomeFileName("index.html")) + // register API handler (on "/api") - this path is secured (see application.yaml) + .register("/api", new TodosHandler(bsc, tracer)) + // and a simple environment handler to see where we are + .register("/env", new EnvHandler(config))); + } + + /** + * Load the configuration from all sources. + * @return the configuration root + */ + private static Config buildConfig() { + return Config.builder() + .sources(List.of( + environmentVariables(), + // expected on development machine + // to override props for dev + file("dev.yaml") + .changeWatcher(FileSystemWatcher.create()) + .optional(), + // expected in k8s runtime + // to configure testing/production values + file("prod.yaml") + .pollingStrategy(regular( + ofSeconds(POLLING_INTERVAL))) + .optional(), + // in jar file + // (see src/main/resources/application.yaml) + classpath("application.yaml"))) + .build(); + } +} diff --git a/examples/todo-app/frontend/src/main/java/io/helidon/demo/todos/frontend/TodosHandler.java b/examples/todo-app/frontend/src/main/java/io/helidon/examples/todos/frontend/TodosHandler.java similarity index 95% rename from examples/todo-app/frontend/src/main/java/io/helidon/demo/todos/frontend/TodosHandler.java rename to examples/todo-app/frontend/src/main/java/io/helidon/examples/todos/frontend/TodosHandler.java index 87304ea64ab..05971ec127b 100644 --- a/examples/todo-app/frontend/src/main/java/io/helidon/demo/todos/frontend/TodosHandler.java +++ b/examples/todo-app/frontend/src/main/java/io/helidon/examples/todos/frontend/TodosHandler.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package io.helidon.demo.todos.frontend; +package io.helidon.examples.todos.frontend; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.metrics.api.RegistryFactory; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; import io.helidon.tracing.Span; import io.helidon.tracing.Tracer; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import jakarta.json.JsonArray; import jakarta.json.JsonObject; diff --git a/examples/todo-app/frontend/src/main/java/io/helidon/examples/todos/frontend/package-info.java b/examples/todo-app/frontend/src/main/java/io/helidon/examples/todos/frontend/package-info.java new file mode 100644 index 00000000000..e730de0746e --- /dev/null +++ b/examples/todo-app/frontend/src/main/java/io/helidon/examples/todos/frontend/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2018, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * TODOs Demo application frontend. + */ +package io.helidon.examples.todos.frontend; diff --git a/examples/todo-app/frontend/src/main/resources/logging.properties b/examples/todo-app/frontend/src/main/resources/logging.properties index 0dbac3eb301..3543f0f4e1c 100644 --- a/examples/todo-app/frontend/src/main/resources/logging.properties +++ b/examples/todo-app/frontend/src/main/resources/logging.properties @@ -20,7 +20,7 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ #All log level details .level=WARNING -io.helidon.nima.webserver.level=INFO +io.helidon.webserver.level=INFO io.helidon.security.level=INFO io.helidon.tracing.level=FINE AUDIT.level=FINEST diff --git a/examples/todo-app/frontend/src/test/java/io/helidon/demo/todos/frontend/FrontendTest.java b/examples/todo-app/frontend/src/test/java/io/helidon/examples/todos/frontend/FrontendTest.java similarity index 88% rename from examples/todo-app/frontend/src/test/java/io/helidon/demo/todos/frontend/FrontendTest.java rename to examples/todo-app/frontend/src/test/java/io/helidon/examples/todos/frontend/FrontendTest.java index 293b6398b28..35f007d97e0 100644 --- a/examples/todo-app/frontend/src/test/java/io/helidon/demo/todos/frontend/FrontendTest.java +++ b/examples/todo-app/frontend/src/test/java/io/helidon/examples/todos/frontend/FrontendTest.java @@ -14,23 +14,23 @@ * limitations under the License. */ -package io.helidon.demo.todos.frontend; +package io.helidon.examples.todos.frontend; import java.util.Base64; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.config.Config; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.context.ContextFeature; -import io.helidon.nima.webserver.http.HttpRoute; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.context.ContextFeature; +import io.helidon.webserver.http.HttpRoute; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; import io.helidon.security.Security; -import io.helidon.security.integration.nima.SecurityFeature; +import io.helidon.webserver.security.SecurityFeature; import io.helidon.tracing.Tracer; import jakarta.json.Json; diff --git a/examples/translator-app/backend/pom.xml b/examples/translator-app/backend/pom.xml index 2c0657ca579..439e9c6aec7 100644 --- a/examples/translator-app/backend/pom.xml +++ b/examples/translator-app/backend/pom.xml @@ -42,8 +42,8 @@ - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver io.helidon.config @@ -54,8 +54,8 @@ helidon-tracing-providers-zipkin - io.helidon.nima.webserver - helidon-nima-webserver-tracing + io.helidon.webserver + helidon-webserver-tracing diff --git a/examples/translator-app/backend/src/main/java/io/helidon/examples/translator/backend/Main.java b/examples/translator-app/backend/src/main/java/io/helidon/examples/translator/backend/Main.java index 86c15538c99..8467f5957bb 100644 --- a/examples/translator-app/backend/src/main/java/io/helidon/examples/translator/backend/Main.java +++ b/examples/translator-app/backend/src/main/java/io/helidon/examples/translator/backend/Main.java @@ -19,11 +19,11 @@ import io.helidon.config.Config; import io.helidon.config.ConfigSources; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.tracing.TracingFeature; import io.helidon.tracing.Tracer; import io.helidon.tracing.TracerBuilder; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.tracing.TracingFeature; /** * Translator application backend main class. diff --git a/examples/translator-app/backend/src/main/java/io/helidon/examples/translator/backend/TranslatorBackendService.java b/examples/translator-app/backend/src/main/java/io/helidon/examples/translator/backend/TranslatorBackendService.java index a8766663601..08de0ae432a 100644 --- a/examples/translator-app/backend/src/main/java/io/helidon/examples/translator/backend/TranslatorBackendService.java +++ b/examples/translator-app/backend/src/main/java/io/helidon/examples/translator/backend/TranslatorBackendService.java @@ -18,12 +18,12 @@ import java.util.HashMap; import java.util.Map; -import io.helidon.common.http.BadRequestException; -import io.helidon.common.http.NotFoundException; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.BadRequestException; +import io.helidon.http.NotFoundException; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; /** * Translator backend service. diff --git a/examples/translator-app/backend/src/main/resources/logging.properties b/examples/translator-app/backend/src/main/resources/logging.properties index 1ed82007e7d..f5eaea51888 100644 --- a/examples/translator-app/backend/src/main/resources/logging.properties +++ b/examples/translator-app/backend/src/main/resources/logging.properties @@ -22,5 +22,5 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ #All log level details .level=INFO -io.helidon.nima.webserver.level=FINEST +io.helidon.webserver.level=FINEST org.glassfish.jersey.internal.Errors.level=SEVERE diff --git a/examples/translator-app/frontend/pom.xml b/examples/translator-app/frontend/pom.xml index 167c7b7ff91..e8e47b406a1 100644 --- a/examples/translator-app/frontend/pom.xml +++ b/examples/translator-app/frontend/pom.xml @@ -42,16 +42,16 @@ - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.nima.webserver - helidon-nima-webserver-tracing + io.helidon.webserver + helidon-webserver-tracing - io.helidon.nima.webclient - helidon-nima-webclient + io.helidon.webclient + helidon-webclient io.helidon.config @@ -66,8 +66,8 @@ helidon-common - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test diff --git a/examples/translator-app/frontend/src/main/java/io/helidon/examples/translator/frontend/Main.java b/examples/translator-app/frontend/src/main/java/io/helidon/examples/translator/frontend/Main.java index 18afc303dae..17ecde4aa74 100644 --- a/examples/translator-app/frontend/src/main/java/io/helidon/examples/translator/frontend/Main.java +++ b/examples/translator-app/frontend/src/main/java/io/helidon/examples/translator/frontend/Main.java @@ -19,11 +19,11 @@ import io.helidon.config.Config; import io.helidon.config.ConfigSources; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.tracing.TracingFeature; import io.helidon.tracing.Tracer; import io.helidon.tracing.TracerBuilder; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.tracing.TracingFeature; /** * Translator application frontend main class. diff --git a/examples/translator-app/frontend/src/main/java/io/helidon/examples/translator/frontend/TranslatorFrontendService.java b/examples/translator-app/frontend/src/main/java/io/helidon/examples/translator/frontend/TranslatorFrontendService.java index 3b7936bde1d..fec518b5681 100644 --- a/examples/translator-app/frontend/src/main/java/io/helidon/examples/translator/frontend/TranslatorFrontendService.java +++ b/examples/translator-app/frontend/src/main/java/io/helidon/examples/translator/frontend/TranslatorFrontendService.java @@ -18,14 +18,14 @@ import java.util.logging.Level; import java.util.logging.Logger; -import io.helidon.common.http.BadRequestException; -import io.helidon.common.http.Http; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.BadRequestException; +import io.helidon.http.Http; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; /** * Translator frontend resource. diff --git a/examples/translator-app/frontend/src/main/resources/logging.properties b/examples/translator-app/frontend/src/main/resources/logging.properties index 1ed82007e7d..f5eaea51888 100644 --- a/examples/translator-app/frontend/src/main/resources/logging.properties +++ b/examples/translator-app/frontend/src/main/resources/logging.properties @@ -22,5 +22,5 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ #All log level details .level=INFO -io.helidon.nima.webserver.level=FINEST +io.helidon.webserver.level=FINEST org.glassfish.jersey.internal.Errors.level=SEVERE diff --git a/examples/translator-app/frontend/src/test/java/io/helidon/examples/translator/TranslatorTest.java b/examples/translator-app/frontend/src/test/java/io/helidon/examples/translator/TranslatorTest.java index fb5373ab948..18783ac9cfa 100644 --- a/examples/translator-app/frontend/src/test/java/io/helidon/examples/translator/TranslatorTest.java +++ b/examples/translator-app/frontend/src/test/java/io/helidon/examples/translator/TranslatorTest.java @@ -18,11 +18,11 @@ import io.helidon.examples.translator.backend.TranslatorBackendService; import io.helidon.examples.translator.frontend.TranslatorFrontendService; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.WebServerConfig; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.WebServerConfig; import org.junit.jupiter.api.Test; diff --git a/examples/webclient/pom.xml b/examples/webclient/pom.xml index 364108c1cb5..4bc21e7ea06 100644 --- a/examples/webclient/pom.xml +++ b/examples/webclient/pom.xml @@ -27,7 +27,7 @@ io.helidon.examples.webclient helidon-examples-webclient-project - Helidon WebClient Example + Helidon Examples WebClient pom diff --git a/examples/webclient/standalone/pom.xml b/examples/webclient/standalone/pom.xml index 2db3990b1d4..c3d543973b8 100644 --- a/examples/webclient/standalone/pom.xml +++ b/examples/webclient/standalone/pom.xml @@ -19,7 +19,6 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - io.helidon.applications helidon-se @@ -28,7 +27,7 @@ helidon-examples-webclient-standalone - Helidon WebClient Standalone Example + Helidon Examples WebClient Standalone io.helidon.examples.webclient.standalone.ServerMain @@ -40,8 +39,8 @@ helidon-config-yaml - io.helidon.nima.http.media - helidon-nima-http-media-jsonp + io.helidon.http.media + helidon-http-media-jsonp io.helidon.metrics @@ -52,24 +51,24 @@ helidon-metrics - io.helidon.nima.webclient - helidon-nima-webclient + io.helidon.webclient + helidon-webclient - io.helidon.nima.webclient - helidon-nima-webclient-metrics + io.helidon.webclient + helidon-webclient-metrics - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.nima.observe - helidon-nima-observe + io.helidon.webserver.observe + helidon-webserver-observe - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test diff --git a/examples/webclient/standalone/src/main/java/io/helidon/examples/webclient/standalone/ClientMain.java b/examples/webclient/standalone/src/main/java/io/helidon/examples/webclient/standalone/ClientMain.java index 8c1f751c417..e09ea7d89ac 100644 --- a/examples/webclient/standalone/src/main/java/io/helidon/examples/webclient/standalone/ClientMain.java +++ b/examples/webclient/standalone/src/main/java/io/helidon/examples/webclient/standalone/ClientMain.java @@ -22,15 +22,15 @@ import java.nio.file.Paths; import java.util.Map; -import io.helidon.common.http.Http; import io.helidon.config.Config; import io.helidon.config.ConfigValue; +import io.helidon.http.Http; import io.helidon.metrics.api.Registry; import io.helidon.metrics.api.RegistryFactory; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.api.WebClient; -import io.helidon.nima.webclient.metrics.WebClientMetrics; -import io.helidon.nima.webclient.spi.WebClientService; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.api.WebClient; +import io.helidon.webclient.metrics.WebClientMetrics; +import io.helidon.webclient.spi.WebClientService; import jakarta.json.Json; import jakarta.json.JsonBuilderFactory; diff --git a/examples/webclient/standalone/src/main/java/io/helidon/examples/webclient/standalone/GreetService.java b/examples/webclient/standalone/src/main/java/io/helidon/examples/webclient/standalone/GreetService.java index ba491764fda..198f97b3f1d 100644 --- a/examples/webclient/standalone/src/main/java/io/helidon/examples/webclient/standalone/GreetService.java +++ b/examples/webclient/standalone/src/main/java/io/helidon/examples/webclient/standalone/GreetService.java @@ -18,13 +18,13 @@ import java.util.Collections; import java.util.concurrent.atomic.AtomicReference; -import io.helidon.common.http.Http; import io.helidon.config.Config; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.Http; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import jakarta.json.Json; import jakarta.json.JsonBuilderFactory; diff --git a/examples/webclient/standalone/src/main/java/io/helidon/examples/webclient/standalone/ServerMain.java b/examples/webclient/standalone/src/main/java/io/helidon/examples/webclient/standalone/ServerMain.java index 838c31208af..c2fed3a7553 100644 --- a/examples/webclient/standalone/src/main/java/io/helidon/examples/webclient/standalone/ServerMain.java +++ b/examples/webclient/standalone/src/main/java/io/helidon/examples/webclient/standalone/ServerMain.java @@ -16,10 +16,10 @@ package io.helidon.examples.webclient.standalone; import io.helidon.config.Config; -import io.helidon.nima.observe.ObserveFeature; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.observe.ObserveFeature; /** * The application main class. diff --git a/examples/webclient/standalone/src/test/java/io/helidon/examples/webclient/standalone/ClientMainTest.java b/examples/webclient/standalone/src/test/java/io/helidon/examples/webclient/standalone/ClientMainTest.java index 59fa615b8df..edd122532c5 100644 --- a/examples/webclient/standalone/src/test/java/io/helidon/examples/webclient/standalone/ClientMainTest.java +++ b/examples/webclient/standalone/src/test/java/io/helidon/examples/webclient/standalone/ClientMainTest.java @@ -24,12 +24,12 @@ import io.helidon.config.Config; import io.helidon.metrics.api.Registry; import io.helidon.metrics.api.RegistryFactory; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.api.WebClient; -import io.helidon.nima.webclient.spi.WebClientService; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webclient.api.WebClient; +import io.helidon.webclient.spi.WebClientService; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; import org.eclipse.microprofile.metrics.Counter; import org.eclipse.microprofile.metrics.MetricRegistry; diff --git a/examples/webserver/basic/pom.xml b/examples/webserver/basic/pom.xml new file mode 100644 index 00000000000..102d29726c3 --- /dev/null +++ b/examples/webserver/basic/pom.xml @@ -0,0 +1,83 @@ + + + + 4.0.0 + + io.helidon.applications + helidon-se + 4.0.0-SNAPSHOT + ../../../applications/se/pom.xml + + + io.helidon.examples.webserver + helidon-examples-webserver-basic + Helidon Examples WebServer Basic + + + io.helidon.examples.webserver.basic.BasicMain + + + + + io.helidon.webserver + helidon-webserver + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-libs + + + + + org.apache.maven.plugins + maven-failsafe-plugin + + + + integration-test + verify + + + + + + + diff --git a/examples/nima/basic/src/main/java/io/helidon/examples/nima/basic/BasicMain.java b/examples/webserver/basic/src/main/java/io/helidon/examples/webserver/basic/BasicMain.java similarity index 87% rename from examples/nima/basic/src/main/java/io/helidon/examples/nima/basic/BasicMain.java rename to examples/webserver/basic/src/main/java/io/helidon/examples/webserver/basic/BasicMain.java index 619f277226e..f74d2eb6f7c 100644 --- a/examples/nima/basic/src/main/java/io/helidon/examples/nima/basic/BasicMain.java +++ b/examples/webserver/basic/src/main/java/io/helidon/examples/webserver/basic/BasicMain.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.helidon.examples.nima.basic; +package io.helidon.examples.webserver.basic; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.HttpRouting; /** * As simple as possible with a fixed port. @@ -39,7 +39,7 @@ public static void main(String[] args) { /* WebServer.builder() .port(8080) - .routing(router -> router.get("/*", (req, res) -> res.send("Níma Works!"))) + .routing(router -> router.get("/*", (req, res) -> res.send("WebServer Works!"))) .start(); */ WebServer.builder() @@ -56,6 +56,6 @@ public static void main(String[] args) { * @param router HTTP routing builder to configure routes for this service */ static void routing(HttpRouting.Builder router) { - router.get("/*", (req, res) -> res.send("Níma Works!")); + router.get("/*", (req, res) -> res.send("WebServer Works!")); } } diff --git a/examples/webserver/basic/src/main/java/io/helidon/examples/webserver/basic/package-info.java b/examples/webserver/basic/src/main/java/io/helidon/examples/webserver/basic/package-info.java new file mode 100644 index 00000000000..1edd0ca72f3 --- /dev/null +++ b/examples/webserver/basic/src/main/java/io/helidon/examples/webserver/basic/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Basic example. + */ +package io.helidon.examples.webserver.basic; diff --git a/examples/webserver/basic/src/main/resources/logging.properties b/examples/webserver/basic/src/main/resources/logging.properties new file mode 100644 index 00000000000..d09df1098a3 --- /dev/null +++ b/examples/webserver/basic/src/main/resources/logging.properties @@ -0,0 +1,20 @@ +# +# Copyright (c) 2022, 2023 Oracle and/or its affiliates. +# +# 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. +# +handlers=java.util.logging.ConsoleHandler +java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS.%1$tL %5$s%6$s%n +# Global logging level. Can be overridden by specific loggers +.level=INFO +io.helidon.webserver.level=INFO diff --git a/examples/nima/basic/src/test/java/io/helidon/examples/nima/basic/AbstractBasicRoutingTest.java b/examples/webserver/basic/src/test/java/io/helidon/examples/webserver/basic/AbstractBasicRoutingTest.java similarity index 78% rename from examples/nima/basic/src/test/java/io/helidon/examples/nima/basic/AbstractBasicRoutingTest.java rename to examples/webserver/basic/src/test/java/io/helidon/examples/webserver/basic/AbstractBasicRoutingTest.java index f9a7037557b..d3900c59719 100644 --- a/examples/nima/basic/src/test/java/io/helidon/examples/nima/basic/AbstractBasicRoutingTest.java +++ b/examples/webserver/basic/src/test/java/io/helidon/examples/webserver/basic/AbstractBasicRoutingTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.helidon.examples.nima.basic; +package io.helidon.examples.webserver.basic; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webserver.http.HttpRouting; import org.junit.jupiter.api.Test; @@ -43,7 +43,7 @@ void testRootRoute() { .request() .as(String.class); - assertThat(response, is("Níma Works!")); + assertThat(response, is("WebServer Works!")); } @Test @@ -52,6 +52,6 @@ void testOtherRoute() { .request() .as(String.class); - assertThat(response, is("Níma Works!")); + assertThat(response, is("WebServer Works!")); } } diff --git a/examples/nima/basic/src/test/java/io/helidon/examples/nima/basic/BasicRoutingIT.java b/examples/webserver/basic/src/test/java/io/helidon/examples/webserver/basic/BasicRoutingIT.java similarity index 79% rename from examples/nima/basic/src/test/java/io/helidon/examples/nima/basic/BasicRoutingIT.java rename to examples/webserver/basic/src/test/java/io/helidon/examples/webserver/basic/BasicRoutingIT.java index e5736fb495d..3fdb32e1bc1 100644 --- a/examples/nima/basic/src/test/java/io/helidon/examples/nima/basic/BasicRoutingIT.java +++ b/examples/webserver/basic/src/test/java/io/helidon/examples/webserver/basic/BasicRoutingIT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.helidon.examples.nima.basic; +package io.helidon.examples.webserver.basic; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.webclient.http1.Http1Client; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webclient.http1.Http1Client; /** * An integration test that starts the server and invokes the routing through HTTP. diff --git a/examples/nima/basic/src/test/java/io/helidon/examples/nima/basic/BasicRoutingTest.java b/examples/webserver/basic/src/test/java/io/helidon/examples/webserver/basic/BasicRoutingTest.java similarity index 79% rename from examples/nima/basic/src/test/java/io/helidon/examples/nima/basic/BasicRoutingTest.java rename to examples/webserver/basic/src/test/java/io/helidon/examples/webserver/basic/BasicRoutingTest.java index c748c91aaf3..fd898ef8603 100644 --- a/examples/nima/basic/src/test/java/io/helidon/examples/nima/basic/BasicRoutingTest.java +++ b/examples/webserver/basic/src/test/java/io/helidon/examples/webserver/basic/BasicRoutingTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.helidon.examples.nima.basic; +package io.helidon.examples.webserver.basic; -import io.helidon.nima.testing.junit5.webserver.DirectClient; -import io.helidon.nima.testing.junit5.webserver.RoutingTest; +import io.helidon.webserver.testing.junit5.DirectClient; +import io.helidon.webserver.testing.junit5.RoutingTest; /** * A unit test that does not start the server and invokes the routing directly, with no network traffic. diff --git a/examples/webserver/basic/src/test/resources/logging-test.properties b/examples/webserver/basic/src/test/resources/logging-test.properties new file mode 100644 index 00000000000..e0e9004a51a --- /dev/null +++ b/examples/webserver/basic/src/test/resources/logging-test.properties @@ -0,0 +1,22 @@ +# +# Copyright (c) 2022, 2023 Oracle and/or its affiliates. +# +# 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. +# +handlers=java.util.logging.ConsoleHandler +java.util.logging.ConsoleHandler.level=FINEST +java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter +# java.util.logging.SimpleFormatter.format = [%1$tc] %5$s %6$s%n +java.util.logging.SimpleFormatter.format=%1$tH:%1$tM:%1$tS %5$s%6$s%n +# Global logging level. Can be overridden by specific loggers +.level=WARNING diff --git a/examples/webserver/basics/pom.xml b/examples/webserver/basics/pom.xml index ab3ef286d78..7603abd4993 100644 --- a/examples/webserver/basics/pom.xml +++ b/examples/webserver/basics/pom.xml @@ -29,33 +29,33 @@ io.helidon.examples.webserver helidon-examples-webserver-basics - Helidon WebServer Examples Basics + Helidon Examples WebServer Basics Examples of elementary use of the Web Server - io.helidon.webserver.examples.basics.Main + io.helidon.examples.webserver.basics.Main - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.nima.webserver - helidon-nima-webserver-static-content + io.helidon.webserver + helidon-webserver-static-content - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test - io.helidon.nima.http.media - helidon-nima-http-media-jsonp + io.helidon.http.media + helidon-http-media-jsonp org.junit.jupiter diff --git a/examples/webserver/basics/src/main/java/io/helidon/webserver/examples/basics/Catalog.java b/examples/webserver/basics/src/main/java/io/helidon/examples/webserver/basics/Catalog.java similarity index 82% rename from examples/webserver/basics/src/main/java/io/helidon/webserver/examples/basics/Catalog.java rename to examples/webserver/basics/src/main/java/io/helidon/examples/webserver/basics/Catalog.java index a1a8995457d..108e5d5af31 100644 --- a/examples/webserver/basics/src/main/java/io/helidon/webserver/examples/basics/Catalog.java +++ b/examples/webserver/basics/src/main/java/io/helidon/examples/webserver/basics/Catalog.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.webserver.examples.basics; +package io.helidon.examples.webserver.basics; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; /** * Skeleton example of catalog resource use in {@link Main} class. diff --git a/examples/webserver/basics/src/main/java/io/helidon/examples/webserver/basics/Main.java b/examples/webserver/basics/src/main/java/io/helidon/examples/webserver/basics/Main.java new file mode 100644 index 00000000000..11d4f8bbecb --- /dev/null +++ b/examples/webserver/basics/src/main/java/io/helidon/examples/webserver/basics/Main.java @@ -0,0 +1,368 @@ +/* + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.examples.webserver.basics; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.lang.reflect.Parameter; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import io.helidon.common.media.type.MediaTypes; +import io.helidon.http.Http; +import io.helidon.http.HttpException; +import io.helidon.http.ServerRequestHeaders; +import io.helidon.http.media.EntityReader; +import io.helidon.http.media.MediaContext; +import io.helidon.http.media.MediaContextConfig; +import io.helidon.http.media.ReadableEntity; +import io.helidon.http.media.jsonp.JsonpSupport; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.ErrorHandler; +import io.helidon.webserver.http.Handler; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; +import io.helidon.webserver.staticcontent.StaticContentService; + +import jakarta.json.Json; +import jakarta.json.JsonBuilderFactory; + +/** + * This example consists of few first tutorial steps of WebServer API. Each step is represented by a single method. + *

+ * Principles: + *

    + *
  • Reactive principles
  • + *
  • Reflection free
  • + *
  • Fluent
  • + *
  • Integration platform
  • + *
+ *

+ * It is also java executable main class. Use a method name as a command line parameter to execute. + */ +public class Main { + + private static final JsonBuilderFactory JSON = Json.createBuilderFactory(Collections.emptyMap()); + private static final Http.HeaderName BAR_HEADER = Http.HeaderNames.create("bar"); + private static final Http.HeaderName FOO_HEADER = Http.HeaderNames.create("foo"); + + // ---------------- EXAMPLES + + /** + * True heart of WebServer API is {@link HttpRouting}. + * It provides fluent way how to assign custom {@link Handler} to the routing rule. + * The rule consists from two main factors - HTTP method and path pattern. + *

+ * The (route) {@link Handler} is a functional interface which process HTTP {@link ServerRequest request} and + * writes to the {@link ServerResponse response}. + * + * @param routing routing builder + */ + public static void firstRouting(HttpRouting.Builder routing) { + routing.post("/firstRouting/post-endpoint", (req, res) -> res.status(Http.Status.CREATED_201) + .send()) + .get("/firstRouting/get-endpoint", (req, res) -> res.status(Http.Status.OK_200) + .send("Hello World!")); + } + + /** + * All routing rules (routes) are evaluated in a definition order. The {@link Handler} assigned with the first valid route + * for given request is called. It is a responsibility of each handler to process in one of the following ways: + *

    + *
  • Respond using one of {@link ServerResponse#send() ServerResponse.send(...)} method.
  • + *
  • Continue to next valid route using {@link ServerResponse#next() ServerRequest.next()} method. + * It is possible to define filtering handlers.
  • + *
+ *

+ * If no valid {@link Handler} is found then routing respond by {@code HTTP 404} code. + *

+ * If selected {@link Handler} doesn't process request than the request stacks! + *

+ * Blocking operations:
+ * For performance reason, {@link Handler} can be called directly by a selector thread. It is not good idea to block + * such thread. If request must be processed by a blocking operation then such processing should be deferred to another + * thread. + * + * @param routing routing builder + */ + public static void routingAsFilter(HttpRouting.Builder routing) { + routing.any("/routingAsFilter/*", (req, res) -> { + System.out.println(req.prologue().method() + " " + req.path()); + // Filters are just routing handlers which calls next() + res.next(); + }) + .post("/routingAsFilter/post-endpoint", (req, res) -> res.status(Http.Status.CREATED_201) + .send()) + .get("/routingAsFilter/get-endpoint", (req, res) -> res.status(Http.Status.OK_200) + .send("Hello World!")); + } + + /** + * {@link ServerRequest} provides access to three types of "parameters": + *

    + *
  • Headers
  • + *
  • Query parameters
  • + *
  • Path parameters - Evaluated from provided {@code path pattern}
  • + *
+ *

+ * {@link java.util.Optional Optional} API is heavily used to represent parameters optionality. + *

+ * WebServer {@link io.helidon.common.parameters.Parameters Parameters} API is used to represent fact, that headers and + * query parameters can contain multiple values. + * + * @param routing routing builder + */ + public static void parametersAndHeaders(HttpRouting.Builder routing) { + routing.get("/parametersAndHeaders/context/{id}", (req, res) -> { + StringBuilder sb = new StringBuilder(); + // Request headers + req.headers() + .first(FOO_HEADER) + .ifPresent(v -> sb.append("foo: ").append(v).append("\n")); + // Request parameters + req.query() + .first("bar") + .ifPresent(v -> sb.append("bar: ").append(v).append("\n")); + // Path parameters + sb.append("id: ").append(req.path().pathParameters().value("id")); + // Response headers + res.headers().contentType(MediaTypes.TEXT_PLAIN); + // Response entity (payload) + res.send(sb.toString()); + }); + } + + /** + * Routing rules (routes) are limited on two criteria - HTTP method and path. + * + * @param routing routing builder + */ + public static void advancedRouting(HttpRouting.Builder routing) { + routing.get("/advancedRouting/foo", (req, res) -> { + ServerRequestHeaders headers = req.headers(); + if (headers.isAccepted(MediaTypes.TEXT_PLAIN) + && headers.contains(BAR_HEADER)) { + + res.send(); + } else { + res.next(); + } + }); + } + + /** + * Larger applications with many routing rules can cause complicated readability (maintainability) if all rules are + * defined in a single fluent code. It is possible to register {@link HttpService} and organise + * the code into services and resources. {@code Service} is an interface which can register more routing rules (routes). + * + * @param routing routing builder + */ + public static void organiseCode(HttpRouting.Builder routing) { + routing.register("/organiseCode/catalog-context-path", new Catalog()); + } + + /** + * Request payload (body/entity) is represented by {@link ReadableEntity}. + * But it is more convenient to process entity in some type specific form. WebServer supports few types which can be + * used te read the whole entity: + *

    + *
  • {@code byte[]}
  • + *
  • {@code String}
  • + *
  • {@code InputStream}
  • + *
+ *

+ * Similar approach is used for the response entity. + * + * @param routing routing builder + */ + public static void readContentEntity(HttpRouting.Builder routing) { + routing.post("/readContentEntity/foo", (req, res) -> { + try { + String data = req.content().as(String.class); + System.out.println("/foo DATA: " + data); + res.send(data); + } catch (Throwable th) { + res.status(Http.Status.BAD_REQUEST_400); + } + }) + // It is possible to use Handler.of() method to automatically cover all error states. + .post("/readContentEntity/bar", Handler.create(String.class, (data, res) -> { + System.out.println("/foo DATA: " + data); + res.send(data); + })); + } + + /** + * Use a custom {@link EntityReader reader} to convert the request content into an object of a given type. + * + * @param routing routing builder + * @param mediaContext media context builder + */ + public static void mediaReader(HttpRouting.Builder routing, MediaContextConfig.Builder mediaContext) { + routing.post("/mediaReader/create-record", Handler.create(Name.class, (name, res) -> { + System.out.println("Name: " + name); + res.status(Http.Status.CREATED_201) + .send(name.toString()); + })); + + // add our custom Name reader + mediaContext.addMediaSupport(NameSupport.create()); + } + + /** + * Combination of filtering {@link Handler} pattern with {@link HttpService} registration capabilities + * can be used by other frameworks for the integration. WebServer is shipped with several integrated libraries (supports) + * including static content, JSON and Jersey. See {@code POM.xml} for requested dependencies. + * + * @param routing routing builder + * @param mediaContext mediaContext + */ + public static void supports(HttpRouting.Builder routing, MediaContextConfig.Builder mediaContext) { + routing.register("/supports", StaticContentService.create("/static")) + .get("/supports/hello/{what}", (req, res) -> + res.send(JSON.createObjectBuilder() + .add("message", "Hello " + req.path() + .pathParameters() + .value("what")) + .build())); + mediaContext.addMediaSupport(JsonpSupport.create()); + } + + /** + * Request processing can cause error represented by {@link Throwable}. It is possible to register custom + * {@link ErrorHandler ErrorHandlers} for specific processing. + *

+ * If error is not processed by a custom {@link ErrorHandler ErrorHandler} than default one is used. + * It responds with HTTP 500 code unless error is not represented + * by {@link HttpException HttpException}. In such case it reflects its content. + * + * @param routing routing builder + */ + public static void errorHandling(HttpRouting.Builder routing) { + routing.post("/errorHandling/compute", Handler.create(String.class, (str, res) -> { + int result = 100 / Integer.parseInt(str); + res.send("100 / " + str + " = " + result); + })) + .error(Throwable.class, (req, res, ex) -> { + ex.printStackTrace(System.out); + res.next(); + }) + .error(NumberFormatException.class, + (req, res, ex) -> res.status(Http.Status.BAD_REQUEST_400).send()) + .error(ArithmeticException.class, + (req, res, ex) -> res.status(Http.Status.PRECONDITION_FAILED_412).send()); + } + + + // ---------------- EXECUTION + + private static final String EXAMPLE_NAME_SYS_PROP = "exampleName"; + private static final String EXAMPLE_NAME_ENV_VAR = "EXAMPLE_NAME"; + + /** + * Prints usage instructions. + */ + public void help() { + StringBuilder hlp = new StringBuilder(); + hlp.append("java -jar example-basics.jar \n"); + hlp.append("Example method names:\n"); + Method[] methods = Main.class.getDeclaredMethods(); + for (Method method : methods) { + if (Modifier.isPublic(method.getModifiers()) && !Modifier.isStatic(method.getModifiers())) { + hlp.append(" ").append(method.getName()).append('\n'); + } + } + hlp.append('\n'); + hlp.append("Example method name can be also provided as a\n"); + hlp.append(" - -D").append(EXAMPLE_NAME_SYS_PROP).append(" jvm property.\n"); + hlp.append(" - ").append(EXAMPLE_NAME_ENV_VAR).append(" environment variable.\n"); + System.out.println(hlp); + } + + /** + * Prints usage instructions. (Shortcut to {@link #help()} method. + */ + public void h() { + help(); + } + + /** + * Java main method. + * + * @param args Command line arguments. + */ + public static void main(String[] args) { + String exampleName; + if (args.length > 0) { + exampleName = args[0]; + } else if (System.getProperty(EXAMPLE_NAME_SYS_PROP) != null) { + exampleName = System.getProperty(EXAMPLE_NAME_SYS_PROP); + } else if (System.getenv(EXAMPLE_NAME_ENV_VAR) != null) { + exampleName = System.getenv(EXAMPLE_NAME_ENV_VAR); + } else { + System.out.println("Missing example name. It can be provided as a \n" + + " - first command line argument.\n" + + " - -D" + EXAMPLE_NAME_SYS_PROP + " jvm property.\n" + + " - " + EXAMPLE_NAME_ENV_VAR + " environment variable.\n"); + System.exit(1); + return; + } + while (exampleName.startsWith("-")) { + exampleName = exampleName.substring(1); + } + String methodName = exampleName; + Method method = Arrays.stream(Main.class.getMethods()) + .filter(m -> m.getName().equals(methodName)) + .findFirst() + .orElseThrow(() -> new IllegalArgumentException("Missing example method named: " + methodName)); + HttpRouting.Builder routingBuilder = HttpRouting.builder(); + MediaContextConfig.Builder mediaContextBuilder = MediaContext.builder() + .mediaSupportsDiscoverServices(false); + List params = new ArrayList<>(); + for (Parameter param : method.getParameters()) { + Class paramType = param.getType(); + if (paramType.isAssignableFrom(routingBuilder.getClass())) { + params.add(routingBuilder); + } else if (paramType.isAssignableFrom(mediaContextBuilder.getClass())) { + params.add(mediaContextBuilder); + } else { + throw new IllegalStateException("Unsupported parameter type: " + paramType.getName()); + } + } + WebServer server; + try { + method.invoke(null, params.toArray(new Object[0])); + } catch (IllegalArgumentException e) { + System.out.println(e.getMessage()); + System.exit(2); + } catch (IllegalAccessException | InvocationTargetException e) { + e.printStackTrace(System.out); + System.exit(100); + } + server = WebServer.builder() + .routing(routingBuilder.build()) + .mediaContext(mediaContextBuilder.build()) + .build() + .start(); + System.out.println("Server is UP: http://localhost:" + server.port()); + } +} diff --git a/examples/webserver/basics/src/main/java/io/helidon/webserver/examples/basics/Name.java b/examples/webserver/basics/src/main/java/io/helidon/examples/webserver/basics/Name.java similarity index 98% rename from examples/webserver/basics/src/main/java/io/helidon/webserver/examples/basics/Name.java rename to examples/webserver/basics/src/main/java/io/helidon/examples/webserver/basics/Name.java index 912ddc2289e..8d1c581db30 100644 --- a/examples/webserver/basics/src/main/java/io/helidon/webserver/examples/basics/Name.java +++ b/examples/webserver/basics/src/main/java/io/helidon/examples/webserver/basics/Name.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.webserver.examples.basics; +package io.helidon.examples.webserver.basics; /** * Represents a simple entity - the name. diff --git a/examples/webserver/basics/src/main/java/io/helidon/webserver/examples/basics/NameSupport.java b/examples/webserver/basics/src/main/java/io/helidon/examples/webserver/basics/NameSupport.java similarity index 92% rename from examples/webserver/basics/src/main/java/io/helidon/webserver/examples/basics/NameSupport.java rename to examples/webserver/basics/src/main/java/io/helidon/examples/webserver/basics/NameSupport.java index 432ba517a37..ffa68b3276c 100644 --- a/examples/webserver/basics/src/main/java/io/helidon/webserver/examples/basics/NameSupport.java +++ b/examples/webserver/basics/src/main/java/io/helidon/examples/webserver/basics/NameSupport.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.webserver.examples.basics; +package io.helidon.examples.webserver.basics; import java.io.IOException; import java.io.InputStream; @@ -22,10 +22,10 @@ import java.nio.charset.StandardCharsets; import io.helidon.common.GenericType; -import io.helidon.common.http.Headers; -import io.helidon.common.http.HttpMediaType; -import io.helidon.nima.http.media.EntityReader; -import io.helidon.nima.http.media.MediaSupport; +import io.helidon.http.Headers; +import io.helidon.http.HttpMediaType; +import io.helidon.http.media.EntityReader; +import io.helidon.http.media.MediaSupport; /** * Reader for the custom media type. diff --git a/examples/webserver/basics/src/main/java/io/helidon/examples/webserver/basics/package-info.java b/examples/webserver/basics/src/main/java/io/helidon/examples/webserver/basics/package-info.java new file mode 100644 index 00000000000..efce08d4f8f --- /dev/null +++ b/examples/webserver/basics/src/main/java/io/helidon/examples/webserver/basics/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * A set of small usage examples. Start with {@link io.helidon.examples.webserver.basics.Main Main} class. + */ +package io.helidon.examples.webserver.basics; diff --git a/examples/webserver/basics/src/main/java/io/helidon/webserver/examples/basics/Main.java b/examples/webserver/basics/src/main/java/io/helidon/webserver/examples/basics/Main.java deleted file mode 100644 index c6c69b99768..00000000000 --- a/examples/webserver/basics/src/main/java/io/helidon/webserver/examples/basics/Main.java +++ /dev/null @@ -1,368 +0,0 @@ -/* - * Copyright (c) 2017, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.webserver.examples.basics; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.lang.reflect.Parameter; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpException; -import io.helidon.common.http.ServerRequestHeaders; -import io.helidon.common.media.type.MediaTypes; -import io.helidon.nima.http.media.EntityReader; -import io.helidon.nima.http.media.MediaContext; -import io.helidon.nima.http.media.MediaContextConfig; -import io.helidon.nima.http.media.ReadableEntity; -import io.helidon.nima.http.media.jsonp.JsonpSupport; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.ErrorHandler; -import io.helidon.nima.webserver.http.Handler; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; -import io.helidon.nima.webserver.staticcontent.StaticContentService; - -import jakarta.json.Json; -import jakarta.json.JsonBuilderFactory; - -/** - * This example consists of few first tutorial steps of WebServer API. Each step is represented by a single method. - *

- * Principles: - *

    - *
  • Reactive principles
  • - *
  • Reflection free
  • - *
  • Fluent
  • - *
  • Integration platform
  • - *
- *

- * It is also java executable main class. Use a method name as a command line parameter to execute. - */ -public class Main { - - private static final JsonBuilderFactory JSON = Json.createBuilderFactory(Collections.emptyMap()); - private static final Http.HeaderName BAR_HEADER = Http.HeaderNames.create("bar"); - private static final Http.HeaderName FOO_HEADER = Http.HeaderNames.create("foo"); - - // ---------------- EXAMPLES - - /** - * True heart of WebServer API is {@link HttpRouting}. - * It provides fluent way how to assign custom {@link Handler} to the routing rule. - * The rule consists from two main factors - HTTP method and path pattern. - *

- * The (route) {@link Handler} is a functional interface which process HTTP {@link ServerRequest request} and - * writes to the {@link ServerResponse response}. - * - * @param routing routing builder - */ - public static void firstRouting(HttpRouting.Builder routing) { - routing.post("/firstRouting/post-endpoint", (req, res) -> res.status(Http.Status.CREATED_201) - .send()) - .get("/firstRouting/get-endpoint", (req, res) -> res.status(Http.Status.OK_200) - .send("Hello World!")); - } - - /** - * All routing rules (routes) are evaluated in a definition order. The {@link Handler} assigned with the first valid route - * for given request is called. It is a responsibility of each handler to process in one of the following ways: - *

    - *
  • Respond using one of {@link ServerResponse#send() ServerResponse.send(...)} method.
  • - *
  • Continue to next valid route using {@link ServerResponse#next() ServerRequest.next()} method. - * It is possible to define filtering handlers.
  • - *
- *

- * If no valid {@link Handler} is found then routing respond by {@code HTTP 404} code. - *

- * If selected {@link Handler} doesn't process request than the request stacks! - *

- * Blocking operations:
- * For performance reason, {@link Handler} can be called directly by a selector thread. It is not good idea to block - * such thread. If request must be processed by a blocking operation then such processing should be deferred to another - * thread. - * - * @param routing routing builder - */ - public static void routingAsFilter(HttpRouting.Builder routing) { - routing.any("/routingAsFilter/*", (req, res) -> { - System.out.println(req.prologue().method() + " " + req.path()); - // Filters are just routing handlers which calls next() - res.next(); - }) - .post("/routingAsFilter/post-endpoint", (req, res) -> res.status(Http.Status.CREATED_201) - .send()) - .get("/routingAsFilter/get-endpoint", (req, res) -> res.status(Http.Status.OK_200) - .send("Hello World!")); - } - - /** - * {@link ServerRequest} provides access to three types of "parameters": - *

    - *
  • Headers
  • - *
  • Query parameters
  • - *
  • Path parameters - Evaluated from provided {@code path pattern}
  • - *
- *

- * {@link java.util.Optional Optional} API is heavily used to represent parameters optionality. - *

- * WebServer {@link io.helidon.common.parameters.Parameters Parameters} API is used to represent fact, that headers and - * query parameters can contain multiple values. - * - * @param routing routing builder - */ - public static void parametersAndHeaders(HttpRouting.Builder routing) { - routing.get("/parametersAndHeaders/context/{id}", (req, res) -> { - StringBuilder sb = new StringBuilder(); - // Request headers - req.headers() - .first(FOO_HEADER) - .ifPresent(v -> sb.append("foo: ").append(v).append("\n")); - // Request parameters - req.query() - .first("bar") - .ifPresent(v -> sb.append("bar: ").append(v).append("\n")); - // Path parameters - sb.append("id: ").append(req.path().pathParameters().value("id")); - // Response headers - res.headers().contentType(MediaTypes.TEXT_PLAIN); - // Response entity (payload) - res.send(sb.toString()); - }); - } - - /** - * Routing rules (routes) are limited on two criteria - HTTP method and path. - * - * @param routing routing builder - */ - public static void advancedRouting(HttpRouting.Builder routing) { - routing.get("/advancedRouting/foo", (req, res) -> { - ServerRequestHeaders headers = req.headers(); - if (headers.isAccepted(MediaTypes.TEXT_PLAIN) - && headers.contains(BAR_HEADER)) { - - res.send(); - } else { - res.next(); - } - }); - } - - /** - * Larger applications with many routing rules can cause complicated readability (maintainability) if all rules are - * defined in a single fluent code. It is possible to register {@link HttpService} and organise - * the code into services and resources. {@code Service} is an interface which can register more routing rules (routes). - * - * @param routing routing builder - */ - public static void organiseCode(HttpRouting.Builder routing) { - routing.register("/organiseCode/catalog-context-path", new Catalog()); - } - - /** - * Request payload (body/entity) is represented by {@link ReadableEntity}. - * But it is more convenient to process entity in some type specific form. WebServer supports few types which can be - * used te read the whole entity: - *

    - *
  • {@code byte[]}
  • - *
  • {@code String}
  • - *
  • {@code InputStream}
  • - *
- *

- * Similar approach is used for the response entity. - * - * @param routing routing builder - */ - public static void readContentEntity(HttpRouting.Builder routing) { - routing.post("/readContentEntity/foo", (req, res) -> { - try { - String data = req.content().as(String.class); - System.out.println("/foo DATA: " + data); - res.send(data); - } catch (Throwable th) { - res.status(Http.Status.BAD_REQUEST_400); - } - }) - // It is possible to use Handler.of() method to automatically cover all error states. - .post("/readContentEntity/bar", Handler.create(String.class, (data, res) -> { - System.out.println("/foo DATA: " + data); - res.send(data); - })); - } - - /** - * Use a custom {@link EntityReader reader} to convert the request content into an object of a given type. - * - * @param routing routing builder - * @param mediaContext media context builder - */ - public static void mediaReader(HttpRouting.Builder routing, MediaContextConfig.Builder mediaContext) { - routing.post("/mediaReader/create-record", Handler.create(Name.class, (name, res) -> { - System.out.println("Name: " + name); - res.status(Http.Status.CREATED_201) - .send(name.toString()); - })); - - // add our custom Name reader - mediaContext.addMediaSupport(NameSupport.create()); - } - - /** - * Combination of filtering {@link Handler} pattern with {@link HttpService} registration capabilities - * can be used by other frameworks for the integration. WebServer is shipped with several integrated libraries (supports) - * including static content, JSON and Jersey. See {@code POM.xml} for requested dependencies. - * - * @param routing routing builder - * @param mediaContext mediaContext - */ - public static void supports(HttpRouting.Builder routing, MediaContextConfig.Builder mediaContext) { - routing.register("/supports", StaticContentService.create("/static")) - .get("/supports/hello/{what}", (req, res) -> - res.send(JSON.createObjectBuilder() - .add("message", "Hello " + req.path() - .pathParameters() - .value("what")) - .build())); - mediaContext.addMediaSupport(JsonpSupport.create()); - } - - /** - * Request processing can cause error represented by {@link Throwable}. It is possible to register custom - * {@link ErrorHandler ErrorHandlers} for specific processing. - *

- * If error is not processed by a custom {@link ErrorHandler ErrorHandler} than default one is used. - * It responds with HTTP 500 code unless error is not represented - * by {@link HttpException HttpException}. In such case it reflects its content. - * - * @param routing routing builder - */ - public static void errorHandling(HttpRouting.Builder routing) { - routing.post("/errorHandling/compute", Handler.create(String.class, (str, res) -> { - int result = 100 / Integer.parseInt(str); - res.send("100 / " + str + " = " + result); - })) - .error(Throwable.class, (req, res, ex) -> { - ex.printStackTrace(System.out); - res.next(); - }) - .error(NumberFormatException.class, - (req, res, ex) -> res.status(Http.Status.BAD_REQUEST_400).send()) - .error(ArithmeticException.class, - (req, res, ex) -> res.status(Http.Status.PRECONDITION_FAILED_412).send()); - } - - - // ---------------- EXECUTION - - private static final String EXAMPLE_NAME_SYS_PROP = "exampleName"; - private static final String EXAMPLE_NAME_ENV_VAR = "EXAMPLE_NAME"; - - /** - * Prints usage instructions. - */ - public void help() { - StringBuilder hlp = new StringBuilder(); - hlp.append("java -jar example-basics.jar \n"); - hlp.append("Example method names:\n"); - Method[] methods = Main.class.getDeclaredMethods(); - for (Method method : methods) { - if (Modifier.isPublic(method.getModifiers()) && !Modifier.isStatic(method.getModifiers())) { - hlp.append(" ").append(method.getName()).append('\n'); - } - } - hlp.append('\n'); - hlp.append("Example method name can be also provided as a\n"); - hlp.append(" - -D").append(EXAMPLE_NAME_SYS_PROP).append(" jvm property.\n"); - hlp.append(" - ").append(EXAMPLE_NAME_ENV_VAR).append(" environment variable.\n"); - System.out.println(hlp); - } - - /** - * Prints usage instructions. (Shortcut to {@link #help()} method. - */ - public void h() { - help(); - } - - /** - * Java main method. - * - * @param args Command line arguments. - */ - public static void main(String[] args) { - String exampleName; - if (args.length > 0) { - exampleName = args[0]; - } else if (System.getProperty(EXAMPLE_NAME_SYS_PROP) != null) { - exampleName = System.getProperty(EXAMPLE_NAME_SYS_PROP); - } else if (System.getenv(EXAMPLE_NAME_ENV_VAR) != null) { - exampleName = System.getenv(EXAMPLE_NAME_ENV_VAR); - } else { - System.out.println("Missing example name. It can be provided as a \n" - + " - first command line argument.\n" - + " - -D" + EXAMPLE_NAME_SYS_PROP + " jvm property.\n" - + " - " + EXAMPLE_NAME_ENV_VAR + " environment variable.\n"); - System.exit(1); - return; - } - while (exampleName.startsWith("-")) { - exampleName = exampleName.substring(1); - } - String methodName = exampleName; - Method method = Arrays.stream(Main.class.getMethods()) - .filter(m -> m.getName().equals(methodName)) - .findFirst() - .orElseThrow(() -> new IllegalArgumentException("Missing example method named: " + methodName)); - HttpRouting.Builder routingBuilder = HttpRouting.builder(); - MediaContextConfig.Builder mediaContextBuilder = MediaContext.builder() - .mediaSupportsDiscoverServices(false); - List params = new ArrayList<>(); - for (Parameter param : method.getParameters()) { - Class paramType = param.getType(); - if (paramType.isAssignableFrom(routingBuilder.getClass())) { - params.add(routingBuilder); - } else if (paramType.isAssignableFrom(mediaContextBuilder.getClass())) { - params.add(mediaContextBuilder); - } else { - throw new IllegalStateException("Unsupported parameter type: " + paramType.getName()); - } - } - WebServer server; - try { - method.invoke(null, params.toArray(new Object[0])); - } catch (IllegalArgumentException e) { - System.out.println(e.getMessage()); - System.exit(2); - } catch (IllegalAccessException | InvocationTargetException e) { - e.printStackTrace(System.out); - System.exit(100); - } - server = WebServer.builder() - .routing(routingBuilder.build()) - .mediaContext(mediaContextBuilder.build()) - .build() - .start(); - System.out.println("Server is UP: http://localhost:" + server.port()); - } -} diff --git a/examples/webserver/basics/src/main/java/io/helidon/webserver/examples/basics/package-info.java b/examples/webserver/basics/src/main/java/io/helidon/webserver/examples/basics/package-info.java deleted file mode 100644 index 2c108c724b0..00000000000 --- a/examples/webserver/basics/src/main/java/io/helidon/webserver/examples/basics/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2017, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * A set of small usage examples. Start with {@link io.helidon.webserver.examples.basics.Main Main} class. - */ -package io.helidon.webserver.examples.basics; diff --git a/examples/webserver/basics/src/test/java/io/helidon/examples/webserver/basics/MainTest.java b/examples/webserver/basics/src/test/java/io/helidon/examples/webserver/basics/MainTest.java new file mode 100644 index 00000000000..36c0a97aba4 --- /dev/null +++ b/examples/webserver/basics/src/test/java/io/helidon/examples/webserver/basics/MainTest.java @@ -0,0 +1,194 @@ +/* + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.examples.webserver.basics; + +import io.helidon.http.Http; +import io.helidon.common.media.type.MediaTypes; +import io.helidon.http.media.MediaContext; +import io.helidon.http.media.MediaContextConfig; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.WebServerConfig; + +import org.junit.jupiter.api.Test; + +import static io.helidon.http.Http.Status.BAD_REQUEST_400; +import static io.helidon.http.Http.Status.CREATED_201; +import static io.helidon.http.Http.Status.INTERNAL_SERVER_ERROR_500; +import static io.helidon.http.Http.Status.OK_200; +import static io.helidon.http.Http.Status.PRECONDITION_FAILED_412; +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +@ServerTest +public class MainTest { + + private static final Http.HeaderName FOO_HEADER = Http.HeaderNames.create("foo"); + + private final Http1Client client; + + public MainTest(Http1Client client) { + this.client = client; + } + + @SetUpServer + static void setup(WebServerConfig.Builder server) { + MediaContextConfig.Builder mediaContext = MediaContext.builder() + .mediaSupportsDiscoverServices(false); + server.routing(routing -> { + Main.firstRouting(routing); + Main.mediaReader(routing, mediaContext); + Main.advancedRouting(routing); + Main.organiseCode(routing); + Main.routingAsFilter(routing); + Main.parametersAndHeaders(routing); + Main.errorHandling(routing); + Main.readContentEntity(routing); + Main.supports(routing, mediaContext); + }); + server.mediaContext(mediaContext.build()); + } + + @Test + public void firstRouting() { + // POST + try (Http1ClientResponse response = client.post("/firstRouting/post-endpoint").request()) { + assertThat(response.status(), is(CREATED_201)); + } + // GET + try (Http1ClientResponse response = client.get("/firstRouting/get-endpoint").request()) { + assertThat(response.status(), is(OK_200)); + } + } + + @Test + public void routingAsFilter() { + // POST + try (Http1ClientResponse response = client.post("/routingAsFilter/post-endpoint").request()) { + assertThat(response.status(), is(CREATED_201)); + } + // GET + try (Http1ClientResponse response = client.get("/routingAsFilter/get-endpoint").request()) { + assertThat(response.status(), is(OK_200)); + } + } + + @Test + public void parametersAndHeaders() { + try (Http1ClientResponse response = client.get("/parametersAndHeaders/context/aaa") + .queryParam("bar", "bbb") + .header(FOO_HEADER, "ccc") + .request()) { + + assertThat(response.status(), is(OK_200)); + String s = response.entity().as(String.class); + assertThat(s, containsString("id: aaa")); + assertThat(s, containsString("bar: bbb")); + assertThat(s, containsString("foo: ccc")); + } + } + + @Test + public void organiseCode() { + // List + try (Http1ClientResponse response = client.get("/organiseCode/catalog-context-path").request()) { + assertThat(response.status(), is(OK_200)); + assertThat(response.entity().as(String.class), is("1, 2, 3, 4, 5")); + } + + // Get by id + try (Http1ClientResponse response = client.get("/organiseCode/catalog-context-path/aaa").request()) { + assertThat(response.status(), is(OK_200)); + assertThat(response.entity().as(String.class), is("Item: aaa")); + } + } + + @Test + public void readContentEntity() { + // foo + try (Http1ClientResponse response = client.post("/readContentEntity/foo").submit("aaa")) { + assertThat(response.status(), is(OK_200)); + assertThat(response.entity().as(String.class), is("aaa")); + } + + // bar + try (Http1ClientResponse response = client.post("/readContentEntity/bar").submit("aaa")) { + assertThat(response.status(), is(OK_200)); + assertThat(response.entity().as(String.class), is("aaa")); + } + } + + @Test + public void mediaReader() { + try (Http1ClientResponse response = client.post("/mediaReader/create-record") + .contentType(NameSupport.APP_NAME) + .submit("John Smith")) { + assertThat(response.status(), is(CREATED_201)); + assertThat(response.entity().as(String.class), is("John Smith")); + } + + // Unsupported Content-Type + try (Http1ClientResponse response = client.post("/mediaReader/create-record") + .contentType(MediaTypes.TEXT_PLAIN) + .submit("John Smith")) { + assertThat(response.status(), is(INTERNAL_SERVER_ERROR_500)); + } + } + + @Test + public void supports() { + // Static content + try (Http1ClientResponse response = client.get("/supports/index.html").request()) { + assertThat(response.status(), is(OK_200)); + assertThat(response.headers().first(Http.HeaderNames.CONTENT_TYPE).orElse(null), is(MediaTypes.TEXT_HTML.text())); + } + + // JSON + try (Http1ClientResponse response = client.get("/supports/hello/Europe").request()) { + assertThat(response.status(), is(OK_200)); + assertThat(response.entity().as(String.class), is("{\"message\":\"Hello Europe\"}")); + } + } + + @Test + public void errorHandling() { + // Valid + try (Http1ClientResponse response = client.post("/errorHandling/compute") + .contentType(MediaTypes.TEXT_PLAIN) + .submit("2")) { + assertThat(response.status(), is(OK_200)); + assertThat(response.entity().as(String.class), is("100 / 2 = 50")); + } + + // Zero + try (Http1ClientResponse response = client.post("/errorHandling/compute") + .contentType(MediaTypes.TEXT_PLAIN) + .submit("0")) { + assertThat(response.status(), is(PRECONDITION_FAILED_412)); + } + + // NaN + try (Http1ClientResponse response = client.post("/errorHandling/compute") + .contentType(MediaTypes.TEXT_PLAIN) + .submit("aaa")) { + assertThat(response.status(), is(BAD_REQUEST_400)); + } + } +} diff --git a/examples/webserver/basics/src/test/java/io/helidon/webserver/examples/basics/MainTest.java b/examples/webserver/basics/src/test/java/io/helidon/webserver/examples/basics/MainTest.java deleted file mode 100644 index 5689d5058fa..00000000000 --- a/examples/webserver/basics/src/test/java/io/helidon/webserver/examples/basics/MainTest.java +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Copyright (c) 2017, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.webserver.examples.basics; - -import io.helidon.common.http.Http; -import io.helidon.common.media.type.MediaTypes; -import io.helidon.nima.http.media.MediaContext; -import io.helidon.nima.http.media.MediaContextConfig; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.WebServerConfig; - -import org.junit.jupiter.api.Test; - -import static io.helidon.common.http.Http.Status.BAD_REQUEST_400; -import static io.helidon.common.http.Http.Status.CREATED_201; -import static io.helidon.common.http.Http.Status.INTERNAL_SERVER_ERROR_500; -import static io.helidon.common.http.Http.Status.OK_200; -import static io.helidon.common.http.Http.Status.PRECONDITION_FAILED_412; -import static org.hamcrest.CoreMatchers.containsString; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; - -@ServerTest -public class MainTest { - - private static final Http.HeaderName FOO_HEADER = Http.HeaderNames.create("foo"); - - private final Http1Client client; - - public MainTest(Http1Client client) { - this.client = client; - } - - @SetUpServer - static void setup(WebServerConfig.Builder server) { - MediaContextConfig.Builder mediaContext = MediaContext.builder() - .mediaSupportsDiscoverServices(false); - server.routing(routing -> { - Main.firstRouting(routing); - Main.mediaReader(routing, mediaContext); - Main.advancedRouting(routing); - Main.organiseCode(routing); - Main.routingAsFilter(routing); - Main.parametersAndHeaders(routing); - Main.errorHandling(routing); - Main.readContentEntity(routing); - Main.supports(routing, mediaContext); - }); - server.mediaContext(mediaContext.build()); - } - - @Test - public void firstRouting() { - // POST - try (Http1ClientResponse response = client.post("/firstRouting/post-endpoint").request()) { - assertThat(response.status(), is(CREATED_201)); - } - // GET - try (Http1ClientResponse response = client.get("/firstRouting/get-endpoint").request()) { - assertThat(response.status(), is(OK_200)); - } - } - - @Test - public void routingAsFilter() { - // POST - try (Http1ClientResponse response = client.post("/routingAsFilter/post-endpoint").request()) { - assertThat(response.status(), is(CREATED_201)); - } - // GET - try (Http1ClientResponse response = client.get("/routingAsFilter/get-endpoint").request()) { - assertThat(response.status(), is(OK_200)); - } - } - - @Test - public void parametersAndHeaders() { - try (Http1ClientResponse response = client.get("/parametersAndHeaders/context/aaa") - .queryParam("bar", "bbb") - .header(FOO_HEADER, "ccc") - .request()) { - - assertThat(response.status(), is(OK_200)); - String s = response.entity().as(String.class); - assertThat(s, containsString("id: aaa")); - assertThat(s, containsString("bar: bbb")); - assertThat(s, containsString("foo: ccc")); - } - } - - @Test - public void organiseCode() { - // List - try (Http1ClientResponse response = client.get("/organiseCode/catalog-context-path").request()) { - assertThat(response.status(), is(OK_200)); - assertThat(response.entity().as(String.class), is("1, 2, 3, 4, 5")); - } - - // Get by id - try (Http1ClientResponse response = client.get("/organiseCode/catalog-context-path/aaa").request()) { - assertThat(response.status(), is(OK_200)); - assertThat(response.entity().as(String.class), is("Item: aaa")); - } - } - - @Test - public void readContentEntity() { - // foo - try (Http1ClientResponse response = client.post("/readContentEntity/foo").submit("aaa")) { - assertThat(response.status(), is(OK_200)); - assertThat(response.entity().as(String.class), is("aaa")); - } - - // bar - try (Http1ClientResponse response = client.post("/readContentEntity/bar").submit("aaa")) { - assertThat(response.status(), is(OK_200)); - assertThat(response.entity().as(String.class), is("aaa")); - } - } - - @Test - public void mediaReader() { - try (Http1ClientResponse response = client.post("/mediaReader/create-record") - .contentType(NameSupport.APP_NAME) - .submit("John Smith")) { - assertThat(response.status(), is(CREATED_201)); - assertThat(response.entity().as(String.class), is("John Smith")); - } - - // Unsupported Content-Type - try (Http1ClientResponse response = client.post("/mediaReader/create-record") - .contentType(MediaTypes.TEXT_PLAIN) - .submit("John Smith")) { - assertThat(response.status(), is(INTERNAL_SERVER_ERROR_500)); - } - } - - @Test - public void supports() { - // Static content - try (Http1ClientResponse response = client.get("/supports/index.html").request()) { - assertThat(response.status(), is(OK_200)); - assertThat(response.headers().first(Http.HeaderNames.CONTENT_TYPE).orElse(null), is(MediaTypes.TEXT_HTML.text())); - } - - // JSON - try (Http1ClientResponse response = client.get("/supports/hello/Europe").request()) { - assertThat(response.status(), is(OK_200)); - assertThat(response.entity().as(String.class), is("{\"message\":\"Hello Europe\"}")); - } - } - - @Test - public void errorHandling() { - // Valid - try (Http1ClientResponse response = client.post("/errorHandling/compute") - .contentType(MediaTypes.TEXT_PLAIN) - .submit("2")) { - assertThat(response.status(), is(OK_200)); - assertThat(response.entity().as(String.class), is("100 / 2 = 50")); - } - - // Zero - try (Http1ClientResponse response = client.post("/errorHandling/compute") - .contentType(MediaTypes.TEXT_PLAIN) - .submit("0")) { - assertThat(response.status(), is(PRECONDITION_FAILED_412)); - } - - // NaN - try (Http1ClientResponse response = client.post("/errorHandling/compute") - .contentType(MediaTypes.TEXT_PLAIN) - .submit("aaa")) { - assertThat(response.status(), is(BAD_REQUEST_400)); - } - } -} diff --git a/examples/webserver/comment-aas/pom.xml b/examples/webserver/comment-aas/pom.xml index acefe5020e3..682ecbcd61b 100644 --- a/examples/webserver/comment-aas/pom.xml +++ b/examples/webserver/comment-aas/pom.xml @@ -29,22 +29,22 @@ io.helidon.examples.webserver helidon-examples-webserver-comment-aas - Helidon WebServer Examples CommentsAAS + Helidon Examples WebServer CommentsAAS Comments As A Service example application - io.helidon.webserver.examples.comments.Main + io.helidon.examples.webserver.comments.Main - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.common - helidon-common-http + io.helidon.http + helidon-http io.helidon.common @@ -59,8 +59,8 @@ helidon-config-yaml - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test diff --git a/examples/webserver/comment-aas/src/main/java/io/helidon/webserver/examples/comments/CommentsService.java b/examples/webserver/comment-aas/src/main/java/io/helidon/examples/webserver/comments/CommentsService.java similarity index 91% rename from examples/webserver/comment-aas/src/main/java/io/helidon/webserver/examples/comments/CommentsService.java rename to examples/webserver/comment-aas/src/main/java/io/helidon/examples/webserver/comments/CommentsService.java index c960e06a7a2..433848d17cb 100644 --- a/examples/webserver/comment-aas/src/main/java/io/helidon/webserver/examples/comments/CommentsService.java +++ b/examples/webserver/comment-aas/src/main/java/io/helidon/examples/webserver/comments/CommentsService.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.webserver.examples.comments; +package io.helidon.examples.webserver.comments; import java.util.ArrayList; import java.util.Collections; @@ -22,11 +22,11 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; -import io.helidon.common.http.HttpMediaTypes; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.HttpMediaTypes; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; /** * Basic service for comments. diff --git a/examples/webserver/comment-aas/src/main/java/io/helidon/examples/webserver/comments/Main.java b/examples/webserver/comment-aas/src/main/java/io/helidon/examples/webserver/comments/Main.java new file mode 100644 index 00000000000..0e9f37b9652 --- /dev/null +++ b/examples/webserver/comment-aas/src/main/java/io/helidon/examples/webserver/comments/Main.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.examples.webserver.comments; + +import java.util.Optional; + +import io.helidon.config.Config; +import io.helidon.http.Http; +import io.helidon.http.Http.Status; +import io.helidon.http.HttpException; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.http.HttpRouting; + +/** + * Application java main class. + *

+ *

The COMMENTS-As-a-Service application example demonstrates Web Server in its integration role. + * It integrates various components including Configuration and Security. + *

+ *

This WEB application provides possibility to store and read comment related to various topics. + */ +public final class Main { + + static final Http.HeaderName USER_IDENTITY_HEADER = Http.HeaderNames.create("user-identity"); + + private Main() { + } + + /** + * A java main class. + * + * @param args command line arguments. + */ + public static void main(String[] args) { + WebServerConfig.Builder builder = WebServer.builder(); + setup(builder); + WebServer server = builder.build().start(); + + System.out.println("WEB server is up! http://localhost:" + server.port() + "/comments"); + } + + static void routing(HttpRouting.Builder routing, boolean acceptAnonymousUsers) { + // Filter that translates user identity header into the contextual "user" information + routing.any((req, res) -> { + String user = req.headers() + .first(USER_IDENTITY_HEADER) + .or(() -> acceptAnonymousUsers ? Optional.of("anonymous") : Optional.empty()) + .orElseThrow(() -> new HttpException("Anonymous access is forbidden!", Status.FORBIDDEN_403)); + + req.context().register("user", user); + res.next(); + }) + // Main service logic part is registered as a separated class to "/comments" context root + .register("/comments", new CommentsService()) + // Error handling for argot expressions. + .error(ProfanityException.class, (req, res, ex) -> { + res.status(Status.NOT_ACCEPTABLE_406); + res.send("Expressions like '" + ex.getObfuscatedProfanity() + "' are unacceptable!"); + }) + .error(HttpException.class, (req, res, ex) -> { + if (ex.status() == Status.FORBIDDEN_403) { + res.status(ex.status()); + res.send(ex.getMessage()); + } else { + res.next(); + } + }); + } + + static void setup(WebServerConfig.Builder server) { + // Load configuration + Config config = Config.create(); + + server.config(config) + .routing(r -> routing(r, config.get("anonymous-enabled").asBoolean().orElse(false))); + } +} diff --git a/examples/webserver/comment-aas/src/main/java/io/helidon/webserver/examples/comments/ProfanityDetector.java b/examples/webserver/comment-aas/src/main/java/io/helidon/examples/webserver/comments/ProfanityDetector.java similarity index 96% rename from examples/webserver/comment-aas/src/main/java/io/helidon/webserver/examples/comments/ProfanityDetector.java rename to examples/webserver/comment-aas/src/main/java/io/helidon/examples/webserver/comments/ProfanityDetector.java index 1700a3bc59a..0bab2520459 100644 --- a/examples/webserver/comment-aas/src/main/java/io/helidon/webserver/examples/comments/ProfanityDetector.java +++ b/examples/webserver/comment-aas/src/main/java/io/helidon/examples/webserver/comments/ProfanityDetector.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.webserver.examples.comments; +package io.helidon.examples.webserver.comments; /** * Simple profanity detection utility class. diff --git a/examples/webserver/comment-aas/src/main/java/io/helidon/webserver/examples/comments/ProfanityException.java b/examples/webserver/comment-aas/src/main/java/io/helidon/examples/webserver/comments/ProfanityException.java similarity index 97% rename from examples/webserver/comment-aas/src/main/java/io/helidon/webserver/examples/comments/ProfanityException.java rename to examples/webserver/comment-aas/src/main/java/io/helidon/examples/webserver/comments/ProfanityException.java index b6fa92c143b..cc706be958a 100644 --- a/examples/webserver/comment-aas/src/main/java/io/helidon/webserver/examples/comments/ProfanityException.java +++ b/examples/webserver/comment-aas/src/main/java/io/helidon/examples/webserver/comments/ProfanityException.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.webserver.examples.comments; +package io.helidon.examples.webserver.comments; /** * Thrown to indicate that a message contains illegal argot word. diff --git a/examples/webserver/comment-aas/src/main/java/io/helidon/examples/webserver/comments/package-info.java b/examples/webserver/comment-aas/src/main/java/io/helidon/examples/webserver/comments/package-info.java new file mode 100644 index 00000000000..a5dcff5e8f0 --- /dev/null +++ b/examples/webserver/comment-aas/src/main/java/io/helidon/examples/webserver/comments/package-info.java @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * The COMMENTS-As-a-Service application example demonstrates Web Server in its integration role. + * It integrates various components including Configuration and Security. + * + *

This WEB application provides possibility to store and read comment related to various topics. + */ +package io.helidon.examples.webserver.comments; diff --git a/examples/webserver/comment-aas/src/main/java/io/helidon/webserver/examples/comments/Main.java b/examples/webserver/comment-aas/src/main/java/io/helidon/webserver/examples/comments/Main.java deleted file mode 100644 index 91b129f2b67..00000000000 --- a/examples/webserver/comment-aas/src/main/java/io/helidon/webserver/examples/comments/Main.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2017, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.webserver.examples.comments; - -import java.util.Optional; - -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.Status; -import io.helidon.common.http.HttpException; -import io.helidon.config.Config; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.http.HttpRouting; - -/** - * Application java main class. - *

- *

The COMMENTS-As-a-Service application example demonstrates Web Server in its integration role. - * It integrates various components including Configuration and Security. - *

- *

This WEB application provides possibility to store and read comment related to various topics. - */ -public final class Main { - - static final Http.HeaderName USER_IDENTITY_HEADER = Http.HeaderNames.create("user-identity"); - - private Main() { - } - - /** - * A java main class. - * - * @param args command line arguments. - */ - public static void main(String[] args) { - WebServerConfig.Builder builder = WebServer.builder(); - setup(builder); - WebServer server = builder.build().start(); - - System.out.println("WEB server is up! http://localhost:" + server.port() + "/comments"); - } - - static void routing(HttpRouting.Builder routing, boolean acceptAnonymousUsers) { - // Filter that translates user identity header into the contextual "user" information - routing.any((req, res) -> { - String user = req.headers() - .first(USER_IDENTITY_HEADER) - .or(() -> acceptAnonymousUsers ? Optional.of("anonymous") : Optional.empty()) - .orElseThrow(() -> new HttpException("Anonymous access is forbidden!", Status.FORBIDDEN_403)); - - req.context().register("user", user); - res.next(); - }) - // Main service logic part is registered as a separated class to "/comments" context root - .register("/comments", new CommentsService()) - // Error handling for argot expressions. - .error(ProfanityException.class, (req, res, ex) -> { - res.status(Status.NOT_ACCEPTABLE_406); - res.send("Expressions like '" + ex.getObfuscatedProfanity() + "' are unacceptable!"); - }) - .error(HttpException.class, (req, res, ex) -> { - if (ex.status() == Status.FORBIDDEN_403) { - res.status(ex.status()); - res.send(ex.getMessage()); - } else { - res.next(); - } - }); - } - - static void setup(WebServerConfig.Builder server) { - // Load configuration - Config config = Config.create(); - - server.config(config) - .routing(r -> routing(r, config.get("anonymous-enabled").asBoolean().orElse(false))); - } -} diff --git a/examples/webserver/comment-aas/src/main/java/io/helidon/webserver/examples/comments/package-info.java b/examples/webserver/comment-aas/src/main/java/io/helidon/webserver/examples/comments/package-info.java deleted file mode 100644 index 694c0b7de5b..00000000000 --- a/examples/webserver/comment-aas/src/main/java/io/helidon/webserver/examples/comments/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2017, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * The COMMENTS-As-a-Service application example demonstrates Web Server in its integration role. - * It integrates various components including Configuration and Security. - * - *

This WEB application provides possibility to store and read comment related to various topics. - */ -package io.helidon.webserver.examples.comments; diff --git a/examples/webserver/comment-aas/src/test/java/io/helidon/webserver/examples/comments/CommentsServiceTest.java b/examples/webserver/comment-aas/src/test/java/io/helidon/examples/webserver/comments/CommentsServiceTest.java similarity index 88% rename from examples/webserver/comment-aas/src/test/java/io/helidon/webserver/examples/comments/CommentsServiceTest.java rename to examples/webserver/comment-aas/src/test/java/io/helidon/examples/webserver/comments/CommentsServiceTest.java index d132dd584a8..11e0c1ab707 100644 --- a/examples/webserver/comment-aas/src/test/java/io/helidon/webserver/examples/comments/CommentsServiceTest.java +++ b/examples/webserver/comment-aas/src/test/java/io/helidon/examples/webserver/comments/CommentsServiceTest.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package io.helidon.webserver.examples.comments; +package io.helidon.examples.webserver.comments; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.common.media.type.MediaTypes; -import io.helidon.nima.testing.junit5.webserver.DirectClient; -import io.helidon.nima.testing.junit5.webserver.RoutingTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.webserver.testing.junit5.DirectClient; +import io.helidon.webserver.testing.junit5.RoutingTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.http.HttpRouting; import org.junit.jupiter.api.Test; diff --git a/examples/webserver/comment-aas/src/test/java/io/helidon/examples/webserver/comments/MainTest.java b/examples/webserver/comment-aas/src/test/java/io/helidon/examples/webserver/comments/MainTest.java new file mode 100644 index 00000000000..3a257b0b421 --- /dev/null +++ b/examples/webserver/comment-aas/src/test/java/io/helidon/examples/webserver/comments/MainTest.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.examples.webserver.comments; + +import io.helidon.http.Http; +import io.helidon.common.media.type.MediaTypes; +import io.helidon.webserver.testing.junit5.DirectClient; +import io.helidon.webserver.testing.junit5.RoutingTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.http.HttpRouting; + +import org.junit.jupiter.api.Test; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +/** + * Tests {@link Main} class. + */ +@RoutingTest +public class MainTest { + + private final DirectClient client; + + public MainTest(DirectClient client) { + this.client = client; + } + + @SetUpRoute + static void setup(HttpRouting.Builder routing) { + Main.routing(routing, false); + } + + @Test + public void argot() { + try (Http1ClientResponse response = client.post("/comments/one") + .header(Main.USER_IDENTITY_HEADER, "Joe") + .contentType(MediaTypes.TEXT_PLAIN) + .submit("Spring framework is the BEST!")) { + + assertThat(response.status(), is(Http.Status.NOT_ACCEPTABLE_406)); + } + } + + @Test + public void anonymousDisabled() { + try (Http1ClientResponse response = client.get("/comment/one").request()) { + assertThat(response.status(), is(Http.Status.FORBIDDEN_403)); + } + } +} diff --git a/examples/webserver/comment-aas/src/test/java/io/helidon/webserver/examples/comments/MainTest.java b/examples/webserver/comment-aas/src/test/java/io/helidon/webserver/examples/comments/MainTest.java deleted file mode 100644 index 58a1e4465ac..00000000000 --- a/examples/webserver/comment-aas/src/test/java/io/helidon/webserver/examples/comments/MainTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2017, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.webserver.examples.comments; - -import io.helidon.common.http.Http; -import io.helidon.common.media.type.MediaTypes; -import io.helidon.nima.testing.junit5.webserver.DirectClient; -import io.helidon.nima.testing.junit5.webserver.RoutingTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.http.HttpRouting; - -import org.junit.jupiter.api.Test; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; - -/** - * Tests {@link Main} class. - */ -@RoutingTest -public class MainTest { - - private final DirectClient client; - - public MainTest(DirectClient client) { - this.client = client; - } - - @SetUpRoute - static void setup(HttpRouting.Builder routing) { - Main.routing(routing, false); - } - - @Test - public void argot() { - try (Http1ClientResponse response = client.post("/comments/one") - .header(Main.USER_IDENTITY_HEADER, "Joe") - .contentType(MediaTypes.TEXT_PLAIN) - .submit("Spring framework is the BEST!")) { - - assertThat(response.status(), is(Http.Status.NOT_ACCEPTABLE_406)); - } - } - - @Test - public void anonymousDisabled() { - try (Http1ClientResponse response = client.get("/comment/one").request()) { - assertThat(response.status(), is(Http.Status.FORBIDDEN_403)); - } - } -} diff --git a/examples/webserver/echo/pom.xml b/examples/webserver/echo/pom.xml new file mode 100644 index 00000000000..c263ccdea9e --- /dev/null +++ b/examples/webserver/echo/pom.xml @@ -0,0 +1,70 @@ + + + + 4.0.0 + + io.helidon.applications + helidon-se + 4.0.0-SNAPSHOT + ../../../applications/se/pom.xml + + + io.helidon.examples.webserver + helidon-examples-webserver-echo + Helidon Examples WebServer Echo + + + io.helidon.examples.webserver.echo.EchoMain + + + + + io.helidon.webserver + helidon-webserver + + + io.helidon.webclient + helidon-webclient + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-libs + + + + + + diff --git a/examples/nima/echo/src/main/java/io/helidon/examples/nima/echo/EchoClient.java b/examples/webserver/echo/src/main/java/io/helidon/examples/webserver/echo/EchoClient.java similarity index 85% rename from examples/nima/echo/src/main/java/io/helidon/examples/nima/echo/EchoClient.java rename to examples/webserver/echo/src/main/java/io/helidon/examples/webserver/echo/EchoClient.java index baa4e86a060..f5bbaf167bc 100644 --- a/examples/nima/echo/src/main/java/io/helidon/examples/nima/echo/EchoClient.java +++ b/examples/webserver/echo/src/main/java/io/helidon/examples/webserver/echo/EchoClient.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.examples.nima.echo; - -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.Header; -import io.helidon.nima.webclient.api.HttpClientRequest; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.api.WebClient; +package io.helidon.examples.webserver.echo; + +import io.helidon.http.Headers; +import io.helidon.http.Http; +import io.helidon.http.Http.Header; +import io.helidon.webclient.api.HttpClientRequest; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.api.WebClient; /** * A client that invokes the echo server. diff --git a/examples/nima/echo/src/main/java/io/helidon/examples/nima/echo/EchoMain.java b/examples/webserver/echo/src/main/java/io/helidon/examples/webserver/echo/EchoMain.java similarity index 89% rename from examples/nima/echo/src/main/java/io/helidon/examples/nima/echo/EchoMain.java rename to examples/webserver/echo/src/main/java/io/helidon/examples/webserver/echo/EchoMain.java index 5153679580b..3fc1b019625 100644 --- a/examples/nima/echo/src/main/java/io/helidon/examples/nima/echo/EchoMain.java +++ b/examples/webserver/echo/src/main/java/io/helidon/examples/webserver/echo/EchoMain.java @@ -14,21 +14,21 @@ * limitations under the License. */ -package io.helidon.examples.nima.echo; +package io.helidon.examples.webserver.echo; import java.io.InputStream; import java.io.OutputStream; import java.util.Set; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; -import io.helidon.common.http.RoutedPath; import io.helidon.common.parameters.Parameters; import io.helidon.common.uri.UriQuery; +import io.helidon.http.Headers; +import io.helidon.http.Http; +import io.helidon.http.RoutedPath; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; /** * Echo example. diff --git a/examples/webserver/echo/src/main/java/io/helidon/examples/webserver/echo/package-info.java b/examples/webserver/echo/src/main/java/io/helidon/examples/webserver/echo/package-info.java new file mode 100644 index 00000000000..10384932449 --- /dev/null +++ b/examples/webserver/echo/src/main/java/io/helidon/examples/webserver/echo/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Echo example. + */ +package io.helidon.examples.webserver.echo; diff --git a/examples/webserver/fault-tolerance/pom.xml b/examples/webserver/fault-tolerance/pom.xml index cdd89a2b25a..3cb4e3422e0 100644 --- a/examples/webserver/fault-tolerance/pom.xml +++ b/examples/webserver/fault-tolerance/pom.xml @@ -28,28 +28,28 @@ io.helidon.examples.webserver helidon-examples-webserver-fault-tolerance - Helidon WebServer Examples FT + Helidon Examples WebServer FT Application demonstrates Fault tolerance used in webserver. - io.helidon.webserver.examples.faulttolerance.Main + io.helidon.examples.webserver.faulttolerance.Main - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.nima.fault-tolerance - helidon-nima-fault-tolerance + io.helidon.fault-tolerance + helidon-fault-tolerance - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test diff --git a/examples/webserver/fault-tolerance/src/main/java/io/helidon/webserver/examples/faulttolerance/FtService.java b/examples/webserver/fault-tolerance/src/main/java/io/helidon/examples/webserver/faulttolerance/FtService.java similarity index 89% rename from examples/webserver/fault-tolerance/src/main/java/io/helidon/webserver/examples/faulttolerance/FtService.java rename to examples/webserver/fault-tolerance/src/main/java/io/helidon/examples/webserver/faulttolerance/FtService.java index 6675426d3a3..8e50a91f69c 100644 --- a/examples/webserver/fault-tolerance/src/main/java/io/helidon/webserver/examples/faulttolerance/FtService.java +++ b/examples/webserver/fault-tolerance/src/main/java/io/helidon/examples/webserver/faulttolerance/FtService.java @@ -14,21 +14,21 @@ * limitations under the License. */ -package io.helidon.webserver.examples.faulttolerance; +package io.helidon.examples.webserver.faulttolerance; import java.time.Duration; import java.util.concurrent.atomic.AtomicInteger; -import io.helidon.nima.faulttolerance.Async; -import io.helidon.nima.faulttolerance.Bulkhead; -import io.helidon.nima.faulttolerance.CircuitBreaker; -import io.helidon.nima.faulttolerance.Fallback; -import io.helidon.nima.faulttolerance.Retry; -import io.helidon.nima.faulttolerance.Timeout; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.faulttolerance.Async; +import io.helidon.faulttolerance.Bulkhead; +import io.helidon.faulttolerance.CircuitBreaker; +import io.helidon.faulttolerance.Fallback; +import io.helidon.faulttolerance.Retry; +import io.helidon.faulttolerance.Timeout; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; /** * Simple service to demonstrate fault tolerance. diff --git a/examples/webserver/fault-tolerance/src/main/java/io/helidon/examples/webserver/faulttolerance/Main.java b/examples/webserver/fault-tolerance/src/main/java/io/helidon/examples/webserver/faulttolerance/Main.java new file mode 100644 index 00000000000..19a46c4ecf8 --- /dev/null +++ b/examples/webserver/fault-tolerance/src/main/java/io/helidon/examples/webserver/faulttolerance/Main.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.examples.webserver.faulttolerance; + +import io.helidon.faulttolerance.BulkheadException; +import io.helidon.faulttolerance.CircuitBreakerOpenException; +import io.helidon.faulttolerance.TimeoutException; +import io.helidon.http.Http; +import io.helidon.logging.common.LogConfig; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.http.HttpRouting; + +/** + * Main class of Fault tolerance example. + */ +public final class Main { + // utility class + private Main() { + } + + /** + * Start the example. + * + * @param args start arguments are ignored + */ + public static void main(String[] args) { + LogConfig.configureRuntime(); + + WebServerConfig.Builder builder = WebServer.builder().port(8079); + setup(builder); + WebServer server = builder.build().start(); + + System.out.println("Server started on " + "http://localhost:" + server.port()); + } + + static void setup(WebServerConfig.Builder server) { + server.routing(Main::routing); + } + + static void routing(HttpRouting.Builder routing) { + routing.register("/ft", new FtService()) + .error(BulkheadException.class, + (req, res, ex) -> res.status(Http.Status.SERVICE_UNAVAILABLE_503).send("bulkhead")) + .error(CircuitBreakerOpenException.class, + (req, res, ex) -> res.status(Http.Status.SERVICE_UNAVAILABLE_503).send("circuit breaker")) + .error(TimeoutException.class, + (req, res, ex) -> res.status(Http.Status.REQUEST_TIMEOUT_408).send("timeout")) + .error(Throwable.class, + (req, res, ex) -> res.status(Http.Status.INTERNAL_SERVER_ERROR_500) + .send(ex.getClass().getName() + ": " + ex.getMessage())); + } +} diff --git a/examples/webserver/fault-tolerance/src/main/java/io/helidon/examples/webserver/faulttolerance/package-info.java b/examples/webserver/fault-tolerance/src/main/java/io/helidon/examples/webserver/faulttolerance/package-info.java new file mode 100644 index 00000000000..44a42011ecb --- /dev/null +++ b/examples/webserver/fault-tolerance/src/main/java/io/helidon/examples/webserver/faulttolerance/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Example of Fault Tolerance usage in webserver. + */ +package io.helidon.examples.webserver.faulttolerance; diff --git a/examples/webserver/fault-tolerance/src/main/java/io/helidon/webserver/examples/faulttolerance/Main.java b/examples/webserver/fault-tolerance/src/main/java/io/helidon/webserver/examples/faulttolerance/Main.java deleted file mode 100644 index 207fb569f89..00000000000 --- a/examples/webserver/fault-tolerance/src/main/java/io/helidon/webserver/examples/faulttolerance/Main.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.webserver.examples.faulttolerance; - -import io.helidon.common.http.Http; -import io.helidon.logging.common.LogConfig; -import io.helidon.nima.faulttolerance.BulkheadException; -import io.helidon.nima.faulttolerance.CircuitBreakerOpenException; -import io.helidon.nima.faulttolerance.TimeoutException; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.http.HttpRouting; - -/** - * Main class of Fault tolerance example. - */ -public final class Main { - // utility class - private Main() { - } - - /** - * Start the example. - * - * @param args start arguments are ignored - */ - public static void main(String[] args) { - LogConfig.configureRuntime(); - - WebServerConfig.Builder builder = WebServer.builder().port(8079); - setup(builder); - WebServer server = builder.build().start(); - - System.out.println("Server started on " + "http://localhost:" + server.port()); - } - - static void setup(WebServerConfig.Builder server) { - server.routing(Main::routing); - } - - static void routing(HttpRouting.Builder routing) { - routing.register("/ft", new FtService()) - .error(BulkheadException.class, - (req, res, ex) -> res.status(Http.Status.SERVICE_UNAVAILABLE_503).send("bulkhead")) - .error(CircuitBreakerOpenException.class, - (req, res, ex) -> res.status(Http.Status.SERVICE_UNAVAILABLE_503).send("circuit breaker")) - .error(TimeoutException.class, - (req, res, ex) -> res.status(Http.Status.REQUEST_TIMEOUT_408).send("timeout")) - .error(Throwable.class, - (req, res, ex) -> res.status(Http.Status.INTERNAL_SERVER_ERROR_500) - .send(ex.getClass().getName() + ": " + ex.getMessage())); - } -} diff --git a/examples/webserver/fault-tolerance/src/main/java/io/helidon/webserver/examples/faulttolerance/package-info.java b/examples/webserver/fault-tolerance/src/main/java/io/helidon/webserver/examples/faulttolerance/package-info.java deleted file mode 100644 index d1e221d2f23..00000000000 --- a/examples/webserver/fault-tolerance/src/main/java/io/helidon/webserver/examples/faulttolerance/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Example of Fault Tolerance usage in webserver. - */ -package io.helidon.webserver.examples.faulttolerance; diff --git a/examples/webserver/fault-tolerance/src/test/java/io/helidon/examples/webserver/faulttolerance/MainTest.java b/examples/webserver/fault-tolerance/src/test/java/io/helidon/examples/webserver/faulttolerance/MainTest.java new file mode 100644 index 00000000000..25d96fe620b --- /dev/null +++ b/examples/webserver/fault-tolerance/src/test/java/io/helidon/examples/webserver/faulttolerance/MainTest.java @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.examples.webserver.faulttolerance; + +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +import io.helidon.http.Http; +import io.helidon.webserver.testing.junit5.DirectClient; +import io.helidon.webserver.testing.junit5.RoutingTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.http.HttpRouting; + +import org.junit.jupiter.api.Test; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +@RoutingTest +class MainTest { + + private final DirectClient client; + + MainTest(DirectClient client) { + this.client = client; + } + + @SetUpRoute + static void setup(HttpRouting.Builder routing) { + Main.routing(routing); + } + + @Test + void testAsync() { + try (Http1ClientResponse response = client.get("/ft/async").request()) { + assertThat(response.as(String.class), is("blocked for 100 millis")); + } + } + + @Test + void testBulkhead() throws InterruptedException { + // bulkhead is configured for limit of 1 and queue of 1, so third + // request should fail + + ExecutorService executor = Executors.newFixedThreadPool(2); + executor.submit(() -> client.get("/ft/bulkhead/10000").request().close()); + executor.submit(() -> client.get("/ft/bulkhead/10000").request().close()); + + // I want to make sure the above is connected + Thread.sleep(300); + + try (Http1ClientResponse response = client.get("/ft/bulkhead/10000").request()) { + // registered an error handler in Main + assertThat(response.status(), is(Http.Status.SERVICE_UNAVAILABLE_503)); + assertThat(response.as(String.class), is("bulkhead")); + } finally { + executor.close(); + } + } + + @Test + void testCircuitBreaker() { + try (Http1ClientResponse response = client.get("/ft/circuitBreaker/true").request()) { + assertThat(response.as(String.class), is("blocked for 100 millis")); + } + + // error ratio is 20% within 10 request + // should work after first + try (Http1ClientResponse ignored = client.get("/ft/circuitBreaker/false").request(); + Http1ClientResponse response = client.get("/ft/circuitBreaker/true").request()) { + + assertThat(response.as(String.class), is("blocked for 100 millis")); + } + + // should open after second + client.get("/ft/circuitBreaker/false").request().close(); + + try (Http1ClientResponse response = client.get("/ft/circuitBreaker/true").request()) { + + // registered an error handler in Main + assertThat(response.status(), is(Http.Status.SERVICE_UNAVAILABLE_503)); + assertThat(response.as(String.class), is("circuit breaker")); + } + } + + @Test + void testFallback() { + try (Http1ClientResponse response = client.get("/ft/fallback/true").request()) { + assertThat(response.as(String.class), is("blocked for 100 millis")); + } + + try (Http1ClientResponse response = client.get("/ft/fallback/false").request()) { + assertThat(response.as(String.class), is("Failed back because of failure")); + } + } + + @Test + void testRetry() { + try (Http1ClientResponse response = client.get("/ft/retry/1").request()) { + assertThat(response.as(String.class), is("calls/failures: 1/0")); + } + + try (Http1ClientResponse response = client.get("/ft/retry/2").request()) { + assertThat(response.as(String.class), is("calls/failures: 2/1")); + } + + try (Http1ClientResponse response = client.get("/ft/retry/3").request()) { + assertThat(response.as(String.class), is("calls/failures: 3/2")); + } + + try (Http1ClientResponse response = client.get("/ft/retry/4").request()) { + // no error handler specified + assertThat(response.status(), is(Http.Status.INTERNAL_SERVER_ERROR_500)); + assertThat(response.as(String.class), is("java.lang.RuntimeException: failure")); + } + } + + @Test + void testTimeout() { + try (Http1ClientResponse response = client.get("/ft/timeout/10").request()) { + assertThat(response.as(String.class), is("Slept for 10 ms")); + } + + try (Http1ClientResponse response = client.get("/ft/timeout/1000").request()) { + // error handler specified in Main + assertThat(response.status(), is(Http.Status.REQUEST_TIMEOUT_408)); + assertThat(response.as(String.class), is("timeout")); + } + } +} \ No newline at end of file diff --git a/examples/webserver/fault-tolerance/src/test/java/io/helidon/webserver/examples/faulttolerance/MainTest.java b/examples/webserver/fault-tolerance/src/test/java/io/helidon/webserver/examples/faulttolerance/MainTest.java deleted file mode 100644 index 104b4e46f8a..00000000000 --- a/examples/webserver/fault-tolerance/src/test/java/io/helidon/webserver/examples/faulttolerance/MainTest.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.webserver.examples.faulttolerance; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -import io.helidon.common.http.Http; -import io.helidon.nima.testing.junit5.webserver.DirectClient; -import io.helidon.nima.testing.junit5.webserver.RoutingTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.http.HttpRouting; - -import org.junit.jupiter.api.Test; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; - -@RoutingTest -class MainTest { - - private final DirectClient client; - - MainTest(DirectClient client) { - this.client = client; - } - - @SetUpRoute - static void setup(HttpRouting.Builder routing) { - Main.routing(routing); - } - - @Test - void testAsync() { - try (Http1ClientResponse response = client.get("/ft/async").request()) { - assertThat(response.as(String.class), is("blocked for 100 millis")); - } - } - - @Test - void testBulkhead() throws InterruptedException { - // bulkhead is configured for limit of 1 and queue of 1, so third - // request should fail - - ExecutorService executor = Executors.newFixedThreadPool(2); - executor.submit(() -> client.get("/ft/bulkhead/10000").request().close()); - executor.submit(() -> client.get("/ft/bulkhead/10000").request().close()); - - // I want to make sure the above is connected - Thread.sleep(300); - - try (Http1ClientResponse response = client.get("/ft/bulkhead/10000").request()) { - // registered an error handler in Main - assertThat(response.status(), is(Http.Status.SERVICE_UNAVAILABLE_503)); - assertThat(response.as(String.class), is("bulkhead")); - } finally { - executor.close(); - } - } - - @Test - void testCircuitBreaker() { - try (Http1ClientResponse response = client.get("/ft/circuitBreaker/true").request()) { - assertThat(response.as(String.class), is("blocked for 100 millis")); - } - - // error ratio is 20% within 10 request - // should work after first - try (Http1ClientResponse ignored = client.get("/ft/circuitBreaker/false").request(); - Http1ClientResponse response = client.get("/ft/circuitBreaker/true").request()) { - - assertThat(response.as(String.class), is("blocked for 100 millis")); - } - - // should open after second - client.get("/ft/circuitBreaker/false").request().close(); - - try (Http1ClientResponse response = client.get("/ft/circuitBreaker/true").request()) { - - // registered an error handler in Main - assertThat(response.status(), is(Http.Status.SERVICE_UNAVAILABLE_503)); - assertThat(response.as(String.class), is("circuit breaker")); - } - } - - @Test - void testFallback() { - try (Http1ClientResponse response = client.get("/ft/fallback/true").request()) { - assertThat(response.as(String.class), is("blocked for 100 millis")); - } - - try (Http1ClientResponse response = client.get("/ft/fallback/false").request()) { - assertThat(response.as(String.class), is("Failed back because of failure")); - } - } - - @Test - void testRetry() { - try (Http1ClientResponse response = client.get("/ft/retry/1").request()) { - assertThat(response.as(String.class), is("calls/failures: 1/0")); - } - - try (Http1ClientResponse response = client.get("/ft/retry/2").request()) { - assertThat(response.as(String.class), is("calls/failures: 2/1")); - } - - try (Http1ClientResponse response = client.get("/ft/retry/3").request()) { - assertThat(response.as(String.class), is("calls/failures: 3/2")); - } - - try (Http1ClientResponse response = client.get("/ft/retry/4").request()) { - // no error handler specified - assertThat(response.status(), is(Http.Status.INTERNAL_SERVER_ERROR_500)); - assertThat(response.as(String.class), is("java.lang.RuntimeException: failure")); - } - } - - @Test - void testTimeout() { - try (Http1ClientResponse response = client.get("/ft/timeout/10").request()) { - assertThat(response.as(String.class), is("Slept for 10 ms")); - } - - try (Http1ClientResponse response = client.get("/ft/timeout/1000").request()) { - // error handler specified in Main - assertThat(response.status(), is(Http.Status.REQUEST_TIMEOUT_408)); - assertThat(response.as(String.class), is("timeout")); - } - } -} \ No newline at end of file diff --git a/examples/webserver/imperative/pom.xml b/examples/webserver/imperative/pom.xml new file mode 100644 index 00000000000..26a813d7e89 --- /dev/null +++ b/examples/webserver/imperative/pom.xml @@ -0,0 +1,88 @@ + + + + 4.0.0 + + io.helidon.applications + helidon-se + 4.0.0-SNAPSHOT + ../../../applications/se/pom.xml + + + io.helidon.examples.webserver + helidon-examples-webserver-imperative + Helidon Examples WebServer Imperative + Example of imperative ("pure" programmatic) approach using Helidon SE + + + io.helidon.examples.webserver.imperative.ImperativeMain + + + + + io.helidon.webserver + helidon-webserver + + + io.helidon.config + helidon-config-yaml + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-libs + + + + + org.apache.maven.plugins + maven-failsafe-plugin + + + + integration-test + verify + + + + + + + diff --git a/examples/webserver/imperative/src/main/java/io/helidon/examples/webserver/imperative/ImperativeMain.java b/examples/webserver/imperative/src/main/java/io/helidon/examples/webserver/imperative/ImperativeMain.java new file mode 100644 index 00000000000..55c06a7f555 --- /dev/null +++ b/examples/webserver/imperative/src/main/java/io/helidon/examples/webserver/imperative/ImperativeMain.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.examples.webserver.imperative; + +import io.helidon.common.config.Config; +import io.helidon.common.config.GlobalConfig; +import io.helidon.http.Http; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.HttpRouting; + +/** + * Main class of this example, starts the server. + */ +public final class ImperativeMain { + private ImperativeMain() { + } + + /** + * Start the example. + * + * @param args ignored + */ + public static void main(String[] args) { + Config config = GlobalConfig.config(); + + WebServer server = WebServer.create(ws -> ws.config(config.get("server")) + .routing(ImperativeMain::routing)) + .start(); + + System.out.println("Server started. Server configuration: " + server.prototype()); + } + + private static void routing(HttpRouting.Builder routing) { + Http.Method list = Http.Method.create("LIST"); + + routing.get("/", (req, res) -> res.send("Hello World!")) + .route(list, "/", (req, res) -> res.send("lll")) + .route(list, (req, res) -> res.send("listed")); + } +} diff --git a/examples/webserver/imperative/src/main/java/io/helidon/examples/webserver/imperative/package-info.java b/examples/webserver/imperative/src/main/java/io/helidon/examples/webserver/imperative/package-info.java new file mode 100644 index 00000000000..977a0741717 --- /dev/null +++ b/examples/webserver/imperative/src/main/java/io/helidon/examples/webserver/imperative/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Example showing usage of HTTP web-server with pure imperative programming (no injection, no inversion of control). + */ +package io.helidon.examples.webserver.imperative; diff --git a/examples/nima/imperative/src/main/resources/application.yaml b/examples/webserver/imperative/src/main/resources/application.yaml similarity index 100% rename from examples/nima/imperative/src/main/resources/application.yaml rename to examples/webserver/imperative/src/main/resources/application.yaml diff --git a/examples/webserver/multiport/pom.xml b/examples/webserver/multiport/pom.xml index 8bd1d7cd271..4d6684c8425 100644 --- a/examples/webserver/multiport/pom.xml +++ b/examples/webserver/multiport/pom.xml @@ -28,20 +28,20 @@ io.helidon.examples.webserver helidon-examples-webserver-multiport - Helidon WebServer Examples Multiple Ports + Helidon Examples WebServer Multiple Ports - io.helidon.examples.webserver.multiport.Main + io.helidon.webserver.examples.multiport.Main - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.nima.observe - helidon-nima-observe + io.helidon.webserver.observe + helidon-webserver-observe io.helidon.config @@ -57,8 +57,8 @@ runtime - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test diff --git a/examples/webserver/multiport/src/main/java/io/helidon/examples/webserver/multiport/Main.java b/examples/webserver/multiport/src/main/java/io/helidon/examples/webserver/multiport/Main.java deleted file mode 100644 index 3386b649fb6..00000000000 --- a/examples/webserver/multiport/src/main/java/io/helidon/examples/webserver/multiport/Main.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2021, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.examples.webserver.multiport; - -import io.helidon.config.Config; -import io.helidon.logging.common.LogConfig; -import io.helidon.nima.observe.ObserveFeature; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.http.HttpRouting; - -/** - * The application main class. - */ -public final class Main { - - /** - * Cannot be instantiated. - */ - private Main() { - } - - /** - * Application main entry point. - * - * @param args command line arguments. - */ - public static void main(final String[] args) { - // load logging configuration - LogConfig.configureRuntime(); - - // By default, this will pick up application.yaml from the classpath - Config config = Config.create(); - - WebServerConfig.Builder builder = WebServer.builder(); - setup(builder, config); - WebServer server = builder.build().start(); - System.out.println("WEB server is up! http://localhost:" + server.port()); - } - - /** - * Set up the server. - */ - static void setup(WebServerConfig.Builder server, Config config) { - // Build server using three ports: - // default public port, admin port, private port - server.config(config.get("server")) - .routing(Main::publicRouting) - // Add a set of routes on the named socket "admin" - .putSocket("admin", socket -> socket.from(server.sockets().get("admin")) - .routing(Main::adminSocket)) - // Add a set of routes on the named socket "private" - .putSocket("private", socket -> socket.from(server.sockets().get("admin")) - .routing(Main::privateSocket)); - } - - /** - * Set up private socket. - */ - static void privateSocket(HttpRouting.Builder routing) { - routing.get("/private/hello", (req, res) -> res.send("Private Hello!!")); - } - - /** - * Set up public routing. - */ - static void publicRouting(HttpRouting.Builder routing) { - routing.get("/hello", (req, res) -> res.send("Public Hello!!")); - } - - /** - * Set up admin socket. - */ - static void adminSocket(HttpRouting.Builder routing) { - routing.addFeature(ObserveFeature.create()); - } -} diff --git a/examples/webserver/multiport/src/main/java/io/helidon/examples/webserver/multiport/package-info.java b/examples/webserver/multiport/src/main/java/io/helidon/examples/webserver/multiport/package-info.java deleted file mode 100644 index 89a5dad55f8..00000000000 --- a/examples/webserver/multiport/src/main/java/io/helidon/examples/webserver/multiport/package-info.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2021 Oracle and/or its affiliates. - * - * 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. - */ -/** - * Application that exposes multiple ports. - */ -package io.helidon.examples.webserver.multiport; diff --git a/examples/webserver/multiport/src/main/java/io/helidon/webserver/examples/multiport/Main.java b/examples/webserver/multiport/src/main/java/io/helidon/webserver/examples/multiport/Main.java new file mode 100644 index 00000000000..5f10e8c6fb7 --- /dev/null +++ b/examples/webserver/multiport/src/main/java/io/helidon/webserver/examples/multiport/Main.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2021, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.webserver.examples.multiport; + +import io.helidon.config.Config; +import io.helidon.logging.common.LogConfig; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.observe.ObserveFeature; + +/** + * The application main class. + */ +public final class Main { + + /** + * Cannot be instantiated. + */ + private Main() { + } + + /** + * Application main entry point. + * + * @param args command line arguments. + */ + public static void main(final String[] args) { + // load logging configuration + LogConfig.configureRuntime(); + + // By default, this will pick up application.yaml from the classpath + Config config = Config.create(); + + WebServerConfig.Builder builder = WebServer.builder(); + setup(builder, config); + WebServer server = builder.build().start(); + System.out.println("WEB server is up! http://localhost:" + server.port()); + } + + /** + * Set up the server. + */ + static void setup(WebServerConfig.Builder server, Config config) { + // Build server using three ports: + // default public port, admin port, private port + server.config(config.get("server")) + .routing(Main::publicRouting) + // Add a set of routes on the named socket "admin" + .putSocket("admin", socket -> socket.from(server.sockets().get("admin")) + .routing(Main::adminSocket)) + // Add a set of routes on the named socket "private" + .putSocket("private", socket -> socket.from(server.sockets().get("admin")) + .routing(Main::privateSocket)); + } + + /** + * Set up private socket. + */ + static void privateSocket(HttpRouting.Builder routing) { + routing.get("/private/hello", (req, res) -> res.send("Private Hello!!")); + } + + /** + * Set up public routing. + */ + static void publicRouting(HttpRouting.Builder routing) { + routing.get("/hello", (req, res) -> res.send("Public Hello!!")); + } + + /** + * Set up admin socket. + */ + static void adminSocket(HttpRouting.Builder routing) { + routing.addFeature(ObserveFeature.create()); + } +} diff --git a/examples/webserver/multiport/src/main/java/io/helidon/webserver/examples/multiport/package-info.java b/examples/webserver/multiport/src/main/java/io/helidon/webserver/examples/multiport/package-info.java new file mode 100644 index 00000000000..9933f12e863 --- /dev/null +++ b/examples/webserver/multiport/src/main/java/io/helidon/webserver/examples/multiport/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2021, 2023 Oracle and/or its affiliates. + * + * 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. + */ +/** + * Application that exposes multiple ports. + */ +package io.helidon.webserver.examples.multiport; diff --git a/examples/webserver/multiport/src/main/resources/logging.properties b/examples/webserver/multiport/src/main/resources/logging.properties index 2b5a61a5a67..21c61c0f38f 100644 --- a/examples/webserver/multiport/src/main/resources/logging.properties +++ b/examples/webserver/multiport/src/main/resources/logging.properties @@ -27,7 +27,7 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ .level=INFO # Component specific log levels -#io.helidon.nima.webserver.level=INFO +#io.helidon.webserver.level=INFO #io.helidon.config.level=INFO #io.helidon.security.level=INFO #io.helidon.common.level=INFO diff --git a/examples/webserver/multiport/src/test/java/io/helidon/examples/webserver/multiport/MainTest.java b/examples/webserver/multiport/src/test/java/io/helidon/examples/webserver/multiport/MainTest.java deleted file mode 100644 index abb11a226f7..00000000000 --- a/examples/webserver/multiport/src/test/java/io/helidon/examples/webserver/multiport/MainTest.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2021, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.examples.webserver.multiport; - -import java.util.stream.Stream; - -import io.helidon.common.http.Http; -import io.helidon.config.Config; -import io.helidon.config.ConfigSources; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; - -import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.MethodSource; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; - -@ServerTest -public class MainTest { - - private final Http1Client client; - private final int publicPort; - private final int privatePort; - private final int adminPort; - - public MainTest(WebServer server) { - client = Http1Client.builder().build(); - publicPort = server.port(); - privatePort = server.port("private"); - adminPort = server.port("admin"); - } - - int port(Params params) { - return switch (params.socket) { - case PUBLIC -> publicPort; - case ADMIN -> adminPort; - case PRIVATE -> privatePort; - }; - } - - @SetUpServer - public static void setup(WebServerConfig.Builder server) { - // Use test configuration so we can have ports allocated dynamically - Config config = Config.builder().addSource(ConfigSources.classpath("application-test.yaml")).build(); - Main.setup(server, config); - } - - static Stream initParams() { - final String PUBLIC_PATH = "/hello"; - final String PRIVATE_PATH = "/private/hello"; - final String HEALTH_PATH = "/health"; - final String METRICS_PATH = "/health"; - - return Stream.of( - new Params(Socket.PUBLIC, PUBLIC_PATH, Http.Status.OK_200), - new Params(Socket.PUBLIC, PRIVATE_PATH, Http.Status.NOT_FOUND_404), - new Params(Socket.PUBLIC, HEALTH_PATH, Http.Status.NOT_FOUND_404), - new Params(Socket.PUBLIC, METRICS_PATH, Http.Status.NOT_FOUND_404), - - new Params(Socket.PRIVATE, PUBLIC_PATH, Http.Status.NOT_FOUND_404), - new Params(Socket.PRIVATE, PRIVATE_PATH, Http.Status.OK_200), - new Params(Socket.PRIVATE, HEALTH_PATH, Http.Status.NOT_FOUND_404), - new Params(Socket.PRIVATE, METRICS_PATH, Http.Status.NOT_FOUND_404), - - new Params(Socket.ADMIN, PUBLIC_PATH, Http.Status.NOT_FOUND_404), - new Params(Socket.ADMIN, PRIVATE_PATH, Http.Status.NOT_FOUND_404), - new Params(Socket.ADMIN, HEALTH_PATH, Http.Status.OK_200), - new Params(Socket.ADMIN, METRICS_PATH, Http.Status.OK_200)); - } - - @MethodSource("initParams") - @ParameterizedTest - public void portAccessTest(Params params) { - // Verifies we can access endpoints only on the proper port - client.get() - .uri("http://localhost:" + port(params)) - .path(params.path) - .request() - .close(); - } - - @Test - public void portTest() { - try (Http1ClientResponse response = client.get() - .uri("http://localhost:" + publicPort) - .path("/hello") - .request()) { - assertThat(response.as(String.class), is("Public Hello!!")); - } - - try (Http1ClientResponse response = client.get() - .uri("http://localhost:" + privatePort) - .path("/private/hello") - .request()) { - assertThat(response.as(String.class), is("Private Hello!!")); - } - } - - private record Params(Socket socket, String path, Http.Status httpStatus) { - - @Override - public String toString() { - return path + " @" + socket + " should return " + httpStatus; - } - } - - private enum Socket { - PUBLIC, - ADMIN, - PRIVATE - } - -} diff --git a/examples/webserver/multiport/src/test/java/io/helidon/webserver/examples/multiport/MainTest.java b/examples/webserver/multiport/src/test/java/io/helidon/webserver/examples/multiport/MainTest.java new file mode 100644 index 00000000000..45a6423b2e5 --- /dev/null +++ b/examples/webserver/multiport/src/test/java/io/helidon/webserver/examples/multiport/MainTest.java @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2021, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.webserver.examples.multiport; + +import java.util.stream.Stream; + +import io.helidon.http.Http; +import io.helidon.config.Config; +import io.helidon.config.ConfigSources; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +@ServerTest +public class MainTest { + + private final Http1Client client; + private final int publicPort; + private final int privatePort; + private final int adminPort; + + public MainTest(WebServer server) { + client = Http1Client.builder().build(); + publicPort = server.port(); + privatePort = server.port("private"); + adminPort = server.port("admin"); + } + + int port(Params params) { + return switch (params.socket) { + case PUBLIC -> publicPort; + case ADMIN -> adminPort; + case PRIVATE -> privatePort; + }; + } + + @SetUpServer + public static void setup(WebServerConfig.Builder server) { + // Use test configuration so we can have ports allocated dynamically + Config config = Config.builder().addSource(ConfigSources.classpath("application-test.yaml")).build(); + Main.setup(server, config); + } + + static Stream initParams() { + final String PUBLIC_PATH = "/hello"; + final String PRIVATE_PATH = "/private/hello"; + final String HEALTH_PATH = "/health"; + final String METRICS_PATH = "/health"; + + return Stream.of( + new Params(Socket.PUBLIC, PUBLIC_PATH, Http.Status.OK_200), + new Params(Socket.PUBLIC, PRIVATE_PATH, Http.Status.NOT_FOUND_404), + new Params(Socket.PUBLIC, HEALTH_PATH, Http.Status.NOT_FOUND_404), + new Params(Socket.PUBLIC, METRICS_PATH, Http.Status.NOT_FOUND_404), + + new Params(Socket.PRIVATE, PUBLIC_PATH, Http.Status.NOT_FOUND_404), + new Params(Socket.PRIVATE, PRIVATE_PATH, Http.Status.OK_200), + new Params(Socket.PRIVATE, HEALTH_PATH, Http.Status.NOT_FOUND_404), + new Params(Socket.PRIVATE, METRICS_PATH, Http.Status.NOT_FOUND_404), + + new Params(Socket.ADMIN, PUBLIC_PATH, Http.Status.NOT_FOUND_404), + new Params(Socket.ADMIN, PRIVATE_PATH, Http.Status.NOT_FOUND_404), + new Params(Socket.ADMIN, HEALTH_PATH, Http.Status.OK_200), + new Params(Socket.ADMIN, METRICS_PATH, Http.Status.OK_200)); + } + + @MethodSource("initParams") + @ParameterizedTest + public void portAccessTest(Params params) { + // Verifies we can access endpoints only on the proper port + client.get() + .uri("http://localhost:" + port(params)) + .path(params.path) + .request() + .close(); + } + + @Test + public void portTest() { + try (Http1ClientResponse response = client.get() + .uri("http://localhost:" + publicPort) + .path("/hello") + .request()) { + assertThat(response.as(String.class), is("Public Hello!!")); + } + + try (Http1ClientResponse response = client.get() + .uri("http://localhost:" + privatePort) + .path("/private/hello") + .request()) { + assertThat(response.as(String.class), is("Private Hello!!")); + } + } + + private record Params(Socket socket, String path, Http.Status httpStatus) { + + @Override + public String toString() { + return path + " @" + socket + " should return " + httpStatus; + } + } + + private enum Socket { + PUBLIC, + ADMIN, + PRIVATE + } + +} diff --git a/examples/webserver/mutual-tls/pom.xml b/examples/webserver/mutual-tls/pom.xml index 3d3007187fd..b0958281de3 100644 --- a/examples/webserver/mutual-tls/pom.xml +++ b/examples/webserver/mutual-tls/pom.xml @@ -26,32 +26,32 @@ io.helidon.examples.webserver helidon-examples-webserver-mutual-tls - Helidon WebServer Examples Mutual TLS + Helidon Examples WebServer Mutual TLS Application demonstrates the use of mutual TLS with WebServer and WebClient - io.helidon.webserver.examples.mtls.ServerConfigMain + io.helidon.examples.webserver.mtls.ServerConfigMain - io.helidon.nima.webclient - helidon-nima-webclient + io.helidon.webclient + helidon-webclient - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver io.helidon.config helidon-config-yaml - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test diff --git a/examples/webserver/mutual-tls/src/main/java/io/helidon/examples/webserver/mtls/CertificateHelper.java b/examples/webserver/mutual-tls/src/main/java/io/helidon/examples/webserver/mtls/CertificateHelper.java new file mode 100644 index 00000000000..c326cff9497 --- /dev/null +++ b/examples/webserver/mutual-tls/src/main/java/io/helidon/examples/webserver/mtls/CertificateHelper.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.helidon.examples.webserver.mtls; + +import java.util.Optional; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +class CertificateHelper { + + private static final Pattern CN_PATTERN = Pattern.compile("(.*)CN=(.*?)(,.*)?"); + + private CertificateHelper() { + } + + static Optional clientCertificateName(String name) { + Matcher matcher = CN_PATTERN.matcher(name); + if (matcher.matches()) { + String cn = matcher.group(2); + if (!cn.isBlank()) { + return Optional.of(cn); + } + } + return Optional.empty(); + } +} diff --git a/examples/webserver/mutual-tls/src/main/java/io/helidon/webserver/examples/mtls/ClientBuilderMain.java b/examples/webserver/mutual-tls/src/main/java/io/helidon/examples/webserver/mtls/ClientBuilderMain.java similarity index 86% rename from examples/webserver/mutual-tls/src/main/java/io/helidon/webserver/examples/mtls/ClientBuilderMain.java rename to examples/webserver/mutual-tls/src/main/java/io/helidon/examples/webserver/mtls/ClientBuilderMain.java index a0714928574..34c999346a6 100644 --- a/examples/webserver/mutual-tls/src/main/java/io/helidon/webserver/examples/mtls/ClientBuilderMain.java +++ b/examples/webserver/mutual-tls/src/main/java/io/helidon/examples/webserver/mtls/ClientBuilderMain.java @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.webserver.examples.mtls; +package io.helidon.examples.webserver.mtls; import io.helidon.common.configurable.Resource; import io.helidon.common.pki.Keys; -import io.helidon.nima.common.tls.Tls; -import io.helidon.nima.common.tls.TlsClientAuth; -import io.helidon.nima.webclient.http1.Http1Client; +import io.helidon.common.tls.Tls; +import io.helidon.common.tls.TlsClientAuth; +import io.helidon.webclient.http1.Http1Client; /** - * Setting up {@link io.helidon.nima.webclient.api.WebClient} to support mutual TLS via builder. + * Setting up {@link io.helidon.webclient.api.WebClient} to support mutual TLS via builder. */ public class ClientBuilderMain { @@ -31,8 +31,8 @@ private ClientBuilderMain() { /** * Start the example. - * This example executes two requests by Helidon {@link io.helidon.nima.webclient.api.WebClient} which are configured - * by the {@link io.helidon.nima.webclient.api.WebClientConfig.Builder}. + * This example executes two requests by Helidon {@link io.helidon.webclient.api.WebClient} which are configured + * by the {@link io.helidon.webclient.api.WebClientConfig.Builder}. *

* You have to execute either {@link ServerBuilderMain} or {@link ServerConfigMain} for this to work. *

diff --git a/examples/webserver/mutual-tls/src/main/java/io/helidon/webserver/examples/mtls/ClientConfigMain.java b/examples/webserver/mutual-tls/src/main/java/io/helidon/examples/webserver/mtls/ClientConfigMain.java similarity index 88% rename from examples/webserver/mutual-tls/src/main/java/io/helidon/webserver/examples/mtls/ClientConfigMain.java rename to examples/webserver/mutual-tls/src/main/java/io/helidon/examples/webserver/mtls/ClientConfigMain.java index b9b4c4f7469..fc7af1e35aa 100644 --- a/examples/webserver/mutual-tls/src/main/java/io/helidon/webserver/examples/mtls/ClientConfigMain.java +++ b/examples/webserver/mutual-tls/src/main/java/io/helidon/examples/webserver/mtls/ClientConfigMain.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.webserver.examples.mtls; +package io.helidon.examples.webserver.mtls; import io.helidon.config.Config; -import io.helidon.nima.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1Client; /** - * Setting up {@link io.helidon.nima.webclient.api.WebClient} to support mutual TLS via configuration. + * Setting up {@link io.helidon.webclient.api.WebClient} to support mutual TLS via configuration. */ public class ClientConfigMain { @@ -28,7 +28,7 @@ private ClientConfigMain() { /** * Start the example. - * This example executes two requests by Helidon {@link io.helidon.nima.webclient.api.WebClient} which are configured + * This example executes two requests by Helidon {@link io.helidon.webclient.api.WebClient} which are configured * by the configuration. *

* You have to execute either {@link ServerBuilderMain} or {@link ServerConfigMain} for this to work. diff --git a/examples/webserver/mutual-tls/src/main/java/io/helidon/webserver/examples/mtls/SecureService.java b/examples/webserver/mutual-tls/src/main/java/io/helidon/examples/webserver/mtls/SecureService.java similarity index 87% rename from examples/webserver/mutual-tls/src/main/java/io/helidon/webserver/examples/mtls/SecureService.java rename to examples/webserver/mutual-tls/src/main/java/io/helidon/examples/webserver/mtls/SecureService.java index 32fb834b31a..298601d103a 100644 --- a/examples/webserver/mutual-tls/src/main/java/io/helidon/webserver/examples/mtls/SecureService.java +++ b/examples/webserver/mutual-tls/src/main/java/io/helidon/examples/webserver/mtls/SecureService.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.webserver.examples.mtls; +package io.helidon.examples.webserver.mtls; import java.security.Principal; -import io.helidon.common.http.Http; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; +import io.helidon.http.Http; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; class SecureService implements HttpService { @Override diff --git a/examples/webserver/mutual-tls/src/main/java/io/helidon/webserver/examples/mtls/ServerBuilderMain.java b/examples/webserver/mutual-tls/src/main/java/io/helidon/examples/webserver/mtls/ServerBuilderMain.java similarity index 91% rename from examples/webserver/mutual-tls/src/main/java/io/helidon/webserver/examples/mtls/ServerBuilderMain.java rename to examples/webserver/mutual-tls/src/main/java/io/helidon/examples/webserver/mtls/ServerBuilderMain.java index 6a99ceb2e1d..a56686c9cc5 100644 --- a/examples/webserver/mutual-tls/src/main/java/io/helidon/webserver/examples/mtls/ServerBuilderMain.java +++ b/examples/webserver/mutual-tls/src/main/java/io/helidon/examples/webserver/mtls/ServerBuilderMain.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.webserver.examples.mtls; +package io.helidon.examples.webserver.mtls; import io.helidon.common.configurable.Resource; import io.helidon.common.pki.Keys; -import io.helidon.nima.common.tls.TlsClientAuth; -import io.helidon.nima.webserver.ListenerConfig; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.common.tls.TlsClientAuth; +import io.helidon.webserver.ListenerConfig; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.http.HttpRouting; /** * Setting up {@link WebServer} to support mutual TLS via builder. diff --git a/examples/webserver/mutual-tls/src/main/java/io/helidon/webserver/examples/mtls/ServerConfigMain.java b/examples/webserver/mutual-tls/src/main/java/io/helidon/examples/webserver/mtls/ServerConfigMain.java similarity index 92% rename from examples/webserver/mutual-tls/src/main/java/io/helidon/webserver/examples/mtls/ServerConfigMain.java rename to examples/webserver/mutual-tls/src/main/java/io/helidon/examples/webserver/mtls/ServerConfigMain.java index 06757827414..dfc905f693f 100644 --- a/examples/webserver/mutual-tls/src/main/java/io/helidon/webserver/examples/mtls/ServerConfigMain.java +++ b/examples/webserver/mutual-tls/src/main/java/io/helidon/examples/webserver/mtls/ServerConfigMain.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.webserver.examples.mtls; +package io.helidon.examples.webserver.mtls; import io.helidon.config.Config; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.http.HttpRouting; /** * Setting up {@link WebServer} to support mutual TLS via configuration. diff --git a/examples/webserver/mutual-tls/src/main/java/io/helidon/examples/webserver/mtls/package-info.java b/examples/webserver/mutual-tls/src/main/java/io/helidon/examples/webserver/mtls/package-info.java new file mode 100644 index 00000000000..8ccbb50a402 --- /dev/null +++ b/examples/webserver/mutual-tls/src/main/java/io/helidon/examples/webserver/mtls/package-info.java @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Example of mutual TLS configuration for {@link io.helidon.webserver.WebServer} and {@link io.helidon.webclient.WebClient}, + * using both {@link io.helidon.config.Config} and builder based approach. + */ +package io.helidon.examples.webserver.mtls; diff --git a/examples/webserver/mutual-tls/src/main/java/io/helidon/webserver/examples/mtls/CertificateHelper.java b/examples/webserver/mutual-tls/src/main/java/io/helidon/webserver/examples/mtls/CertificateHelper.java deleted file mode 100644 index 58ab539eb37..00000000000 --- a/examples/webserver/mutual-tls/src/main/java/io/helidon/webserver/examples/mtls/CertificateHelper.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.helidon.webserver.examples.mtls; - -import java.util.Optional; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -class CertificateHelper { - - private static final Pattern CN_PATTERN = Pattern.compile("(.*)CN=(.*?)(,.*)?"); - - private CertificateHelper() { - } - - static Optional clientCertificateName(String name) { - Matcher matcher = CN_PATTERN.matcher(name); - if (matcher.matches()) { - String cn = matcher.group(2); - if (!cn.isBlank()) { - return Optional.of(cn); - } - } - return Optional.empty(); - } -} diff --git a/examples/webserver/mutual-tls/src/main/java/io/helidon/webserver/examples/mtls/package-info.java b/examples/webserver/mutual-tls/src/main/java/io/helidon/webserver/examples/mtls/package-info.java deleted file mode 100644 index 7b6f575fd2a..00000000000 --- a/examples/webserver/mutual-tls/src/main/java/io/helidon/webserver/examples/mtls/package-info.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Example of mutual TLS configuration for {@link io.helidon.nima.webserver.WebServer} and {@link io.helidon.nima.webclient.WebClient}, - * using both {@link io.helidon.config.Config} and builder based approach. - */ -package io.helidon.webserver.examples.mtls; diff --git a/examples/webserver/mutual-tls/src/test/java/io/helidon/examples/webserver/mtls/MutualTlsExampleBuilderTest.java b/examples/webserver/mutual-tls/src/test/java/io/helidon/examples/webserver/mtls/MutualTlsExampleBuilderTest.java new file mode 100644 index 00000000000..f3dd27e356b --- /dev/null +++ b/examples/webserver/mutual-tls/src/test/java/io/helidon/examples/webserver/mtls/MutualTlsExampleBuilderTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.helidon.examples.webserver.mtls; + +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; + +import org.hamcrest.MatcherAssert; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +/** + * Test of mutual TLS example. + */ +@ServerTest +public class MutualTlsExampleBuilderTest { + + private final WebServer server; + + public MutualTlsExampleBuilderTest(WebServer server) { + this.server = server; + } + + @SetUpServer + static void setup(WebServerConfig.Builder server) { + ServerBuilderMain.setup(server); + } + + @Test + public void testBuilderAccessSuccessful() { + Http1Client client = ClientBuilderMain.createClient(); + MatcherAssert.assertThat(ClientBuilderMain.callUnsecured(client, server.port()), is("Hello world unsecured!")); + MatcherAssert.assertThat(ClientBuilderMain.callSecured(client, server.port("secured")), is("Hello Helidon-client!")); + } +} diff --git a/examples/webserver/mutual-tls/src/test/java/io/helidon/webserver/examples/mtls/MutualTlsExampleConfigTest.java b/examples/webserver/mutual-tls/src/test/java/io/helidon/examples/webserver/mtls/MutualTlsExampleConfigTest.java similarity index 78% rename from examples/webserver/mutual-tls/src/test/java/io/helidon/webserver/examples/mtls/MutualTlsExampleConfigTest.java rename to examples/webserver/mutual-tls/src/test/java/io/helidon/examples/webserver/mtls/MutualTlsExampleConfigTest.java index 2943f1d367d..c16ffdfab76 100644 --- a/examples/webserver/mutual-tls/src/test/java/io/helidon/webserver/examples/mtls/MutualTlsExampleConfigTest.java +++ b/examples/webserver/mutual-tls/src/test/java/io/helidon/examples/webserver/mtls/MutualTlsExampleConfigTest.java @@ -13,19 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.webserver.examples.mtls; +package io.helidon.examples.webserver.mtls; import io.helidon.config.Config; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; import org.junit.jupiter.api.Test; -import static io.helidon.webserver.examples.mtls.ClientConfigMain.callSecured; -import static io.helidon.webserver.examples.mtls.ClientConfigMain.callUnsecured; +import static io.helidon.examples.webserver.mtls.ClientConfigMain.callSecured; +import static io.helidon.examples.webserver.mtls.ClientConfigMain.callUnsecured; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; diff --git a/examples/webserver/mutual-tls/src/test/java/io/helidon/webserver/examples/mtls/MutualTlsExampleBuilderTest.java b/examples/webserver/mutual-tls/src/test/java/io/helidon/webserver/examples/mtls/MutualTlsExampleBuilderTest.java deleted file mode 100644 index 698a6e82baa..00000000000 --- a/examples/webserver/mutual-tls/src/test/java/io/helidon/webserver/examples/mtls/MutualTlsExampleBuilderTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.helidon.webserver.examples.mtls; - -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; - -import org.junit.jupiter.api.Test; - -import static io.helidon.webserver.examples.mtls.ClientBuilderMain.callSecured; -import static io.helidon.webserver.examples.mtls.ClientBuilderMain.callUnsecured; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; - -/** - * Test of mutual TLS example. - */ -@ServerTest -public class MutualTlsExampleBuilderTest { - - private final WebServer server; - - public MutualTlsExampleBuilderTest(WebServer server) { - this.server = server; - } - - @SetUpServer - static void setup(WebServerConfig.Builder server) { - ServerBuilderMain.setup(server); - } - - @Test - public void testBuilderAccessSuccessful() { - Http1Client client = ClientBuilderMain.createClient(); - assertThat(callUnsecured(client, server.port()), is("Hello world unsecured!")); - assertThat(callSecured(client, server.port("secured")), is("Hello Helidon-client!")); - } -} diff --git a/examples/webserver/observe/pom.xml b/examples/webserver/observe/pom.xml new file mode 100644 index 00000000000..78388b18155 --- /dev/null +++ b/examples/webserver/observe/pom.xml @@ -0,0 +1,115 @@ + + + + 4.0.0 + + io.helidon.applications + helidon-se + 4.0.0-SNAPSHOT + ../../../applications/se/pom.xml + + + io.helidon.examples.webserver + helidon-examples-webserver-observe + Helidon Examples WebServer Observe + + + io.helidon.examples.webserver.observe.ObserveMain + + + + + io.helidon.webserver + helidon-webserver + + + io.helidon.webserver.observe + helidon-webserver-observe-health + + + io.helidon.webserver.observe + helidon-webserver-observe-config + + + io.helidon.webserver.observe + helidon-webserver-observe-info + + + io.helidon.webserver.observe + helidon-webserver-observe-log + + + io.helidon.webserver + helidon-webserver-security + + + io.helidon.security.providers + helidon-security-providers-http-auth + + + io.helidon.webserver + helidon-webserver-context + + + io.helidon.config + helidon-config-yaml + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-libs + + + + + org.apache.maven.plugins + maven-failsafe-plugin + + + + integration-test + verify + + + + + + + diff --git a/examples/nima/observe/src/main/java/io/helidon/examples/nima/observe/ObserveMain.java b/examples/webserver/observe/src/main/java/io/helidon/examples/webserver/observe/ObserveMain.java similarity index 83% rename from examples/nima/observe/src/main/java/io/helidon/examples/nima/observe/ObserveMain.java rename to examples/webserver/observe/src/main/java/io/helidon/examples/webserver/observe/ObserveMain.java index dde4756e506..ac2f92f85da 100644 --- a/examples/nima/observe/src/main/java/io/helidon/examples/nima/observe/ObserveMain.java +++ b/examples/webserver/observe/src/main/java/io/helidon/examples/webserver/observe/ObserveMain.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package io.helidon.examples.nima.observe; +package io.helidon.examples.webserver.observe; import io.helidon.config.Config; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.observe.ObserveFeature; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.context.ContextFeature; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.security.integration.nima.SecurityFeature; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.context.ContextFeature; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.observe.ObserveFeature; +import io.helidon.webserver.security.SecurityFeature; /** * Register observe support with all available observers and NO security. @@ -62,6 +62,6 @@ static void routing(Config config, HttpRouting.Builder router) { router.addFeature(SecurityFeature.create(config.get("security"))) .addFeature(ContextFeature.create(config.get("context"))) .addFeature(ObserveFeature.create(config.get("observe"))) - .get("/", (req, res) -> res.send("Níma Works!")); + .get("/", (req, res) -> res.send("WebServer Works!")); } } diff --git a/examples/webserver/observe/src/main/java/io/helidon/examples/webserver/observe/package-info.java b/examples/webserver/observe/src/main/java/io/helidon/examples/webserver/observe/package-info.java new file mode 100644 index 00000000000..a61404f2564 --- /dev/null +++ b/examples/webserver/observe/src/main/java/io/helidon/examples/webserver/observe/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Observability example. + */ +package io.helidon.examples.webserver.observe; diff --git a/examples/webserver/observe/src/main/resources/application.yaml b/examples/webserver/observe/src/main/resources/application.yaml new file mode 100644 index 00000000000..1f5934109cc --- /dev/null +++ b/examples/webserver/observe/src/main/resources/application.yaml @@ -0,0 +1,42 @@ +# +# Copyright (c) 2022, 2023 Oracle and/or its affiliates. +# +# 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. +# + +server: + host: "127.0.0.1" + port: 8080 +observe: + info: + values: + name: "Observe Example" + version: "1.0.0" +security: + providers: + - http-basic-auth: + users: + - login: "admin" + password: "password" + roles: ["nima-observe"] + web-server: + paths: + - path: "/observe/log/*" + authenticate: true + - path: "/observe/config/*" + authenticate: true + +app: + greeting: "Hello!" + app-secret: "Do not print this in observe" + app-password: "Do not print this in observe" diff --git a/examples/webserver/observe/src/main/resources/logging.properties b/examples/webserver/observe/src/main/resources/logging.properties new file mode 100644 index 00000000000..1c99b019810 --- /dev/null +++ b/examples/webserver/observe/src/main/resources/logging.properties @@ -0,0 +1,24 @@ +# +# Copyright (c) 2022, 2023 Oracle and/or its affiliates. +# +# 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. +# +handlers=java.util.logging.ConsoleHandler +java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS.%1$tL %5$s%6$s%n +# Global logging level. Can be overridden by specific loggers +.level=INFO +io.helidon.webserve.level=INFO + +java.util.logging.ConsoleHandler.level=ALL +# to enable security audit logging for Helidon: +# AUDIT.level=FINEST diff --git a/examples/nima/observe/src/test/java/io/helidon/examples/nima/observe/AbstractObserveTest.java b/examples/webserver/observe/src/test/java/io/helidon/examples/webserver/observe/AbstractObserveTest.java similarity index 82% rename from examples/nima/observe/src/test/java/io/helidon/examples/nima/observe/AbstractObserveTest.java rename to examples/webserver/observe/src/test/java/io/helidon/examples/webserver/observe/AbstractObserveTest.java index 2b96b00f4e0..cf4ec63efbe 100644 --- a/examples/nima/observe/src/test/java/io/helidon/examples/nima/observe/AbstractObserveTest.java +++ b/examples/webserver/observe/src/test/java/io/helidon/examples/webserver/observe/AbstractObserveTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.examples.nima.observe; +package io.helidon.examples.webserver.observe; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.config.Config; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.http.HttpRouting; import org.junit.jupiter.api.Test; @@ -48,7 +48,7 @@ void testRootRoute() { .request() .as(String.class); - assertThat(response, is("Níma Works!")); + assertThat(response, is("WebServer Works!")); } @Test diff --git a/examples/nima/observe/src/test/java/io/helidon/examples/nima/observe/ObserveRoutingIT.java b/examples/webserver/observe/src/test/java/io/helidon/examples/webserver/observe/ObserveRoutingIT.java similarity index 77% rename from examples/nima/observe/src/test/java/io/helidon/examples/nima/observe/ObserveRoutingIT.java rename to examples/webserver/observe/src/test/java/io/helidon/examples/webserver/observe/ObserveRoutingIT.java index 17909840fdb..786d123fb25 100644 --- a/examples/nima/observe/src/test/java/io/helidon/examples/nima/observe/ObserveRoutingIT.java +++ b/examples/webserver/observe/src/test/java/io/helidon/examples/webserver/observe/ObserveRoutingIT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.helidon.examples.nima.observe; +package io.helidon.examples.webserver.observe; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.webclient.http1.Http1Client; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webclient.http1.Http1Client; @ServerTest class ObserveRoutingIT extends AbstractObserveTest { diff --git a/examples/nima/observe/src/test/java/io/helidon/examples/nima/observe/ObserveRoutingTest.java b/examples/webserver/observe/src/test/java/io/helidon/examples/webserver/observe/ObserveRoutingTest.java similarity index 76% rename from examples/nima/observe/src/test/java/io/helidon/examples/nima/observe/ObserveRoutingTest.java rename to examples/webserver/observe/src/test/java/io/helidon/examples/webserver/observe/ObserveRoutingTest.java index dc12926090d..f7ff90614e2 100644 --- a/examples/nima/observe/src/test/java/io/helidon/examples/nima/observe/ObserveRoutingTest.java +++ b/examples/webserver/observe/src/test/java/io/helidon/examples/webserver/observe/ObserveRoutingTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.helidon.examples.nima.observe; +package io.helidon.examples.webserver.observe; -import io.helidon.nima.testing.junit5.webserver.DirectClient; -import io.helidon.nima.testing.junit5.webserver.RoutingTest; +import io.helidon.webserver.testing.junit5.DirectClient; +import io.helidon.webserver.testing.junit5.RoutingTest; @RoutingTest class ObserveRoutingTest extends AbstractObserveTest { @@ -26,4 +26,3 @@ class ObserveRoutingTest extends AbstractObserveTest { } } - diff --git a/examples/webserver/observe/src/test/resources/logging-test.properties b/examples/webserver/observe/src/test/resources/logging-test.properties new file mode 100644 index 00000000000..e0e9004a51a --- /dev/null +++ b/examples/webserver/observe/src/test/resources/logging-test.properties @@ -0,0 +1,22 @@ +# +# Copyright (c) 2022, 2023 Oracle and/or its affiliates. +# +# 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. +# +handlers=java.util.logging.ConsoleHandler +java.util.logging.ConsoleHandler.level=FINEST +java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter +# java.util.logging.SimpleFormatter.format = [%1$tc] %5$s %6$s%n +java.util.logging.SimpleFormatter.format=%1$tH:%1$tM:%1$tS %5$s%6$s%n +# Global logging level. Can be overridden by specific loggers +.level=WARNING diff --git a/examples/webserver/opentracing/pom.xml b/examples/webserver/opentracing/pom.xml index b2b2c9b08be..8e485cab659 100644 --- a/examples/webserver/opentracing/pom.xml +++ b/examples/webserver/opentracing/pom.xml @@ -29,25 +29,25 @@ io.helidon.examples.webserver helidon-examples-webserver-opentracing - Helidon WebServer Examples OpenTracing + Helidon Examples WebServer OpenTracing An example app with Open Tracing support. - io.helidon.webserver.examples.opentracing.Main + io.helidon.examples.webserver.opentracing.Main 2.23.4 - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.nima.webserver - helidon-nima-webserver-tracing + io.helidon.webserver + helidon-webserver-tracing io.helidon.logging diff --git a/examples/webserver/opentracing/src/main/java/io/helidon/examples/webserver/opentracing/Main.java b/examples/webserver/opentracing/src/main/java/io/helidon/examples/webserver/opentracing/Main.java new file mode 100644 index 00000000000..b7a8078b213 --- /dev/null +++ b/examples/webserver/opentracing/src/main/java/io/helidon/examples/webserver/opentracing/Main.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.examples.webserver.opentracing; + +import io.helidon.config.Config; +import io.helidon.config.ConfigSources; +import io.helidon.logging.common.LogConfig; +import io.helidon.tracing.Tracer; +import io.helidon.tracing.TracerBuilder; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.tracing.TracingFeature; + +/** + * The application uses Open Tracing and sends the collected data to ZipKin. + * + * @see io.helidon.tracing.TracerBuilder + * @see io.helidon.tracing.providers.zipkin.ZipkinTracerBuilder + */ +public final class Main { + + private Main() { + } + + /** + * Run the OpenTracing application. + * + * @param args not used + */ + public static void main(String[] args) { + + // configure logging in order to not have the standard JVM defaults + LogConfig.configureRuntime(); + + Config config = Config.builder() + .sources(ConfigSources.environmentVariables()) + .build(); + + Tracer tracer = TracerBuilder.create(config.get("tracing")) + .serviceName("demo-first") + .registerGlobal(true) + .build(); + + WebServer server = WebServer.builder() + .routing(routing -> routing + .addFeature(TracingFeature.create(tracer)) + .any((req, res) -> { + System.out.println("Received another request."); + res.next(); + }) + .get("/test", (req, res) -> res.send("Hello World!")) + .post("/hello", (req, res) -> res.send("Hello: " + req.content().as(String.class)))) + .port(8080) + .build() + .start(); + + System.out.println("Started at http://localhost:" + server.port()); + } + +} diff --git a/examples/webserver/opentracing/src/main/java/io/helidon/examples/webserver/opentracing/package-info.java b/examples/webserver/opentracing/src/main/java/io/helidon/examples/webserver/opentracing/package-info.java new file mode 100644 index 00000000000..33bdba7930d --- /dev/null +++ b/examples/webserver/opentracing/src/main/java/io/helidon/examples/webserver/opentracing/package-info.java @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * An example of WebServer app supporting Open Tracing. + * + * @see io.helidon.examples.webserver.opentracing.Main + */ +package io.helidon.examples.webserver.opentracing; diff --git a/examples/webserver/opentracing/src/main/java/io/helidon/webserver/examples/opentracing/Main.java b/examples/webserver/opentracing/src/main/java/io/helidon/webserver/examples/opentracing/Main.java deleted file mode 100644 index a069f0e3353..00000000000 --- a/examples/webserver/opentracing/src/main/java/io/helidon/webserver/examples/opentracing/Main.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2017, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.webserver.examples.opentracing; - -import io.helidon.config.Config; -import io.helidon.config.ConfigSources; -import io.helidon.logging.common.LogConfig; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.tracing.TracingFeature; -import io.helidon.tracing.Tracer; -import io.helidon.tracing.TracerBuilder; - -/** - * The application uses Open Tracing and sends the collected data to ZipKin. - * - * @see io.helidon.tracing.TracerBuilder - * @see io.helidon.tracing.providers.zipkin.ZipkinTracerBuilder - */ -public final class Main { - - private Main() { - } - - /** - * Run the OpenTracing application. - * - * @param args not used - */ - public static void main(String[] args) { - - // configure logging in order to not have the standard JVM defaults - LogConfig.configureRuntime(); - - Config config = Config.builder() - .sources(ConfigSources.environmentVariables()) - .build(); - - Tracer tracer = TracerBuilder.create(config.get("tracing")) - .serviceName("demo-first") - .registerGlobal(true) - .build(); - - WebServer server = WebServer.builder() - .routing(routing -> routing - .addFeature(TracingFeature.create(tracer)) - .any((req, res) -> { - System.out.println("Received another request."); - res.next(); - }) - .get("/test", (req, res) -> res.send("Hello World!")) - .post("/hello", (req, res) -> res.send("Hello: " + req.content().as(String.class)))) - .port(8080) - .build() - .start(); - - System.out.println("Started at http://localhost:" + server.port()); - } - -} diff --git a/examples/webserver/opentracing/src/main/java/io/helidon/webserver/examples/opentracing/package-info.java b/examples/webserver/opentracing/src/main/java/io/helidon/webserver/examples/opentracing/package-info.java deleted file mode 100644 index eb0736b817a..00000000000 --- a/examples/webserver/opentracing/src/main/java/io/helidon/webserver/examples/opentracing/package-info.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2017, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * An example of WebServer app supporting Open Tracing. - * - * @see io.helidon.webserver.examples.opentracing.Main - */ -package io.helidon.webserver.examples.opentracing; diff --git a/examples/webserver/opentracing/src/main/resources/logging.properties b/examples/webserver/opentracing/src/main/resources/logging.properties index ae8a6201065..673d47dd82d 100644 --- a/examples/webserver/opentracing/src/main/resources/logging.properties +++ b/examples/webserver/opentracing/src/main/resources/logging.properties @@ -22,5 +22,5 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ #All log level details .level=FINEST -io.helidon.nima.webserver.level=FINEST +io.helidon.webserver.level=FINEST org.glassfish.jersey.internal.Errors.level=SEVERE diff --git a/examples/webserver/pom.xml b/examples/webserver/pom.xml index 10b8e09f3e7..316859c3a1b 100644 --- a/examples/webserver/pom.xml +++ b/examples/webserver/pom.xml @@ -28,20 +28,26 @@ io.helidon.examples.webserver helidon-examples-webserver-project - Helidon WebServer Examples + Helidon Examples WebServer pom + basic basics - tutorial comment-aas - static-content + echo + fault-tolerance + imperative + multiport + mutual-tls + observe opentracing + protocols + static-content streaming - websocket tls - mutual-tls - fault-tolerance - multiport + tracing + tutorial + websocket diff --git a/examples/webserver/protocols/pom.xml b/examples/webserver/protocols/pom.xml new file mode 100644 index 00000000000..2e7a2f8cbe7 --- /dev/null +++ b/examples/webserver/protocols/pom.xml @@ -0,0 +1,114 @@ + + + + 4.0.0 + + io.helidon.applications + helidon-se + 4.0.0-SNAPSHOT + ../../../applications/se/pom.xml + + + io.helidon.examples.webserver + helidon-examples-webserver-protocols + Helidon Examples WebServer Protocols + + + io.helidon.examples.webserver.protocols.ProtocolsMain + + + + + + javax.annotation + javax.annotation-api + 1.3.2 + + + io.helidon.webserver + helidon-webserver + + + io.helidon.webserver + helidon-webserver-grpc + + + io.helidon.webclient + helidon-webclient-http2 + + + io.helidon.webserver + helidon-webserver-websocket + + + io.helidon.webserver + helidon-webserver-http2 + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + + + + + kr.motd.maven + os-maven-plugin + ${version.plugin.os} + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-libs + + + + + org.xolstice.maven.plugins + protobuf-maven-plugin + 0.6.1 + + + + compile + compile-custom + + + + + com.google.protobuf:protoc:3.5.1-1:exe:${os.detected.classifier} + grpc-java + io.grpc:protoc-gen-grpc-java:${version.lib.grpc}:exe:${os.detected.classifier} + + + + + + diff --git a/examples/nima/protocols/src/main/java/io/helidon/examples/nima/protocols/ProtocolsMain.java b/examples/webserver/protocols/src/main/java/io/helidon/examples/webserver/protocols/ProtocolsMain.java similarity index 84% rename from examples/nima/protocols/src/main/java/io/helidon/examples/nima/protocols/ProtocolsMain.java rename to examples/webserver/protocols/src/main/java/io/helidon/examples/webserver/protocols/ProtocolsMain.java index aa2926ef0de..b04a3c6f83e 100644 --- a/examples/nima/protocols/src/main/java/io/helidon/examples/nima/protocols/ProtocolsMain.java +++ b/examples/webserver/protocols/src/main/java/io/helidon/examples/webserver/protocols/ProtocolsMain.java @@ -14,34 +14,34 @@ * limitations under the License. */ -package io.helidon.examples.nima.protocols; +package io.helidon.examples.webserver.protocols; import java.nio.charset.StandardCharsets; import java.util.Locale; import io.helidon.common.configurable.Resource; import io.helidon.common.pki.Keys; -import io.helidon.examples.nima.grpc.strings.Strings; +import io.helidon.common.tls.Tls; +import io.helidon.examples.grpc.strings.Strings; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.common.tls.Tls; -import io.helidon.nima.grpc.webserver.GrpcRouting; -import io.helidon.nima.http2.webserver.Http2Route; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http1.Http1Route; -import io.helidon.nima.websocket.WsListener; -import io.helidon.nima.websocket.WsSession; -import io.helidon.nima.websocket.webserver.WsRouting; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.grpc.GrpcRouting; +import io.helidon.webserver.http1.Http1Route; +import io.helidon.webserver.http2.Http2Route; +import io.helidon.webserver.websocket.WsRouting; +import io.helidon.websocket.WsListener; +import io.helidon.websocket.WsSession; import io.grpc.stub.StreamObserver; -import static io.helidon.common.http.Http.Method.GET; -import static io.helidon.nima.grpc.webserver.ResponseHelper.complete; +import static io.helidon.http.Http.Method.GET; +import static io.helidon.webserver.grpc.ResponseHelper.complete; /** * Example showing supported protocols. */ public class ProtocolsMain { - private static final byte[] RESPONSE = "Hello from Níma!".getBytes(StandardCharsets.UTF_8); + private static final byte[] RESPONSE = "Hello from WebServer!".getBytes(StandardCharsets.UTF_8); private ProtocolsMain() { } diff --git a/examples/webserver/protocols/src/main/java/io/helidon/examples/webserver/protocols/package-info.java b/examples/webserver/protocols/src/main/java/io/helidon/examples/webserver/protocols/package-info.java new file mode 100644 index 00000000000..466940aae3a --- /dev/null +++ b/examples/webserver/protocols/src/main/java/io/helidon/examples/webserver/protocols/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Various supported protocols example. + */ +package io.helidon.examples.webserver.protocols; diff --git a/examples/webserver/protocols/src/main/proto/events.proto b/examples/webserver/protocols/src/main/proto/events.proto new file mode 100644 index 00000000000..7605150f7bc --- /dev/null +++ b/examples/webserver/protocols/src/main/proto/events.proto @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * 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. + */ + + +syntax = "proto3"; +option java_package = "io.helidon.webserver.grpc.events"; + +import "google/protobuf/empty.proto"; + +service EventService { + rpc Send (Message) returns (google.protobuf.Empty) {} + rpc Events (stream EventRequest) returns (stream EventResponse) {} +} + +message Message { + string text = 2; +} + +message EventRequest { + int64 id = 1; + enum Action { + SUBSCRIBE = 0; + UNSUBSCRIBE = 1; + } + Action action = 2; +} + +message EventResponse { + oneof response_type { + Subscribed subscribed = 1; + Unsubscribed unsubscribed = 2; + Event event = 3; + } +} + +message Subscribed { + int64 id = 1; +} + +message Unsubscribed { + int64 id = 1; +} + +message Event { + int64 id = 1; + string text = 2; +} diff --git a/examples/webserver/protocols/src/main/proto/strings.proto b/examples/webserver/protocols/src/main/proto/strings.proto new file mode 100644 index 00000000000..d1a4f7be178 --- /dev/null +++ b/examples/webserver/protocols/src/main/proto/strings.proto @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2021 Oracle and/or its affiliates. + * + * 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. + */ + + +syntax = "proto3"; +option java_package = "io.helidon.examples.grpc.strings"; + +service StringService { + rpc Upper (StringMessage) returns (StringMessage) {} + rpc Lower (StringMessage) returns (StringMessage) {} + rpc Split (StringMessage) returns (stream StringMessage) {} + rpc Join (stream StringMessage) returns (StringMessage) {} + rpc Echo (stream StringMessage) returns (stream StringMessage) {} +} + +message StringMessage { + string text = 1; +} diff --git a/examples/nima/protocols/src/main/resources/certificate.p12 b/examples/webserver/protocols/src/main/resources/certificate.p12 similarity index 100% rename from examples/nima/protocols/src/main/resources/certificate.p12 rename to examples/webserver/protocols/src/main/resources/certificate.p12 diff --git a/examples/webserver/protocols/src/main/resources/logging.properties b/examples/webserver/protocols/src/main/resources/logging.properties new file mode 100644 index 00000000000..d09df1098a3 --- /dev/null +++ b/examples/webserver/protocols/src/main/resources/logging.properties @@ -0,0 +1,20 @@ +# +# Copyright (c) 2022, 2023 Oracle and/or its affiliates. +# +# 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. +# +handlers=java.util.logging.ConsoleHandler +java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS.%1$tL %5$s%6$s%n +# Global logging level. Can be overridden by specific loggers +.level=INFO +io.helidon.webserver.level=INFO diff --git a/examples/webserver/static-content/pom.xml b/examples/webserver/static-content/pom.xml index 74b364b343e..46dc5d6ad24 100644 --- a/examples/webserver/static-content/pom.xml +++ b/examples/webserver/static-content/pom.xml @@ -29,7 +29,7 @@ io.helidon.examples.webserver helidon-examples-webserver-static-content - Helidon WebServer Examples Static Content + Helidon Examples WebServer Static Content Application demonstrates combination of the static content with a simple REST API. It counts accesses and display it @@ -37,25 +37,25 @@ - io.helidon.webserver.examples.staticcontent.Main + io.helidon.examples.webserver.staticcontent.Main - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.nima.webserver - helidon-nima-webserver-static-content + io.helidon.webserver + helidon-webserver-static-content - io.helidon.nima.http.media - helidon-nima-http-media-jsonp + io.helidon.http.media + helidon-http-media-jsonp - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test diff --git a/examples/webserver/static-content/src/main/java/io/helidon/webserver/examples/staticcontent/CounterService.java b/examples/webserver/static-content/src/main/java/io/helidon/examples/webserver/staticcontent/CounterService.java similarity index 87% rename from examples/webserver/static-content/src/main/java/io/helidon/webserver/examples/staticcontent/CounterService.java rename to examples/webserver/static-content/src/main/java/io/helidon/examples/webserver/staticcontent/CounterService.java index 578bad4c7e2..35a18fb2cab 100644 --- a/examples/webserver/static-content/src/main/java/io/helidon/webserver/examples/staticcontent/CounterService.java +++ b/examples/webserver/static-content/src/main/java/io/helidon/examples/webserver/staticcontent/CounterService.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package io.helidon.webserver.examples.staticcontent; +package io.helidon.examples.webserver.staticcontent; import java.util.Collections; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.LongAdder; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import jakarta.json.Json; import jakarta.json.JsonBuilderFactory; diff --git a/examples/webserver/static-content/src/main/java/io/helidon/examples/webserver/staticcontent/Main.java b/examples/webserver/static-content/src/main/java/io/helidon/examples/webserver/staticcontent/Main.java new file mode 100644 index 00000000000..8a7a66b0795 --- /dev/null +++ b/examples/webserver/static-content/src/main/java/io/helidon/examples/webserver/staticcontent/Main.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.examples.webserver.staticcontent; + +import io.helidon.http.Http; +import io.helidon.logging.common.LogConfig; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.staticcontent.StaticContentService; + +/** + * The application main class. + */ +public final class Main { + private static final Http.Header UI_REDIRECT = Http.Headers.createCached(Http.HeaderNames.LOCATION, "/ui"); + + /** + * Cannot be instantiated. + */ + private Main() { + } + + /** + * Application main entry point. + * + * @param args command line arguments. + */ + public static void main(String[] args) { + // load logging configuration + LogConfig.configureRuntime(); + + WebServer server = WebServer.builder() + .port(8080) + .routing(Main::routing) + .build() + .start(); + + System.out.println("WEB server is up! http://localhost:" + server.port() + "/greet"); + } + + /** + * Updates HTTP Routing. + */ + static void routing(HttpRouting.Builder routing) { + routing.any("/", (req, res) -> { + // showing the capability to run on any path, and redirecting from root + res.status(Http.Status.MOVED_PERMANENTLY_301); + res.headers().set(UI_REDIRECT); + res.send(); + }) + .register("/ui", CounterService::new) + .register("/ui", StaticContentService.builder("WEB") + .welcomeFileName("index.html") + .build()); + } +} diff --git a/examples/webserver/static-content/src/main/java/io/helidon/examples/webserver/staticcontent/package-info.java b/examples/webserver/static-content/src/main/java/io/helidon/examples/webserver/staticcontent/package-info.java new file mode 100644 index 00000000000..9e61223eac9 --- /dev/null +++ b/examples/webserver/static-content/src/main/java/io/helidon/examples/webserver/staticcontent/package-info.java @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Application demonstrates combination of the static content with a simple REST API. It counts accesses and display it + * on the WEB page. + *

+ * Start with {@link io.helidon.examples.webserver.staticcontent.Main} class. + * + * @see io.helidon.examples.webserver.staticcontent.Main + */ +package io.helidon.examples.webserver.staticcontent; diff --git a/examples/webserver/static-content/src/main/java/io/helidon/webserver/examples/staticcontent/Main.java b/examples/webserver/static-content/src/main/java/io/helidon/webserver/examples/staticcontent/Main.java deleted file mode 100644 index 15ae9f709ef..00000000000 --- a/examples/webserver/static-content/src/main/java/io/helidon/webserver/examples/staticcontent/Main.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2017, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.webserver.examples.staticcontent; - -import io.helidon.common.http.Http; -import io.helidon.logging.common.LogConfig; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.staticcontent.StaticContentService; - -/** - * The application main class. - */ -public final class Main { - private static final Http.Header UI_REDIRECT = Http.Headers.createCached(Http.HeaderNames.LOCATION, "/ui"); - - /** - * Cannot be instantiated. - */ - private Main() { - } - - /** - * Application main entry point. - * - * @param args command line arguments. - */ - public static void main(String[] args) { - // load logging configuration - LogConfig.configureRuntime(); - - WebServer server = WebServer.builder() - .port(8080) - .routing(Main::routing) - .build() - .start(); - - System.out.println("WEB server is up! http://localhost:" + server.port() + "/greet"); - } - - /** - * Updates HTTP Routing. - */ - static void routing(HttpRouting.Builder routing) { - routing.any("/", (req, res) -> { - // showing the capability to run on any path, and redirecting from root - res.status(Http.Status.MOVED_PERMANENTLY_301); - res.headers().set(UI_REDIRECT); - res.send(); - }) - .register("/ui", CounterService::new) - .register("/ui", StaticContentService.builder("WEB") - .welcomeFileName("index.html") - .build()); - } -} diff --git a/examples/webserver/static-content/src/main/java/io/helidon/webserver/examples/staticcontent/package-info.java b/examples/webserver/static-content/src/main/java/io/helidon/webserver/examples/staticcontent/package-info.java deleted file mode 100644 index 815f68fe5eb..00000000000 --- a/examples/webserver/static-content/src/main/java/io/helidon/webserver/examples/staticcontent/package-info.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2017, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Application demonstrates combination of the static content with a simple REST API. It counts accesses and display it - * on the WEB page. - *

- * Start with {@link io.helidon.webserver.examples.staticcontent.Main} class. - * - * @see io.helidon.webserver.examples.staticcontent.Main - */ -package io.helidon.webserver.examples.staticcontent; diff --git a/examples/webserver/static-content/src/test/java/io/helidon/examples/webserver/staticcontent/MainTest.java b/examples/webserver/static-content/src/test/java/io/helidon/examples/webserver/staticcontent/MainTest.java new file mode 100644 index 00000000000..1157d9d4e16 --- /dev/null +++ b/examples/webserver/static-content/src/test/java/io/helidon/examples/webserver/staticcontent/MainTest.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.examples.webserver.staticcontent; + +import io.helidon.http.Http; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.http.HttpRouting; +import jakarta.json.JsonNumber; +import jakarta.json.JsonObject; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +@ServerTest +class MainTest { + + private final Http1Client client; + + protected MainTest(Http1Client client) { + this.client = client; + } + + @SetUpRoute + static void routing(HttpRouting.Builder builder) { + Main.routing(builder); + } + + @Test + void testUi() { + assertThat(allCounter(), is(1)); + try (Http1ClientResponse response = client.get("/ui/index.html").request()) { + assertThat(response.status(), is(Http.Status.OK_200)); + assertThat(response.headers().contentType().orElseThrow().text(), is("text/html")); + } + try (Http1ClientResponse response = client.get("/ui/css/app.css").request()) { + assertThat(response.status(), is(Http.Status.OK_200)); + assertThat(response.headers().contentType().orElseThrow().text(), is("text/css")); + } + try (Http1ClientResponse response = client.get("/ui/js/app.js").request()) { + assertThat(response.status(), is(Http.Status.OK_200)); + assertThat(response.headers().contentType().orElseThrow().text(), is("text/javascript")); + } + assertThat(allCounter(), is(5)); // includes /ui/api/counter calls + } + + private int allCounter() { + try (Http1ClientResponse response = client.get("/ui/api/counter").request()) { + assertThat(response.status(), is(Http.Status.OK_200)); + JsonNumber number = (JsonNumber) response.as(JsonObject.class).get("all"); + return number.intValue(); + } + } +} diff --git a/examples/webserver/static-content/src/test/java/io/helidon/webserver/examples/staticcontent/MainTest.java b/examples/webserver/static-content/src/test/java/io/helidon/webserver/examples/staticcontent/MainTest.java deleted file mode 100644 index 21411a72893..00000000000 --- a/examples/webserver/static-content/src/test/java/io/helidon/webserver/examples/staticcontent/MainTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.webserver.examples.staticcontent; - -import io.helidon.common.http.Http; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.http.HttpRouting; -import jakarta.json.JsonNumber; -import jakarta.json.JsonObject; -import org.junit.jupiter.api.Test; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; - -@ServerTest -class MainTest { - - private final Http1Client client; - - protected MainTest(Http1Client client) { - this.client = client; - } - - @SetUpRoute - static void routing(HttpRouting.Builder builder) { - Main.routing(builder); - } - - @Test - void testUi() { - assertThat(allCounter(), is(1)); - try (Http1ClientResponse response = client.get("/ui/index.html").request()) { - assertThat(response.status(), is(Http.Status.OK_200)); - assertThat(response.headers().contentType().orElseThrow().text(), is("text/html")); - } - try (Http1ClientResponse response = client.get("/ui/css/app.css").request()) { - assertThat(response.status(), is(Http.Status.OK_200)); - assertThat(response.headers().contentType().orElseThrow().text(), is("text/css")); - } - try (Http1ClientResponse response = client.get("/ui/js/app.js").request()) { - assertThat(response.status(), is(Http.Status.OK_200)); - assertThat(response.headers().contentType().orElseThrow().text(), is("text/javascript")); - } - assertThat(allCounter(), is(5)); // includes /ui/api/counter calls - } - - private int allCounter() { - try (Http1ClientResponse response = client.get("/ui/api/counter").request()) { - assertThat(response.status(), is(Http.Status.OK_200)); - JsonNumber number = (JsonNumber) response.as(JsonObject.class).get("all"); - return number.intValue(); - } - } -} diff --git a/examples/webserver/streaming/pom.xml b/examples/webserver/streaming/pom.xml index 9fbdc0e5d5b..485ef29ff0e 100644 --- a/examples/webserver/streaming/pom.xml +++ b/examples/webserver/streaming/pom.xml @@ -29,7 +29,7 @@ io.helidon.examples.webserver helidon-examples-webserver-streaming - Helidon WebServer Examples Streaming + Helidon Examples WebServer Streaming Application that demonstrates how to write a service that uploads and downloads @@ -37,13 +37,13 @@ - io.helidon.webserver.examples.streaming.Main + io.helidon.examples.webserver.streaming.Main - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver org.junit.jupiter diff --git a/examples/webserver/streaming/src/main/java/io/helidon/examples/webserver/streaming/Main.java b/examples/webserver/streaming/src/main/java/io/helidon/examples/webserver/streaming/Main.java new file mode 100644 index 00000000000..068d176669f --- /dev/null +++ b/examples/webserver/streaming/src/main/java/io/helidon/examples/webserver/streaming/Main.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2018, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.examples.webserver.streaming; + +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.http.HttpRouting; + +/** + * Class Main. Entry point to streaming application. + */ +public class Main { + + static final String LARGE_FILE_RESOURCE = "/large-file.bin"; + + private Main() { + } + + /** + * Setup {@link HttpRouting}. + */ + static void routing(HttpRouting.Builder routing) { + routing.register(new StreamingService()); + } + + /** + * A java main class. + * + * @param args command line arguments. + */ + public static void main(String[] args) { + WebServerConfig.Builder builder = WebServer.builder().port(8080); + builder.routing(Main::routing); + WebServer server = builder.build().start(); + System.out.println("Steaming service is up at http://localhost:" + server.port()); + } +} diff --git a/examples/webserver/streaming/src/main/java/io/helidon/webserver/examples/streaming/StreamingService.java b/examples/webserver/streaming/src/main/java/io/helidon/examples/webserver/streaming/StreamingService.java similarity index 86% rename from examples/webserver/streaming/src/main/java/io/helidon/webserver/examples/streaming/StreamingService.java rename to examples/webserver/streaming/src/main/java/io/helidon/examples/webserver/streaming/StreamingService.java index d3fbc9a79be..52aa761bf3b 100644 --- a/examples/webserver/streaming/src/main/java/io/helidon/webserver/examples/streaming/StreamingService.java +++ b/examples/webserver/streaming/src/main/java/io/helidon/examples/webserver/streaming/StreamingService.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.webserver.examples.streaming; +package io.helidon.examples.webserver.streaming; import java.io.IOException; import java.io.UncheckedIOException; @@ -25,12 +25,10 @@ import java.util.Objects; import java.util.logging.Logger; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; - -import static io.helidon.webserver.examples.streaming.Main.LARGE_FILE_RESOURCE; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; /** * StreamingService class. @@ -43,7 +41,7 @@ public class StreamingService implements HttpService { StreamingService() { try { - filePath = Paths.get(Objects.requireNonNull(getClass().getResource(LARGE_FILE_RESOURCE)).toURI()); + filePath = Paths.get(Objects.requireNonNull(getClass().getResource(Main.LARGE_FILE_RESOURCE)).toURI()); } catch (URISyntaxException e) { throw new RuntimeException(e); } diff --git a/examples/webserver/streaming/src/main/java/io/helidon/examples/webserver/streaming/package-info.java b/examples/webserver/streaming/src/main/java/io/helidon/examples/webserver/streaming/package-info.java new file mode 100644 index 00000000000..48157a583ef --- /dev/null +++ b/examples/webserver/streaming/src/main/java/io/helidon/examples/webserver/streaming/package-info.java @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2018, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + *

+ * Start with {@link io.helidon.examples.webserver.streaming.Main} class. + * + * @see io.helidon.examples.webserver.streaming.Main + */ +package io.helidon.examples.webserver.streaming; diff --git a/examples/webserver/streaming/src/main/java/io/helidon/webserver/examples/streaming/Main.java b/examples/webserver/streaming/src/main/java/io/helidon/webserver/examples/streaming/Main.java deleted file mode 100644 index 045c3af0b02..00000000000 --- a/examples/webserver/streaming/src/main/java/io/helidon/webserver/examples/streaming/Main.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2018, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.webserver.examples.streaming; - -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.http.HttpRouting; - -/** - * Class Main. Entry point to streaming application. - */ -public class Main { - - static final String LARGE_FILE_RESOURCE = "/large-file.bin"; - - private Main() { - } - - /** - * Setup {@link HttpRouting}. - */ - static void routing(HttpRouting.Builder routing) { - routing.register(new StreamingService()); - } - - /** - * A java main class. - * - * @param args command line arguments. - */ - public static void main(String[] args) { - WebServerConfig.Builder builder = WebServer.builder().port(8080); - builder.routing(Main::routing); - WebServer server = builder.build().start(); - System.out.println("Steaming service is up at http://localhost:" + server.port()); - } -} diff --git a/examples/webserver/streaming/src/main/java/io/helidon/webserver/examples/streaming/package-info.java b/examples/webserver/streaming/src/main/java/io/helidon/webserver/examples/streaming/package-info.java deleted file mode 100644 index f701e89db4f..00000000000 --- a/examples/webserver/streaming/src/main/java/io/helidon/webserver/examples/streaming/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2018, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - *

- * Start with {@link io.helidon.webserver.examples.streaming.Main} class. - * - * @see io.helidon.webserver.examples.streaming.Main - */ -package io.helidon.webserver.examples.streaming; diff --git a/examples/webserver/tls/pom.xml b/examples/webserver/tls/pom.xml index ea8e821d045..9d3ddd8b18f 100644 --- a/examples/webserver/tls/pom.xml +++ b/examples/webserver/tls/pom.xml @@ -28,7 +28,7 @@ io.helidon.examples.webserver helidon-examples-webserver-tls - Helidon WebServer Examples TLS + Helidon Examples WebServer TLS Application demonstrates TLS configuration using a builder @@ -36,21 +36,21 @@ - io.helidon.webserver.examples.tls.Main + io.helidon.examples.webserver.tls.Main - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver io.helidon.config helidon-config-yaml - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test diff --git a/examples/webserver/tls/src/main/java/io/helidon/examples/webserver/tls/Main.java b/examples/webserver/tls/src/main/java/io/helidon/examples/webserver/tls/Main.java new file mode 100644 index 00000000000..f7a710fc1b2 --- /dev/null +++ b/examples/webserver/tls/src/main/java/io/helidon/examples/webserver/tls/Main.java @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.examples.webserver.tls; + +import io.helidon.common.configurable.Resource; +import io.helidon.config.Config; +import io.helidon.logging.common.LogConfig; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.http.HttpRouting; + +/** + * Main class of TLS example. + */ +public final class Main { + + // utility class + private Main() { + } + + /** + * Start the example. + * This will start two Helidon WebServers, both protected by TLS - one configured from config, one using a builder. + * Port of the servers will be configured from config, to be able to switch to an ephemeral port for tests. + * + * @param args start arguments are ignored + */ + public static void main(String[] args) { + LogConfig.configureRuntime(); + + Config config = Config.create(); + + WebServerConfig.Builder builder1 = WebServer.builder(); + setupConfigBased(builder1, config); + WebServer server1 = builder1.build().start(); + System.out.println("Started config based WebServer on https://localhost:" + server1.port()); + + WebServerConfig.Builder builder2 = WebServer.builder(); + setupBuilderBased(builder2); + WebServer server2 = builder2.build().start(); + System.out.println("Started builder based WebServer on http://localhost:" + server2.port()); + } + + static void setupBuilderBased(WebServerConfig.Builder server) { + server.routing(Main::routing) + .tls(tls -> tls + .privateKey(key -> key + .keystore(store -> store + .passphrase("password") + .keystore(Resource.create("server.p12")))) + .privateKeyCertChain(key -> key + .keystore(store -> store + .passphrase("password") + .keystore(Resource.create("server.p12"))))); + } + + static void setupConfigBased(WebServerConfig.Builder server, Config config) { + server.config(config).routing(Main::routing); + } + + static void routing(HttpRouting.Builder routing) { + routing.get("/", (req, res) -> res.send("Hello!")); + } +} diff --git a/examples/webserver/tls/src/main/java/io/helidon/examples/webserver/tls/package-info.java b/examples/webserver/tls/src/main/java/io/helidon/examples/webserver/tls/package-info.java new file mode 100644 index 00000000000..49d91fcd025 --- /dev/null +++ b/examples/webserver/tls/src/main/java/io/helidon/examples/webserver/tls/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Example of TLS configuration for webserver, using both {@link io.helidon.config.Config} and builder based approach. + */ +package io.helidon.examples.webserver.tls; diff --git a/examples/webserver/tls/src/main/java/io/helidon/webserver/examples/tls/Main.java b/examples/webserver/tls/src/main/java/io/helidon/webserver/examples/tls/Main.java deleted file mode 100644 index 7f3a3cf6dd8..00000000000 --- a/examples/webserver/tls/src/main/java/io/helidon/webserver/examples/tls/Main.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.webserver.examples.tls; - -import io.helidon.common.configurable.Resource; -import io.helidon.config.Config; -import io.helidon.logging.common.LogConfig; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.http.HttpRouting; - -/** - * Main class of TLS example. - */ -public final class Main { - - // utility class - private Main() { - } - - /** - * Start the example. - * This will start two Helidon WebServers, both protected by TLS - one configured from config, one using a builder. - * Port of the servers will be configured from config, to be able to switch to an ephemeral port for tests. - * - * @param args start arguments are ignored - */ - public static void main(String[] args) { - LogConfig.configureRuntime(); - - Config config = Config.create(); - - WebServerConfig.Builder builder1 = WebServer.builder(); - setupConfigBased(builder1, config); - WebServer server1 = builder1.build().start(); - System.out.println("Started config based WebServer on https://localhost:" + server1.port()); - - WebServerConfig.Builder builder2 = WebServer.builder(); - setupBuilderBased(builder2); - WebServer server2 = builder2.build().start(); - System.out.println("Started builder based WebServer on http://localhost:" + server2.port()); - } - - static void setupBuilderBased(WebServerConfig.Builder server) { - server.routing(Main::routing) - .tls(tls -> tls - .privateKey(key -> key - .keystore(store -> store - .passphrase("password") - .keystore(Resource.create("server.p12")))) - .privateKeyCertChain(key -> key - .keystore(store -> store - .passphrase("password") - .keystore(Resource.create("server.p12"))))); - } - - static void setupConfigBased(WebServerConfig.Builder server, Config config) { - server.config(config).routing(Main::routing); - } - - static void routing(HttpRouting.Builder routing) { - routing.get("/", (req, res) -> res.send("Hello!")); - } -} diff --git a/examples/webserver/tls/src/main/java/io/helidon/webserver/examples/tls/package-info.java b/examples/webserver/tls/src/main/java/io/helidon/webserver/examples/tls/package-info.java deleted file mode 100644 index 34beb6f4c16..00000000000 --- a/examples/webserver/tls/src/main/java/io/helidon/webserver/examples/tls/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Example of TLS configuration for webserver, using both {@link io.helidon.config.Config} and builder based approach. - */ -package io.helidon.webserver.examples.tls; diff --git a/examples/webserver/tls/src/test/java/io/helidon/webserver/examples/tls/BuilderBasedTest.java b/examples/webserver/tls/src/test/java/io/helidon/examples/webserver/tls/BuilderBasedTest.java similarity index 81% rename from examples/webserver/tls/src/test/java/io/helidon/webserver/examples/tls/BuilderBasedTest.java rename to examples/webserver/tls/src/test/java/io/helidon/examples/webserver/tls/BuilderBasedTest.java index eb95ae0e6c4..8431b35292e 100644 --- a/examples/webserver/tls/src/test/java/io/helidon/webserver/examples/tls/BuilderBasedTest.java +++ b/examples/webserver/tls/src/test/java/io/helidon/examples/webserver/tls/BuilderBasedTest.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.helidon.webserver.examples.tls; +package io.helidon.examples.webserver.tls; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; class BuilderBasedTest extends TestBase { diff --git a/examples/webserver/tls/src/test/java/io/helidon/webserver/examples/tls/ConfigBasedTest.java b/examples/webserver/tls/src/test/java/io/helidon/examples/webserver/tls/ConfigBasedTest.java similarity index 84% rename from examples/webserver/tls/src/test/java/io/helidon/webserver/examples/tls/ConfigBasedTest.java rename to examples/webserver/tls/src/test/java/io/helidon/examples/webserver/tls/ConfigBasedTest.java index 9ae0dd2ceb0..a5653c69680 100644 --- a/examples/webserver/tls/src/test/java/io/helidon/webserver/examples/tls/ConfigBasedTest.java +++ b/examples/webserver/tls/src/test/java/io/helidon/examples/webserver/tls/ConfigBasedTest.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.helidon.webserver.examples.tls; +package io.helidon.examples.webserver.tls; import io.helidon.config.Config; import io.helidon.config.ConfigSources; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; class ConfigBasedTest extends TestBase { diff --git a/examples/webserver/tls/src/test/java/io/helidon/webserver/examples/tls/TestBase.java b/examples/webserver/tls/src/test/java/io/helidon/examples/webserver/tls/TestBase.java similarity index 83% rename from examples/webserver/tls/src/test/java/io/helidon/webserver/examples/tls/TestBase.java rename to examples/webserver/tls/src/test/java/io/helidon/examples/webserver/tls/TestBase.java index 7ec02c26790..876ffb764f7 100644 --- a/examples/webserver/tls/src/test/java/io/helidon/webserver/examples/tls/TestBase.java +++ b/examples/webserver/tls/src/test/java/io/helidon/examples/webserver/tls/TestBase.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.webserver.examples.tls; +package io.helidon.examples.webserver.tls; -import io.helidon.nima.common.tls.Tls; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webserver.WebServer; +import io.helidon.common.tls.Tls; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webserver.WebServer; import org.junit.jupiter.api.Test; diff --git a/examples/webserver/tracing/pom.xml b/examples/webserver/tracing/pom.xml new file mode 100644 index 00000000000..ef089071db7 --- /dev/null +++ b/examples/webserver/tracing/pom.xml @@ -0,0 +1,90 @@ + + + + 4.0.0 + + io.helidon.applications + helidon-se + 4.0.0-SNAPSHOT + ../../../applications/se/pom.xml + + + io.helidon.examples.webserver + helidon-examples-webserver-tracing + Helidon Examples WebServer Tracing + + + io.helidon.examples.webserver.tracing.TracingMain + + + + + io.helidon.webserver + helidon-webserver + + + io.helidon.webserver + helidon-webserver-http2 + + + io.helidon.webserver + helidon-webserver-tracing + + + io.helidon.webclient + helidon-webclient + + + io.helidon.webclient + helidon-webclient-tracing + + + io.helidon.tracing.providers + helidon-tracing-providers-jaeger + + + io.helidon.config + helidon-config-yaml + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-libs + + + + + + diff --git a/examples/nima/tracing/src/main/java/io/helidon/examples/nima/tracing/TracingMain.java b/examples/webserver/tracing/src/main/java/io/helidon/examples/webserver/tracing/TracingMain.java similarity index 82% rename from examples/nima/tracing/src/main/java/io/helidon/examples/nima/tracing/TracingMain.java rename to examples/webserver/tracing/src/main/java/io/helidon/examples/webserver/tracing/TracingMain.java index 2b034cfdfb5..51e2c51bfb0 100644 --- a/examples/nima/tracing/src/main/java/io/helidon/examples/nima/tracing/TracingMain.java +++ b/examples/webserver/tracing/src/main/java/io/helidon/examples/webserver/tracing/TracingMain.java @@ -14,23 +14,23 @@ * limitations under the License. */ -package io.helidon.examples.nima.tracing; +package io.helidon.examples.webserver.tracing; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.http2.webserver.Http2Route; -import io.helidon.nima.webclient.api.WebClient; -import io.helidon.nima.webclient.tracing.WebClientTracing; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.Handler; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; -import io.helidon.nima.webserver.http1.Http1Route; -import io.helidon.nima.webserver.tracing.TracingFeature; import io.helidon.tracing.Span; import io.helidon.tracing.Tracer; import io.helidon.tracing.TracerBuilder; +import io.helidon.webclient.api.WebClient; +import io.helidon.webclient.tracing.WebClientTracing; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.Handler; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; +import io.helidon.webserver.http1.Http1Route; +import io.helidon.webserver.http2.Http2Route; +import io.helidon.webserver.tracing.TracingFeature; -import static io.helidon.common.http.Http.Method.GET; +import static io.helidon.http.Http.Method.GET; /** * Tracing example. @@ -46,7 +46,7 @@ private TracingMain() { public static void main(String[] args) { LogConfig.configureRuntime(); - Tracer tracer = TracerBuilder.create("nima") + Tracer tracer = TracerBuilder.create("helidon") .build(); WebServer.builder() diff --git a/examples/webserver/tracing/src/main/java/io/helidon/examples/webserver/tracing/package-info.java b/examples/webserver/tracing/src/main/java/io/helidon/examples/webserver/tracing/package-info.java new file mode 100644 index 00000000000..cac9c63c60f --- /dev/null +++ b/examples/webserver/tracing/src/main/java/io/helidon/examples/webserver/tracing/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Tracing example. + */ +package io.helidon.examples.webserver.tracing; diff --git a/examples/webserver/tracing/src/main/resources/application.yaml b/examples/webserver/tracing/src/main/resources/application.yaml new file mode 100644 index 00000000000..97809cc4f26 --- /dev/null +++ b/examples/webserver/tracing/src/main/resources/application.yaml @@ -0,0 +1,20 @@ +# +# Copyright (c) 2022, 2023 Oracle and/or its affiliates. +# +# 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. +# + +tracing: + service: "helidon-server" + sampler-type: "const" + sampler-param: 1 \ No newline at end of file diff --git a/examples/webserver/tracing/src/main/resources/logging.properties b/examples/webserver/tracing/src/main/resources/logging.properties new file mode 100644 index 00000000000..d09df1098a3 --- /dev/null +++ b/examples/webserver/tracing/src/main/resources/logging.properties @@ -0,0 +1,20 @@ +# +# Copyright (c) 2022, 2023 Oracle and/or its affiliates. +# +# 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. +# +handlers=java.util.logging.ConsoleHandler +java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS.%1$tL %5$s%6$s%n +# Global logging level. Can be overridden by specific loggers +.level=INFO +io.helidon.webserver.level=INFO diff --git a/examples/webserver/tutorial/pom.xml b/examples/webserver/tutorial/pom.xml index b11a40fd7df..529354b8a5d 100644 --- a/examples/webserver/tutorial/pom.xml +++ b/examples/webserver/tutorial/pom.xml @@ -29,7 +29,7 @@ io.helidon.examples.webserver helidon-examples-webserver-tutorial - Helidon WebServer Examples Tutorial + Helidon Examples WebServer Tutorial A tutorial documentation server. @@ -38,17 +38,17 @@ - io.helidon.webserver.examples.tutorial.Main + io.helidon.examples.webserver.tutorial.Main - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test diff --git a/examples/webserver/tutorial/src/main/java/io/helidon/webserver/examples/tutorial/Comment.java b/examples/webserver/tutorial/src/main/java/io/helidon/examples/webserver/tutorial/Comment.java similarity index 95% rename from examples/webserver/tutorial/src/main/java/io/helidon/webserver/examples/tutorial/Comment.java rename to examples/webserver/tutorial/src/main/java/io/helidon/examples/webserver/tutorial/Comment.java index d2714bb9731..fe5b75b9634 100644 --- a/examples/webserver/tutorial/src/main/java/io/helidon/webserver/examples/tutorial/Comment.java +++ b/examples/webserver/tutorial/src/main/java/io/helidon/examples/webserver/tutorial/Comment.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.webserver.examples.tutorial; +package io.helidon.examples.webserver.tutorial; /** * Represents a single comment. diff --git a/examples/webserver/tutorial/src/main/java/io/helidon/webserver/examples/tutorial/CommentService.java b/examples/webserver/tutorial/src/main/java/io/helidon/examples/webserver/tutorial/CommentService.java similarity index 89% rename from examples/webserver/tutorial/src/main/java/io/helidon/webserver/examples/tutorial/CommentService.java rename to examples/webserver/tutorial/src/main/java/io/helidon/examples/webserver/tutorial/CommentService.java index 9f9e33c046f..8785fe2c013 100644 --- a/examples/webserver/tutorial/src/main/java/io/helidon/webserver/examples/tutorial/CommentService.java +++ b/examples/webserver/tutorial/src/main/java/io/helidon/examples/webserver/tutorial/CommentService.java @@ -14,18 +14,18 @@ * limitations under the License. */ -package io.helidon.webserver.examples.tutorial; +package io.helidon.examples.webserver.tutorial; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.concurrent.ConcurrentHashMap; -import io.helidon.common.http.HttpMediaTypes; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.HttpMediaTypes; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; /** * Basic service for comments. diff --git a/examples/webserver/tutorial/src/main/java/io/helidon/webserver/examples/tutorial/CommentSupport.java b/examples/webserver/tutorial/src/main/java/io/helidon/examples/webserver/tutorial/CommentSupport.java similarity index 88% rename from examples/webserver/tutorial/src/main/java/io/helidon/webserver/examples/tutorial/CommentSupport.java rename to examples/webserver/tutorial/src/main/java/io/helidon/examples/webserver/tutorial/CommentSupport.java index 0e513a1e6d0..0806b82a8d7 100644 --- a/examples/webserver/tutorial/src/main/java/io/helidon/webserver/examples/tutorial/CommentSupport.java +++ b/examples/webserver/tutorial/src/main/java/io/helidon/examples/webserver/tutorial/CommentSupport.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.webserver.examples.tutorial; +package io.helidon.examples.webserver.tutorial; import java.util.List; import io.helidon.common.GenericType; -import io.helidon.common.http.Headers; -import io.helidon.common.http.WritableHeaders; -import io.helidon.nima.http.media.MediaSupport; +import io.helidon.http.Headers; +import io.helidon.http.WritableHeaders; +import io.helidon.http.media.MediaSupport; class CommentSupport implements MediaSupport { diff --git a/examples/webserver/tutorial/src/main/java/io/helidon/webserver/examples/tutorial/CommentWriter.java b/examples/webserver/tutorial/src/main/java/io/helidon/examples/webserver/tutorial/CommentWriter.java similarity index 90% rename from examples/webserver/tutorial/src/main/java/io/helidon/webserver/examples/tutorial/CommentWriter.java rename to examples/webserver/tutorial/src/main/java/io/helidon/examples/webserver/tutorial/CommentWriter.java index e5041f230f3..8131d68812f 100644 --- a/examples/webserver/tutorial/src/main/java/io/helidon/webserver/examples/tutorial/CommentWriter.java +++ b/examples/webserver/tutorial/src/main/java/io/helidon/examples/webserver/tutorial/CommentWriter.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.webserver.examples.tutorial; +package io.helidon.examples.webserver.tutorial; import java.io.IOException; import java.io.OutputStream; @@ -24,10 +24,10 @@ import java.util.stream.Collectors; import io.helidon.common.GenericType; -import io.helidon.common.http.Headers; -import io.helidon.common.http.HttpMediaType; -import io.helidon.common.http.WritableHeaders; -import io.helidon.nima.http.media.EntityWriter; +import io.helidon.http.Headers; +import io.helidon.http.HttpMediaType; +import io.helidon.http.WritableHeaders; +import io.helidon.http.media.EntityWriter; class CommentWriter implements EntityWriter> { diff --git a/examples/webserver/tutorial/src/main/java/io/helidon/examples/webserver/tutorial/Main.java b/examples/webserver/tutorial/src/main/java/io/helidon/examples/webserver/tutorial/Main.java new file mode 100644 index 00000000000..dde4a59c821 --- /dev/null +++ b/examples/webserver/tutorial/src/main/java/io/helidon/examples/webserver/tutorial/Main.java @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.examples.webserver.tutorial; + +import io.helidon.http.HttpMediaTypes; +import io.helidon.http.media.MediaContext; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.http.HttpRouting; + +/** + * Application java main class. + * + *

The TUTORIAL application demonstrates various WebServer use cases together and in its complexity. + *

It also serves web server tutorial articles composed of live examples. + */ +public final class Main { + + private Main() { + } + + /** + * Set up the routing. + * + * @param routing routing builder + */ + static void routing(HttpRouting.Builder routing) { + routing.any(new UserFilter()) + .register("/article", new CommentService()) + .post("/mgmt/shutdown", (req, res) -> { + res.headers().contentType(HttpMediaTypes.PLAINTEXT_UTF_8); + res.send("Shutting down TUTORIAL server. Good bye!\n"); + req.context() + .get(WebServer.class) + .orElseThrow() + .stop(); + }); + } + + /** + * Set up the server. + * + * @param server server builder + */ + static void setup(WebServerConfig.Builder server) { + server.routing(Main::routing) + .contentEncoding(encoding -> encoding.addContentEncoding(new UpperXEncodingProvider())) + .mediaContext(MediaContext.builder() + .addMediaSupport(new CommentSupport()) + .build()); + } + + /** + * A java main class. + * + * @param args command line arguments. + */ + public static void main(String[] args) { + // Create a web server instance + int port = 8080; + if (args.length > 0) { + try { + port = Integer.parseInt(args[0]); + } catch (NumberFormatException nfe) { + port = 0; + } + } + + WebServerConfig.Builder builder = WebServer.builder().port(port); + setup(builder); + WebServer server = builder.build().start(); + server.context().register(server); + + System.out.printf(""" + TUTORIAL server is up! http://localhost:%1$d" + Call POST on 'http://localhost:%1$d/mgmt/shutdown' to STOP the server! + """, server.port()); + } +} diff --git a/examples/webserver/tutorial/src/main/java/io/helidon/webserver/examples/tutorial/UpperXEncodingProvider.java b/examples/webserver/tutorial/src/main/java/io/helidon/examples/webserver/tutorial/UpperXEncodingProvider.java similarity index 90% rename from examples/webserver/tutorial/src/main/java/io/helidon/webserver/examples/tutorial/UpperXEncodingProvider.java rename to examples/webserver/tutorial/src/main/java/io/helidon/examples/webserver/tutorial/UpperXEncodingProvider.java index 1038fe6499d..e83de78ad0c 100644 --- a/examples/webserver/tutorial/src/main/java/io/helidon/webserver/examples/tutorial/UpperXEncodingProvider.java +++ b/examples/webserver/tutorial/src/main/java/io/helidon/examples/webserver/tutorial/UpperXEncodingProvider.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package io.helidon.webserver.examples.tutorial; +package io.helidon.examples.webserver.tutorial; import java.io.FilterInputStream; import java.io.IOException; import java.io.InputStream; import java.util.Set; -import io.helidon.nima.http.encoding.ContentDecoder; -import io.helidon.nima.http.encoding.ContentEncoder; -import io.helidon.nima.http.encoding.ContentEncoding; +import io.helidon.http.encoding.ContentDecoder; +import io.helidon.http.encoding.ContentEncoder; +import io.helidon.http.encoding.ContentEncoding; /** * All 'x' must be upper case. diff --git a/examples/webserver/tutorial/src/main/java/io/helidon/webserver/examples/tutorial/User.java b/examples/webserver/tutorial/src/main/java/io/helidon/examples/webserver/tutorial/User.java similarity index 96% rename from examples/webserver/tutorial/src/main/java/io/helidon/webserver/examples/tutorial/User.java rename to examples/webserver/tutorial/src/main/java/io/helidon/examples/webserver/tutorial/User.java index df8a01436da..90960894f4a 100644 --- a/examples/webserver/tutorial/src/main/java/io/helidon/webserver/examples/tutorial/User.java +++ b/examples/webserver/tutorial/src/main/java/io/helidon/examples/webserver/tutorial/User.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.helidon.webserver.examples.tutorial; +package io.helidon.examples.webserver.tutorial; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.webserver.http.HttpRouting; /** * Represents an immutable user. diff --git a/examples/webserver/tutorial/src/main/java/io/helidon/webserver/examples/tutorial/UserFilter.java b/examples/webserver/tutorial/src/main/java/io/helidon/examples/webserver/tutorial/UserFilter.java similarity index 84% rename from examples/webserver/tutorial/src/main/java/io/helidon/webserver/examples/tutorial/UserFilter.java rename to examples/webserver/tutorial/src/main/java/io/helidon/examples/webserver/tutorial/UserFilter.java index 1afadd5654f..33e930fc94e 100644 --- a/examples/webserver/tutorial/src/main/java/io/helidon/webserver/examples/tutorial/UserFilter.java +++ b/examples/webserver/tutorial/src/main/java/io/helidon/examples/webserver/tutorial/UserFilter.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.webserver.examples.tutorial; +package io.helidon.examples.webserver.tutorial; -import io.helidon.nima.webserver.http.Handler; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.Handler; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; /** * If used as a {@link HttpRouting} {@link Handler} then assign valid {@link User} instance on the request diff --git a/examples/webserver/tutorial/src/main/java/io/helidon/examples/webserver/tutorial/package-info.java b/examples/webserver/tutorial/src/main/java/io/helidon/examples/webserver/tutorial/package-info.java new file mode 100644 index 00000000000..46501698c6c --- /dev/null +++ b/examples/webserver/tutorial/src/main/java/io/helidon/examples/webserver/tutorial/package-info.java @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * A tutorial documentation server. It serves various tutorial articles designed based on project examples. + * + *

It is also a complex example demonstrating various web server features. + */ +package io.helidon.examples.webserver.tutorial; diff --git a/examples/webserver/tutorial/src/main/java/io/helidon/webserver/examples/tutorial/Main.java b/examples/webserver/tutorial/src/main/java/io/helidon/webserver/examples/tutorial/Main.java deleted file mode 100644 index f74cfc98f5d..00000000000 --- a/examples/webserver/tutorial/src/main/java/io/helidon/webserver/examples/tutorial/Main.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2017, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.webserver.examples.tutorial; - -import io.helidon.common.http.HttpMediaTypes; -import io.helidon.nima.http.media.MediaContext; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.http.HttpRouting; - -/** - * Application java main class. - * - *

The TUTORIAL application demonstrates various WebServer use cases together and in its complexity. - *

It also serves web server tutorial articles composed of live examples. - */ -public final class Main { - - private Main() { - } - - /** - * Set up the routing. - * - * @param routing routing builder - */ - static void routing(HttpRouting.Builder routing) { - routing.any(new UserFilter()) - .register("/article", new CommentService()) - .post("/mgmt/shutdown", (req, res) -> { - res.headers().contentType(HttpMediaTypes.PLAINTEXT_UTF_8); - res.send("Shutting down TUTORIAL server. Good bye!\n"); - req.context() - .get(WebServer.class) - .orElseThrow() - .stop(); - }); - } - - /** - * Set up the server. - * - * @param server server builder - */ - static void setup(WebServerConfig.Builder server) { - server.routing(Main::routing) - .contentEncoding(encoding -> encoding.addContentEncoding(new UpperXEncodingProvider())) - .mediaContext(MediaContext.builder() - .addMediaSupport(new CommentSupport()) - .build()); - } - - /** - * A java main class. - * - * @param args command line arguments. - */ - public static void main(String[] args) { - // Create a web server instance - int port = 8080; - if (args.length > 0) { - try { - port = Integer.parseInt(args[0]); - } catch (NumberFormatException nfe) { - port = 0; - } - } - - WebServerConfig.Builder builder = WebServer.builder().port(port); - setup(builder); - WebServer server = builder.build().start(); - server.context().register(server); - - System.out.printf(""" - TUTORIAL server is up! http://localhost:%1$d" - Call POST on 'http://localhost:%1$d/mgmt/shutdown' to STOP the server! - """, server.port()); - } -} diff --git a/examples/webserver/tutorial/src/main/java/io/helidon/webserver/examples/tutorial/package-info.java b/examples/webserver/tutorial/src/main/java/io/helidon/webserver/examples/tutorial/package-info.java deleted file mode 100644 index 67bc158b254..00000000000 --- a/examples/webserver/tutorial/src/main/java/io/helidon/webserver/examples/tutorial/package-info.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2017, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * A tutorial documentation server. It serves various tutorial articles designed based on project examples. - * - *

It is also a complex example demonstrating various web server features. - */ -package io.helidon.webserver.examples.tutorial; diff --git a/examples/webserver/tutorial/src/main/resources/logging.properties b/examples/webserver/tutorial/src/main/resources/logging.properties index 4c367d7dc43..8cd9e5d7e0a 100644 --- a/examples/webserver/tutorial/src/main/resources/logging.properties +++ b/examples/webserver/tutorial/src/main/resources/logging.properties @@ -27,7 +27,7 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ .level=INFO # Component specific log levels -#io.helidon.nima.webserver.level=INFO +#io.helidon.webserver.level=INFO #io.helidon.config.level=INFO #io.helidon.security.level=INFO #io.helidon.common.level=INFO diff --git a/examples/webserver/tutorial/src/test/java/io/helidon/webserver/examples/tutorial/CommentServiceTest.java b/examples/webserver/tutorial/src/test/java/io/helidon/examples/webserver/tutorial/CommentServiceTest.java similarity index 90% rename from examples/webserver/tutorial/src/test/java/io/helidon/webserver/examples/tutorial/CommentServiceTest.java rename to examples/webserver/tutorial/src/test/java/io/helidon/examples/webserver/tutorial/CommentServiceTest.java index ae9701ef95a..d483c19319b 100644 --- a/examples/webserver/tutorial/src/test/java/io/helidon/webserver/examples/tutorial/CommentServiceTest.java +++ b/examples/webserver/tutorial/src/test/java/io/helidon/examples/webserver/tutorial/CommentServiceTest.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package io.helidon.webserver.examples.tutorial; +package io.helidon.examples.webserver.tutorial; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.common.media.type.MediaTypes; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.WebServerConfig; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.WebServerConfig; import org.junit.jupiter.api.Test; diff --git a/examples/webserver/tutorial/src/test/java/io/helidon/examples/webserver/tutorial/MainTest.java b/examples/webserver/tutorial/src/test/java/io/helidon/examples/webserver/tutorial/MainTest.java new file mode 100644 index 00000000000..e4cc2708635 --- /dev/null +++ b/examples/webserver/tutorial/src/test/java/io/helidon/examples/webserver/tutorial/MainTest.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.examples.webserver.tutorial; + +import io.helidon.http.Http; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; + +import org.junit.jupiter.api.Test; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +/** + * Tests {@link Main}. + */ +@ServerTest +public class MainTest { + + private final WebServer server; + private final Http1Client client; + + public MainTest(WebServer server, Http1Client client) { + server.context().register(server); + this.server = server; + this.client = client; + } + + @SetUpServer + static void setup(WebServerConfig.Builder server) { + Main.setup(server); + } + + @Test + public void testShutDown() { + try (Http1ClientResponse response = client.post("/mgmt/shutdown").request()) { + assertThat(response.status(), is(Http.Status.OK_200)); + assertThat(server.isRunning(), is(false)); + } + } +} diff --git a/examples/webserver/tutorial/src/test/java/io/helidon/webserver/examples/tutorial/UserFilterTest.java b/examples/webserver/tutorial/src/test/java/io/helidon/examples/webserver/tutorial/UserFilterTest.java similarity index 82% rename from examples/webserver/tutorial/src/test/java/io/helidon/webserver/examples/tutorial/UserFilterTest.java rename to examples/webserver/tutorial/src/test/java/io/helidon/examples/webserver/tutorial/UserFilterTest.java index 4b7dd04c019..6722ec98648 100644 --- a/examples/webserver/tutorial/src/test/java/io/helidon/webserver/examples/tutorial/UserFilterTest.java +++ b/examples/webserver/tutorial/src/test/java/io/helidon/examples/webserver/tutorial/UserFilterTest.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.webserver.examples.tutorial; +package io.helidon.examples.webserver.tutorial; -import io.helidon.common.http.Http; -import io.helidon.nima.testing.junit5.webserver.DirectClient; -import io.helidon.nima.testing.junit5.webserver.RoutingTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.http.Http; +import io.helidon.webserver.testing.junit5.DirectClient; +import io.helidon.webserver.testing.junit5.RoutingTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.http.HttpRouting; import org.junit.jupiter.api.Test; diff --git a/examples/webserver/tutorial/src/test/java/io/helidon/webserver/examples/tutorial/MainTest.java b/examples/webserver/tutorial/src/test/java/io/helidon/webserver/examples/tutorial/MainTest.java deleted file mode 100644 index 5a653de2d8b..00000000000 --- a/examples/webserver/tutorial/src/test/java/io/helidon/webserver/examples/tutorial/MainTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2017, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.webserver.examples.tutorial; - -import io.helidon.common.http.Http; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; - -import org.junit.jupiter.api.Test; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; - -/** - * Tests {@link Main}. - */ -@ServerTest -public class MainTest { - - private final WebServer server; - private final Http1Client client; - - public MainTest(WebServer server, Http1Client client) { - server.context().register(server); - this.server = server; - this.client = client; - } - - @SetUpServer - static void setup(WebServerConfig.Builder server) { - Main.setup(server); - } - - @Test - public void testShutDown() { - try (Http1ClientResponse response = client.post("/mgmt/shutdown").request()) { - assertThat(response.status(), is(Http.Status.OK_200)); - assertThat(server.isRunning(), is(false)); - } - } -} diff --git a/examples/webserver/websocket/pom.xml b/examples/webserver/websocket/pom.xml index 2c5d3b2ffc3..b4e4af19639 100644 --- a/examples/webserver/websocket/pom.xml +++ b/examples/webserver/websocket/pom.xml @@ -29,42 +29,42 @@ io.helidon.examples.webserver helidon-examples-webserver-websocket - Helidon WebServer Examples WebSocket + Helidon Examples WebServer WebSocket Application demonstrates the use of websockets and REST. - io.helidon.webserver.examples.websocket.Main + io.helidon.examples.webserver.websocket.Main - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.nima.webserver - helidon-nima-webserver-static-content + io.helidon.webserver + helidon-webserver-static-content - io.helidon.nima.websocket - helidon-nima-websocket-webserver + io.helidon.webserver + helidon-webserver-websocket - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-websocket + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5-websocket test - io.helidon.nima.websocket - helidon-nima-websocket-client + io.helidon.webclient + helidon-webclient-websocket test diff --git a/examples/webserver/websocket/src/main/java/io/helidon/examples/webserver/websocket/Main.java b/examples/webserver/websocket/src/main/java/io/helidon/examples/webserver/websocket/Main.java new file mode 100644 index 00000000000..6772a26a8fd --- /dev/null +++ b/examples/webserver/websocket/src/main/java/io/helidon/examples/webserver/websocket/Main.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.examples.webserver.websocket; + +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.staticcontent.StaticContentService; +import io.helidon.webserver.websocket.WsRouting; + +/** + * Application demonstrates combination of websocket and REST. + */ +public class Main { + + private Main() { + } + + static void setup(WebServerConfig.Builder server) { + StaticContentService staticContent = StaticContentService.builder("/WEB") + .welcomeFileName("index.html") + .build(); + MessageQueueService messageQueueService = new MessageQueueService(); + server.routing(routing -> routing + .register("/web", staticContent) + .register("/rest", messageQueueService)) + .addRouting(WsRouting.builder() + .endpoint("/websocket/board", new MessageBoardEndpoint()) + .build()); + } + + /** + * A java main class. + * + * @param args command line arguments. + */ + public static void main(String[] args) { + WebServerConfig.Builder builder = WebServer.builder().port(8080); + setup(builder); + WebServer server = builder.build().start(); + System.out.println("WEB server is up! http://localhost:" + server.port() + "/web"); + } +} diff --git a/examples/webserver/websocket/src/main/java/io/helidon/webserver/examples/websocket/MessageBoardEndpoint.java b/examples/webserver/websocket/src/main/java/io/helidon/examples/webserver/websocket/MessageBoardEndpoint.java similarity index 88% rename from examples/webserver/websocket/src/main/java/io/helidon/webserver/examples/websocket/MessageBoardEndpoint.java rename to examples/webserver/websocket/src/main/java/io/helidon/examples/webserver/websocket/MessageBoardEndpoint.java index c9f5096f104..7b458c1f624 100644 --- a/examples/webserver/websocket/src/main/java/io/helidon/webserver/examples/websocket/MessageBoardEndpoint.java +++ b/examples/webserver/websocket/src/main/java/io/helidon/examples/webserver/websocket/MessageBoardEndpoint.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.helidon.webserver.examples.websocket; +package io.helidon.examples.webserver.websocket; -import io.helidon.nima.websocket.WsListener; -import io.helidon.nima.websocket.WsSession; +import io.helidon.websocket.WsListener; +import io.helidon.websocket.WsSession; /** * Class MessageBoardEndpoint. diff --git a/examples/webserver/websocket/src/main/java/io/helidon/webserver/examples/websocket/MessageQueue.java b/examples/webserver/websocket/src/main/java/io/helidon/examples/webserver/websocket/MessageQueue.java similarity index 97% rename from examples/webserver/websocket/src/main/java/io/helidon/webserver/examples/websocket/MessageQueue.java rename to examples/webserver/websocket/src/main/java/io/helidon/examples/webserver/websocket/MessageQueue.java index f5f36ab2cb6..60d5b448de0 100644 --- a/examples/webserver/websocket/src/main/java/io/helidon/webserver/examples/websocket/MessageQueue.java +++ b/examples/webserver/websocket/src/main/java/io/helidon/examples/webserver/websocket/MessageQueue.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.webserver.examples.websocket; +package io.helidon.examples.webserver.websocket; import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; diff --git a/examples/webserver/websocket/src/main/java/io/helidon/webserver/examples/websocket/MessageQueueService.java b/examples/webserver/websocket/src/main/java/io/helidon/examples/webserver/websocket/MessageQueueService.java similarity index 81% rename from examples/webserver/websocket/src/main/java/io/helidon/webserver/examples/websocket/MessageQueueService.java rename to examples/webserver/websocket/src/main/java/io/helidon/examples/webserver/websocket/MessageQueueService.java index 8efd810130a..758d228d606 100644 --- a/examples/webserver/websocket/src/main/java/io/helidon/webserver/examples/websocket/MessageQueueService.java +++ b/examples/webserver/websocket/src/main/java/io/helidon/examples/webserver/websocket/MessageQueueService.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.webserver.examples.websocket; +package io.helidon.examples.webserver.websocket; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; /** * Class MessageQueueResource. diff --git a/examples/webserver/websocket/src/main/java/io/helidon/examples/webserver/websocket/package-info.java b/examples/webserver/websocket/src/main/java/io/helidon/examples/webserver/websocket/package-info.java new file mode 100644 index 00000000000..e8e828b8379 --- /dev/null +++ b/examples/webserver/websocket/src/main/java/io/helidon/examples/webserver/websocket/package-info.java @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Application demonstrates combination of the websocket and REST. + * + *

+ * Start with {@link io.helidon.examples.webserver.websocket.Main} class. + * + * @see io.helidon.examples.webserver.websocket.Main + */ +package io.helidon.examples.webserver.websocket; diff --git a/examples/webserver/websocket/src/main/java/io/helidon/webserver/examples/websocket/Main.java b/examples/webserver/websocket/src/main/java/io/helidon/webserver/examples/websocket/Main.java deleted file mode 100644 index d6e24b9e9a9..00000000000 --- a/examples/webserver/websocket/src/main/java/io/helidon/webserver/examples/websocket/Main.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.webserver.examples.websocket; - -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.staticcontent.StaticContentService; -import io.helidon.nima.websocket.webserver.WsRouting; - -/** - * Application demonstrates combination of websocket and REST. - */ -public class Main { - - private Main() { - } - - static void setup(WebServerConfig.Builder server) { - StaticContentService staticContent = StaticContentService.builder("/WEB") - .welcomeFileName("index.html") - .build(); - MessageQueueService messageQueueService = new MessageQueueService(); - server.routing(routing -> routing - .register("/web", staticContent) - .register("/rest", messageQueueService)) - .addRouting(WsRouting.builder() - .endpoint("/websocket/board", new MessageBoardEndpoint()) - .build()); - } - - /** - * A java main class. - * - * @param args command line arguments. - */ - public static void main(String[] args) { - WebServerConfig.Builder builder = WebServer.builder().port(8080); - setup(builder); - WebServer server = builder.build().start(); - System.out.println("WEB server is up! http://localhost:" + server.port() + "/web"); - } -} diff --git a/examples/webserver/websocket/src/main/java/io/helidon/webserver/examples/websocket/package-info.java b/examples/webserver/websocket/src/main/java/io/helidon/webserver/examples/websocket/package-info.java deleted file mode 100644 index b7bc6bf4e51..00000000000 --- a/examples/webserver/websocket/src/main/java/io/helidon/webserver/examples/websocket/package-info.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Application demonstrates combination of the websocket and REST. - * - *

- * Start with {@link io.helidon.webserver.examples.websocket.Main} class. - * - * @see io.helidon.webserver.examples.websocket.Main - */ -package io.helidon.webserver.examples.websocket; diff --git a/examples/webserver/websocket/src/test/java/io/helidon/webserver/examples/websocket/MessageBoardTest.java b/examples/webserver/websocket/src/test/java/io/helidon/examples/webserver/websocket/MessageBoardTest.java similarity index 83% rename from examples/webserver/websocket/src/test/java/io/helidon/webserver/examples/websocket/MessageBoardTest.java rename to examples/webserver/websocket/src/test/java/io/helidon/examples/webserver/websocket/MessageBoardTest.java index d20ac0d4013..28531a01b9f 100644 --- a/examples/webserver/websocket/src/test/java/io/helidon/webserver/examples/websocket/MessageBoardTest.java +++ b/examples/webserver/websocket/src/test/java/io/helidon/examples/webserver/websocket/MessageBoardTest.java @@ -14,22 +14,22 @@ * limitations under the License. */ -package io.helidon.webserver.examples.websocket; +package io.helidon.examples.webserver.websocket; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.logging.Logger; -import io.helidon.common.http.Http; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.websocket.WsCloseCodes; -import io.helidon.nima.websocket.WsListener; -import io.helidon.nima.websocket.WsSession; -import io.helidon.nima.websocket.client.WsClient; +import io.helidon.http.Http; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.WebServerConfig; +import io.helidon.websocket.WsCloseCodes; +import io.helidon.websocket.WsListener; +import io.helidon.websocket.WsSession; +import io.helidon.webclient.websocket.WsClient; import org.junit.jupiter.api.Test; diff --git a/nima/fault-tolerance/README.md b/fault-tolerance/README.md similarity index 100% rename from nima/fault-tolerance/README.md rename to fault-tolerance/README.md diff --git a/fault-tolerance/fault-tolerance/etc/spotbugs/exclude.xml b/fault-tolerance/fault-tolerance/etc/spotbugs/exclude.xml new file mode 100644 index 00000000000..3204ceb4227 --- /dev/null +++ b/fault-tolerance/fault-tolerance/etc/spotbugs/exclude.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + diff --git a/fault-tolerance/fault-tolerance/pom.xml b/fault-tolerance/fault-tolerance/pom.xml new file mode 100644 index 00000000000..b74b4317925 --- /dev/null +++ b/fault-tolerance/fault-tolerance/pom.xml @@ -0,0 +1,187 @@ + + + + + 4.0.0 + + io.helidon.fault-tolerance + helidon-fault-tolerance-project + 4.0.0-SNAPSHOT + + + helidon-fault-tolerance + Helidon Fault Tolerance + + + etc/spotbugs/exclude.xml + + + + + io.helidon.config + helidon-config + + + io.helidon.common + helidon-common-configurable + + + + io.helidon.inject + helidon-inject-api + + + + io.helidon.inject + helidon-inject-runtime + true + + + + io.helidon.builder + helidon-builder-api + + + + io.helidon.common.features + helidon-common-features-api + true + + + + io.helidon.config + helidon-config-metadata + true + + + + io.helidon.inject.configdriven + helidon-inject-configdriven-api + true + + + + io.helidon.inject.configdriven + helidon-inject-configdriven-runtime + true + + + org.hamcrest + hamcrest-all + test + + + org.junit.jupiter + junit-jupiter-api + test + + + io.helidon.common.testing + helidon-common-testing-junit5 + test + + + io.helidon.logging + helidon-logging-jul + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + io.helidon.config + helidon-config-metadata-processor + ${helidon.version} + + + io.helidon.inject.configdriven + helidon-inject-configdriven-processor + ${helidon.version} + + + io.helidon.builder + helidon-builder-processor + ${helidon.version} + + + io.helidon.common.processor + helidon-common-processor-helidon-copyright + ${helidon.version} + + + + + + io.helidon.builder + helidon-builder-processor + ${helidon.version} + + + io.helidon.config + helidon-config-metadata-processor + ${helidon.version} + + + io.helidon.inject.configdriven + helidon-inject-configdriven-processor + ${helidon.version} + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + io.helidon.common.processor + helidon-common-processor-helidon-copyright + ${helidon.version} + + + + + + diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/Async.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/Async.java similarity index 98% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/Async.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/Async.java index 7b57be7a31a..b3918dd9ee9 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/Async.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/Async.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.util.concurrent.CompletableFuture; import java.util.function.Consumer; diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/AsyncConfigBlueprint.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/AsyncConfigBlueprint.java similarity index 95% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/AsyncConfigBlueprint.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/AsyncConfigBlueprint.java index 03c2076ac48..cca97e0b70c 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/AsyncConfigBlueprint.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/AsyncConfigBlueprint.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.util.Optional; import java.util.concurrent.CompletableFuture; @@ -25,7 +25,7 @@ import io.helidon.config.metadata.ConfiguredOption; /** - * {@link io.helidon.nima.faulttolerance.Async} configuration bean. + * {@link Async} configuration bean. */ @Prototype.Blueprint(decorator = AsyncConfigBlueprint.BuilderDecorator.class) @Configured diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/AsyncImpl.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/AsyncImpl.java similarity index 95% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/AsyncImpl.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/AsyncImpl.java index f20148296f9..22edfa41581 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/AsyncImpl.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/AsyncImpl.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.util.Optional; import java.util.concurrent.CompletableFuture; @@ -30,8 +30,6 @@ import jakarta.inject.Inject; -import static io.helidon.nima.faulttolerance.SupplierHelper.unwrapThrowable; - /** * Implementation of {@code Async}. Default executor accessed from {@link FaultTolerance#executor()}. */ @@ -90,7 +88,7 @@ public boolean cancel(boolean mayInterruptIfRunning) { T t = supplier.get(); result.complete(t); } catch (Throwable t) { - Throwable throwable = unwrapThrowable(t); + Throwable throwable = SupplierHelper.unwrapThrowable(t); result.completeExceptionally(throwable); } }); diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/AsyncInterceptor.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/AsyncInterceptor.java similarity index 96% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/AsyncInterceptor.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/AsyncInterceptor.java index 5b222a15546..6baf369c83c 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/AsyncInterceptor.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/AsyncInterceptor.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; @@ -76,7 +76,7 @@ private Async fromAnnotation(Annotation annotation) { .flatMap(it -> lookupNamed(ExecutorService.class, it)) .orElseGet(() -> FaultTolerance.executor().get()); - return io.helidon.nima.faulttolerance.Async.create(AsyncConfig.builder() + return Async.create(AsyncConfig.builder() .name(name) .executor(executorService) .buildPrototype()); diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/AtomicCycle.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/AtomicCycle.java similarity index 96% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/AtomicCycle.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/AtomicCycle.java index a916a088e4d..3a0aa8f565c 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/AtomicCycle.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/AtomicCycle.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.util.concurrent.atomic.AtomicInteger; diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/Bulkhead.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/Bulkhead.java similarity index 99% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/Bulkhead.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/Bulkhead.java index 0618ffde86f..d0531dd8b13 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/Bulkhead.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/Bulkhead.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.util.function.Consumer; import java.util.function.Supplier; diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/BulkheadConfigBlueprint.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/BulkheadConfigBlueprint.java similarity index 95% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/BulkheadConfigBlueprint.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/BulkheadConfigBlueprint.java index a5885cf13b4..1b5f97a1496 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/BulkheadConfigBlueprint.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/BulkheadConfigBlueprint.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.util.List; import java.util.Optional; @@ -25,7 +25,7 @@ import io.helidon.inject.configdriven.api.ConfigBean; /** - * {@link io.helidon.nima.faulttolerance.Bulkhead} configuration bean. + * {@link Bulkhead} configuration bean. */ @ConfigBean(repeatable = true) @Configured(root = true, prefix = "fault-tolerance.bulkheads") diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/BulkheadException.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/BulkheadException.java similarity index 95% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/BulkheadException.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/BulkheadException.java index 65f9d129feb..4da9d3d8345 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/BulkheadException.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/BulkheadException.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; /** * Failure because of {@link Bulkhead} issues, most likely that the bulkhead does diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/BulkheadImpl.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/BulkheadImpl.java similarity index 97% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/BulkheadImpl.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/BulkheadImpl.java index 3fe02ae8429..394734f0d02 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/BulkheadImpl.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/BulkheadImpl.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.lang.System.Logger.Level; import java.util.IdentityHashMap; @@ -34,9 +34,6 @@ import jakarta.inject.Inject; -import static io.helidon.nima.faulttolerance.SupplierHelper.toRuntimeException; -import static io.helidon.nima.faulttolerance.SupplierHelper.unwrapThrowable; - class BulkheadImpl implements Bulkhead { private static final System.Logger LOGGER = System.getLogger(BulkheadImpl.class.getName()); @@ -181,10 +178,10 @@ private T execute(Supplier supplier) { } return result; } catch (Throwable t) { - Throwable throwable = unwrapThrowable(t); + Throwable throwable = SupplierHelper.unwrapThrowable(t); LOGGER.log(Level.DEBUG, name + " finished execution: " + supplier + " (failure)", throwable); - throw toRuntimeException(throwable); + throw SupplierHelper.toRuntimeException(throwable); } finally { concurrentExecutions.decrementAndGet(); inProgressLock.lock(); diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/BulkheadInterceptor.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/BulkheadInterceptor.java similarity index 98% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/BulkheadInterceptor.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/BulkheadInterceptor.java index d92466517f6..45b166650e8 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/BulkheadInterceptor.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/BulkheadInterceptor.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import io.helidon.common.Weight; import io.helidon.common.types.Annotation; diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/CircuitBreaker.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/CircuitBreaker.java similarity index 99% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/CircuitBreaker.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/CircuitBreaker.java index 664a9e3e944..c1b7e62c64b 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/CircuitBreaker.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/CircuitBreaker.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.util.function.Consumer; diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/CircuitBreakerConfigBlueprint.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/CircuitBreakerConfigBlueprint.java similarity index 98% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/CircuitBreakerConfigBlueprint.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/CircuitBreakerConfigBlueprint.java index b4390b9b6a0..a9e77c6fbe2 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/CircuitBreakerConfigBlueprint.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/CircuitBreakerConfigBlueprint.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.time.Duration; import java.util.Optional; diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/CircuitBreakerImpl.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/CircuitBreakerImpl.java similarity index 92% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/CircuitBreakerImpl.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/CircuitBreakerImpl.java index a23bedd535d..6f1b1a5d714 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/CircuitBreakerImpl.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/CircuitBreakerImpl.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; @@ -27,10 +27,6 @@ import jakarta.inject.Inject; -import static io.helidon.nima.faulttolerance.FaultTolerance.toDelayedCallable; -import static io.helidon.nima.faulttolerance.SupplierHelper.toRuntimeException; -import static io.helidon.nima.faulttolerance.SupplierHelper.unwrapThrowable; - @ConfigDriven(CircuitBreakerConfigBlueprint.class) class CircuitBreakerImpl implements CircuitBreaker { /* @@ -129,13 +125,13 @@ private U executeTask(Supplier supplier) { results.update(ResultWindow.Result.SUCCESS); return result; } catch (Throwable t) { - Throwable throwable = unwrapThrowable(t); + Throwable throwable = SupplierHelper.unwrapThrowable(t); if (errorChecker.shouldSkip(throwable)) { results.update(ResultWindow.Result.SUCCESS); } else { results.update(ResultWindow.Result.FAILURE); } - throw toRuntimeException(throwable); + throw SupplierHelper.toRuntimeException(throwable); } finally { if (results.shouldOpen() && state.compareAndSet(State.CLOSED, State.OPEN)) { results.reset(); @@ -159,7 +155,7 @@ private U halfOpenTask(Supplier supplier) { } return result; } catch (Throwable t) { - Throwable throwable = unwrapThrowable(t); + Throwable throwable = SupplierHelper.unwrapThrowable(t); if (errorChecker.shouldSkip(throwable)) { // success int successes = successCounter.incrementAndGet(); @@ -175,7 +171,7 @@ private U halfOpenTask(Supplier supplier) { // if we successfully switch to open, we need to schedule switch to half-open scheduleHalf(); } - throw toRuntimeException(throwable); + throw SupplierHelper.toRuntimeException(throwable); } finally { halfOpenInProgress.set(false); } @@ -186,7 +182,7 @@ private U halfOpenTask(Supplier supplier) { private void scheduleHalf() { schedule.set(executor.submit( - toDelayedCallable(() -> { + FaultTolerance.toDelayedCallable(() -> { state.compareAndSet(State.OPEN, State.HALF_OPEN); schedule.set(null); return true; diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/CircuitBreakerInterceptor.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/CircuitBreakerInterceptor.java similarity index 97% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/CircuitBreakerInterceptor.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/CircuitBreakerInterceptor.java index e9ae3332df2..f165386cfbf 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/CircuitBreakerInterceptor.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/CircuitBreakerInterceptor.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import io.helidon.common.Weight; import io.helidon.common.types.TypedElementInfo; diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/CircuitBreakerMethod.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/CircuitBreakerMethod.java similarity index 85% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/CircuitBreakerMethod.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/CircuitBreakerMethod.java index 6cefb17caa3..23a17aa45f5 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/CircuitBreakerMethod.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/CircuitBreakerMethod.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import io.helidon.inject.api.Contract; @@ -27,7 +27,7 @@ public interface CircuitBreakerMethod extends FtMethod { /** * Provide a circuit breaker instance that should be used with this method. - * If the {@link io.helidon.nima.faulttolerance.FaultTolerance.CircuitBreaker} annotation contains a name, we will attempt to obtain the named instance from + * If the {@link io.helidon.faulttolerance.FaultTolerance.CircuitBreaker} annotation contains a name, we will attempt to obtain the named instance from * registry. If such a named instance does not exist a new circuit breaker will be created from the annotation. * * @return circuit breaker instance diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/CircuitBreakerOpenException.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/CircuitBreakerOpenException.java similarity index 95% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/CircuitBreakerOpenException.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/CircuitBreakerOpenException.java index 73440db861a..7641dc2a91e 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/CircuitBreakerOpenException.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/CircuitBreakerOpenException.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; /** * Failure because {@link CircuitBreaker} is open and does not accept requests. diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/ErrorChecker.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/ErrorChecker.java similarity index 98% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/ErrorChecker.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/ErrorChecker.java index 816feacb84f..d014653cc7d 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/ErrorChecker.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/ErrorChecker.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.util.Set; diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/Fallback.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/Fallback.java similarity index 98% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/Fallback.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/Fallback.java index c0f4a2fddfc..61e609a48fc 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/Fallback.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/Fallback.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.util.function.Consumer; import java.util.function.Function; diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/FallbackConfigBlueprint.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/FallbackConfigBlueprint.java similarity index 93% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/FallbackConfigBlueprint.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/FallbackConfigBlueprint.java index e202e99c36c..5aa3377f016 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/FallbackConfigBlueprint.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/FallbackConfigBlueprint.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.util.Set; import java.util.function.Function; @@ -22,7 +22,7 @@ import io.helidon.builder.api.Prototype; /** - * {@link io.helidon.nima.faulttolerance.Fallback} configuration. + * {@link Fallback} configuration. */ @Prototype.Blueprint interface FallbackConfigBlueprint { diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/FallbackImpl.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/FallbackImpl.java similarity index 78% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/FallbackImpl.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/FallbackImpl.java index a13ec6f381e..25d4db4585e 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/FallbackImpl.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/FallbackImpl.java @@ -14,14 +14,11 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.util.function.Function; import java.util.function.Supplier; -import static io.helidon.nima.faulttolerance.SupplierHelper.toRuntimeException; -import static io.helidon.nima.faulttolerance.SupplierHelper.unwrapThrowable; - class FallbackImpl implements Fallback { private final Function fallback; private final ErrorChecker errorChecker; @@ -36,18 +33,18 @@ public T invoke(Supplier supplier) { try { return supplier.get(); } catch (Throwable t) { - Throwable throwable = unwrapThrowable(t); + Throwable throwable = SupplierHelper.unwrapThrowable(t); if (errorChecker.shouldSkip(throwable)) { - throw toRuntimeException(throwable); + throw SupplierHelper.toRuntimeException(throwable); } try { return fallback.apply(throwable); } catch (Throwable t2) { - Throwable throwable2 = unwrapThrowable(t2); + Throwable throwable2 = SupplierHelper.unwrapThrowable(t2); if (throwable2 != throwable) { // cannot self suppress throwable2.addSuppressed(throwable); } - throw toRuntimeException(throwable2); + throw SupplierHelper.toRuntimeException(throwable2); } } } diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/FallbackInterceptor.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/FallbackInterceptor.java similarity index 98% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/FallbackInterceptor.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/FallbackInterceptor.java index 363b736677e..7115b6a15b6 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/FallbackInterceptor.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/FallbackInterceptor.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.util.List; diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/FallbackMethod.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/FallbackMethod.java similarity index 94% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/FallbackMethod.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/FallbackMethod.java index 55803babb9a..10b09510ea3 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/FallbackMethod.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/FallbackMethod.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import io.helidon.inject.api.Contract; @@ -29,7 +29,7 @@ @Deprecated public interface FallbackMethod extends FtMethod { /** - * Fallback method generated based on the {@link io.helidon.nima.faulttolerance.FaultTolerance.Fallback} annotation. + * Fallback method generated based on the {@link io.helidon.faulttolerance.FaultTolerance.Fallback} annotation. * This generated type will check if the throwable should be handled or not, and either throws it, or executes the fallback. * * @param service service instance diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/FaultTolerance.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/FaultTolerance.java similarity index 92% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/FaultTolerance.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/FaultTolerance.java index a86372fc156..8e9fd0080ec 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/FaultTolerance.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/FaultTolerance.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; @@ -41,13 +41,13 @@ *

* Fault tolerance provides the following features: *

    - *
  • {@link io.helidon.nima.faulttolerance.Bulkhead} - limit number of parallel requests to a resource
  • - *
  • {@link io.helidon.nima.faulttolerance.CircuitBreaker} - stop trying to request a failing resource until it becomes + *
  • {@link io.helidon.faulttolerance.Bulkhead} - limit number of parallel requests to a resource
  • + *
  • {@link io.helidon.faulttolerance.CircuitBreaker} - stop trying to request a failing resource until it becomes * available
  • - *
  • {@link io.helidon.nima.faulttolerance.Fallback} - fall back to another supplier of result in case the usual one + *
  • {@link io.helidon.faulttolerance.Fallback} - fall back to another supplier of result in case the usual one * fails
  • - *
  • {@link io.helidon.nima.faulttolerance.Retry} - try to call a supplier again if invocation fails
  • - *
  • {@link io.helidon.nima.faulttolerance.Timeout} - time out a request if it takes too long
  • + *
  • {@link io.helidon.faulttolerance.Retry} - try to call a supplier again if invocation fails
  • + *
  • {@link io.helidon.faulttolerance.Timeout} - time out a request if it takes too long
  • *
* * @see #config(io.helidon.config.Config) @@ -168,7 +168,7 @@ abstract static class BaseBuilder> { * @param bulkhead bulkhead handler * @return updated builder instance */ - public B addBulkhead(io.helidon.nima.faulttolerance.Bulkhead bulkhead) { + public B addBulkhead(io.helidon.faulttolerance.Bulkhead bulkhead) { add(bulkhead); return me(); } @@ -179,7 +179,7 @@ public B addBulkhead(io.helidon.nima.faulttolerance.Bulkhead bulkhead) { * @param breaker circuit breaker handler * @return updated builder instance */ - public B addBreaker(io.helidon.nima.faulttolerance.CircuitBreaker breaker) { + public B addBreaker(io.helidon.faulttolerance.CircuitBreaker breaker) { add(breaker); return me(); } @@ -190,7 +190,7 @@ public B addBreaker(io.helidon.nima.faulttolerance.CircuitBreaker breaker) { * @param timeout timeout handler * @return updated builder instance */ - public B addTimeout(io.helidon.nima.faulttolerance.Timeout timeout) { + public B addTimeout(io.helidon.faulttolerance.Timeout timeout) { add(timeout); return me(); } @@ -201,7 +201,7 @@ public B addTimeout(io.helidon.nima.faulttolerance.Timeout timeout) { * @param retry retry handler * @return updated builder instance */ - public B addRetry(io.helidon.nima.faulttolerance.Retry retry) { + public B addRetry(io.helidon.faulttolerance.Retry retry) { add(retry); return me(); } @@ -222,9 +222,9 @@ private B me() { /** * A builder used for fault tolerance handlers that require a specific type to be used, such as - * {@link io.helidon.nima.faulttolerance.Fallback}. + * {@link io.helidon.faulttolerance.Fallback}. * An instance is returned from - * {@link io.helidon.nima.faulttolerance.FaultTolerance.Builder#addFallback(io.helidon.nima.faulttolerance.Fallback)}. + * {@link FaultTolerance.Builder#addFallback(io.helidon.faulttolerance.Fallback)}. * * @param type of result */ @@ -252,7 +252,7 @@ public TypedBuilder add(FtHandler ft) { * @param fallback fallback instance * @return updated builder instance */ - public TypedBuilder addFallback(io.helidon.nima.faulttolerance.Fallback fallback) { + public TypedBuilder addFallback(io.helidon.faulttolerance.Fallback fallback) { fts.add(fallback); return this; } @@ -335,7 +335,7 @@ public FtHandler build() { * @param type of future * @return a new typed builder instance */ - public TypedBuilder addFallback(io.helidon.nima.faulttolerance.Fallback fallback) { + public TypedBuilder addFallback(io.helidon.faulttolerance.Fallback fallback) { return new TypedBuilder() .builder(this) .addFallback(fallback); @@ -382,7 +382,7 @@ public T invoke(Supplier supplier) { @InterceptedTrigger public @interface Retry { /** - * If named, an attempt will be made to find a named {@link io.helidon.nima.faulttolerance.Retry} instance in service + * If named, an attempt will be made to find a named {@link io.helidon.faulttolerance.Retry} instance in service * registry. If not found, a new retry will be created based on values on this annotation. * * @return name of this retry @@ -418,14 +418,14 @@ public T invoke(Supplier supplier) { * Delay retry policy factor. If unspecified (value of {@code -1}), Jitter retry policy would be used, unless * jitter time is also unspecified. *

- * Default when {@link io.helidon.nima.faulttolerance.Retry.DelayingRetryPolicy} is used is {@code 2}. + * Default when {@link io.helidon.faulttolerance.Retry.DelayingRetryPolicy} is used is {@code 2}. * * @return delay factor for delaying retry policy */ double delayFactor() default -1; /** - * Jitter for {@link io.helidon.nima.faulttolerance.Retry.JitterRetryPolicy}. If unspecified (value of {@code -1}), + * Jitter for {@link io.helidon.faulttolerance.Retry.JitterRetryPolicy}. If unspecified (value of {@code -1}), * delaying retry policy is used. If both this value, and {@link #delayFactor()} are specified, delaying retry policy * would be used. * @@ -504,7 +504,7 @@ public T invoke(Supplier supplier) { @Target(ElementType.METHOD) public @interface Async { /** - * If named, an attempt will be made to find a named {@link io.helidon.nima.faulttolerance.Async} instance in service + * If named, an attempt will be made to find a named {@link io.helidon.faulttolerance.Async} instance in service * registry. If not found, a new async will be created based on values on this annotation. * * @return name of this async @@ -528,7 +528,7 @@ public T invoke(Supplier supplier) { @InterceptedTrigger public @interface Timeout { /** - * If named, an attempt will be made to find a named {@link io.helidon.nima.faulttolerance.Timeout} instance in service + * If named, an attempt will be made to find a named {@link io.helidon.faulttolerance.Timeout} instance in service * registry. If not found, a new timeout will be created based on values on this annotation. * * @return name of this timeout @@ -585,7 +585,7 @@ public T invoke(Supplier supplier) { /** * Maximal number of enqueued requests waiting for processing. * When the limit is reached, additional attempts to invoke - * a request will receive a {@link io.helidon.nima.faulttolerance.BulkheadException}. + * a request will receive a {@link BulkheadException}. * * @return length of the queue */ @@ -607,7 +607,7 @@ public T invoke(Supplier supplier) { @InterceptedTrigger public @interface CircuitBreaker { /** - * If named, an attempt will be made to find a named {@link io.helidon.nima.faulttolerance.CircuitBreaker} instance + * If named, an attempt will be made to find a named {@link io.helidon.faulttolerance.CircuitBreaker} instance * in service registry. If not found, a new circuit breaker will be created based on values on this annotation. * * @return name of this retry diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/FtHandler.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/FtHandler.java similarity index 97% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/FtHandler.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/FtHandler.java index c379d050ed2..af65b4cc3c0 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/FtHandler.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/FtHandler.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.util.function.Supplier; diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/FtHandlerTyped.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/FtHandlerTyped.java similarity index 97% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/FtHandlerTyped.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/FtHandlerTyped.java index 9c7360c6da1..9154512089a 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/FtHandlerTyped.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/FtHandlerTyped.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.util.function.Supplier; diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/FtMethod.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/FtMethod.java similarity index 96% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/FtMethod.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/FtMethod.java index eb98defc875..6dc019febe4 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/FtMethod.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/FtMethod.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.util.List; diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/InterceptorBase.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/InterceptorBase.java similarity index 99% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/InterceptorBase.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/InterceptorBase.java index 2b705197811..3792860d492 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/InterceptorBase.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/InterceptorBase.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.lang.annotation.Annotation; import java.util.List; diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/ResultWindow.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/ResultWindow.java similarity index 98% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/ResultWindow.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/ResultWindow.java index bcc745109ca..daa0dfa44f7 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/ResultWindow.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/ResultWindow.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.util.concurrent.atomic.AtomicInteger; diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/Retry.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/Retry.java similarity index 99% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/Retry.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/Retry.java index 1903d348533..3bd5111497c 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/Retry.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/Retry.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.time.Duration; import java.util.Optional; diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/RetryConfigBlueprint.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/RetryConfigBlueprint.java similarity index 99% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/RetryConfigBlueprint.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/RetryConfigBlueprint.java index 2b31f4bbae0..320b73de5b2 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/RetryConfigBlueprint.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/RetryConfigBlueprint.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.time.Duration; import java.util.Optional; diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/RetryImpl.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/RetryImpl.java similarity index 97% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/RetryImpl.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/RetryImpl.java index 006afad91c5..e1145084243 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/RetryImpl.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/RetryImpl.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.time.Duration; import java.util.LinkedList; @@ -27,8 +27,6 @@ import jakarta.inject.Inject; -import static io.helidon.nima.faulttolerance.SupplierHelper.unwrapThrowable; - class RetryImpl implements Retry { private final ErrorChecker errorChecker; private final long maxTimeNanos; @@ -63,7 +61,7 @@ public T invoke(Supplier supplier) { try { return supplier.get(); } catch (Throwable t) { - Throwable throwable = unwrapThrowable(t); + Throwable throwable = SupplierHelper.unwrapThrowable(t); context.thrown.add(throwable); if (errorChecker.shouldSkip(throwable) || throwable instanceof InterruptedException) { // no retry on interrupt diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/RetryInterceptor.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/RetryInterceptor.java similarity index 97% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/RetryInterceptor.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/RetryInterceptor.java index f64ccfb010f..da9843ff16a 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/RetryInterceptor.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/RetryInterceptor.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import io.helidon.common.Weight; import io.helidon.common.types.TypedElementInfo; diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/RetryMethod.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/RetryMethod.java similarity index 96% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/RetryMethod.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/RetryMethod.java index 02c51446055..eccf34fee05 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/RetryMethod.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/RetryMethod.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import io.helidon.inject.api.Contract; diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/RetryTimeoutException.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/RetryTimeoutException.java similarity index 97% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/RetryTimeoutException.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/RetryTimeoutException.java index 5a6515f6b74..aaba15efff0 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/RetryTimeoutException.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/RetryTimeoutException.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; /** * Retry timeout exception. diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/SupplierException.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/SupplierException.java similarity index 96% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/SupplierException.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/SupplierException.java index 8e8c90db4fd..3e08f3340b8 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/SupplierException.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/SupplierException.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; /** * An exception class that is a {@code RuntimeException} and is used to wrap diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/SupplierHelper.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/SupplierHelper.java similarity index 98% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/SupplierHelper.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/SupplierHelper.java index 1cfb4ceb16b..191bfdb8672 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/SupplierHelper.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/SupplierHelper.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.util.concurrent.CompletionStage; import java.util.concurrent.ExecutionException; diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/Timeout.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/Timeout.java similarity index 98% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/Timeout.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/Timeout.java index 37090776c23..f71cf303e1c 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/Timeout.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/Timeout.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.time.Duration; import java.util.function.Consumer; diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/TimeoutConfigBlueprint.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/TimeoutConfigBlueprint.java similarity index 95% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/TimeoutConfigBlueprint.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/TimeoutConfigBlueprint.java index 1096f7a1329..ec6554c08e1 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/TimeoutConfigBlueprint.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/TimeoutConfigBlueprint.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.time.Duration; import java.util.Optional; @@ -25,7 +25,7 @@ import io.helidon.config.metadata.ConfiguredOption; /** - * {@link io.helidon.nima.faulttolerance.Timeout} configuration bean. + * {@link Timeout} configuration bean. */ @Prototype.Blueprint(decorator = TimeoutConfigBlueprint.BuilderDecorator.class) @Configured(root = true, prefix = "fault-tolerance.timeouts") diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/TimeoutException.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/TimeoutException.java similarity index 96% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/TimeoutException.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/TimeoutException.java index b515d063cf7..0aba37d36af 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/TimeoutException.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/TimeoutException.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; /** * General timeout runtime exception. diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/TimeoutImpl.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/TimeoutImpl.java similarity index 91% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/TimeoutImpl.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/TimeoutImpl.java index 12ceaba2015..fe784a2cea2 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/TimeoutImpl.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/TimeoutImpl.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutorService; @@ -25,10 +25,6 @@ import jakarta.inject.Inject; -import static io.helidon.nima.faulttolerance.FaultTolerance.toDelayedRunnable; -import static io.helidon.nima.faulttolerance.SupplierHelper.toRuntimeException; -import static io.helidon.nima.faulttolerance.SupplierHelper.unwrapThrowable; - class TimeoutImpl implements Timeout { private static final System.Logger LOGGER = System.getLogger(TimeoutImpl.class.getName()); @@ -73,7 +69,7 @@ public T invoke(Supplier supplier) { AtomicBoolean callReturned = new AtomicBoolean(false); AtomicBoolean interrupted = new AtomicBoolean(false); - executor.submit(toDelayedRunnable(() -> { + executor.submit(FaultTolerance.toDelayedRunnable(() -> { interruptLock.lock(); try { if (callReturned.compareAndSet(false, true)) { @@ -110,7 +106,7 @@ public T invoke(Supplier supplier) { } private static RuntimeException mapThrowable(Throwable t, AtomicBoolean interrupted) { - Throwable throwable = unwrapThrowable(t); + Throwable throwable = SupplierHelper.unwrapThrowable(t); if (throwable instanceof InterruptedException) { return new TimeoutException("Call interrupted", throwable); @@ -119,6 +115,6 @@ private static RuntimeException mapThrowable(Throwable t, AtomicBoolean interrup } else if (interrupted != null && interrupted.get()) { return new TimeoutException("Supplier execution interrupted", t); } - return toRuntimeException(throwable); + return SupplierHelper.toRuntimeException(throwable); } } diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/TimeoutInterceptor.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/TimeoutInterceptor.java similarity index 98% rename from nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/TimeoutInterceptor.java rename to fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/TimeoutInterceptor.java index 34853b1c1a0..749d649d9bd 100644 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/TimeoutInterceptor.java +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/TimeoutInterceptor.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.time.Duration; import java.time.temporal.ChronoUnit; diff --git a/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/package-info.java b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/package-info.java new file mode 100644 index 00000000000..d64fae6b3e7 --- /dev/null +++ b/fault-tolerance/fault-tolerance/src/main/java/io/helidon/faulttolerance/package-info.java @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon Fault Tolerance Support. + *

+ * All handlers are fully blocking and should be executed on virtual threads. + */ +package io.helidon.faulttolerance; diff --git a/fault-tolerance/fault-tolerance/src/main/java/module-info.java b/fault-tolerance/fault-tolerance/src/main/java/module-info.java new file mode 100644 index 00000000000..fbb0855ea36 --- /dev/null +++ b/fault-tolerance/fault-tolerance/src/main/java/module-info.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.common.features.api.Feature; +import io.helidon.common.features.api.HelidonFlavor; + +/** + * Helidon Fault Tolerance Support. + */ +@Feature(value = "Fault Tolerance", + description = "Fault Tolerance support", + in = HelidonFlavor.SE, + path = "FT" +) +module io.helidon.faulttolerance { + requires io.helidon.common; + requires io.helidon.common.types; + requires io.helidon.common.configurable; + requires io.helidon.config; + requires io.helidon.inject.api; + requires io.helidon.builder.api; + + requires static jakarta.inject; + requires static io.helidon.common.features.api; + requires static io.helidon.config.metadata; + requires static io.helidon.inject.configdriven.api; + // needed to compile generated types + requires static io.helidon.inject.configdriven.runtime; + requires static io.helidon.inject.runtime; + + + exports io.helidon.faulttolerance; + + // inject module + provides io.helidon.inject.api.ModuleComponent with io.helidon.faulttolerance.Injection$$Module; +} diff --git a/nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/AsyncTest.java b/fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/AsyncTest.java similarity index 98% rename from nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/AsyncTest.java rename to fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/AsyncTest.java index 868e68f9667..f9d40053bfb 100644 --- a/nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/AsyncTest.java +++ b/fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/AsyncTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.util.concurrent.CompletableFuture; import java.util.concurrent.TimeUnit; diff --git a/nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/AtomicCycleTest.java b/fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/AtomicCycleTest.java similarity index 98% rename from nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/AtomicCycleTest.java rename to fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/AtomicCycleTest.java index 871693a864b..b4cf1892561 100644 --- a/nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/AtomicCycleTest.java +++ b/fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/AtomicCycleTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.util.Arrays; import java.util.stream.IntStream; diff --git a/nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/BulkheadTest.java b/fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/BulkheadTest.java similarity index 99% rename from nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/BulkheadTest.java rename to fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/BulkheadTest.java index b809ffdff8f..1dbf44016df 100644 --- a/nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/BulkheadTest.java +++ b/fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/BulkheadTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CountDownLatch; diff --git a/nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/CircuitBreakerTest.java b/fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/CircuitBreakerTest.java similarity index 98% rename from nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/CircuitBreakerTest.java rename to fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/CircuitBreakerTest.java index a87dee0e706..b1c24423632 100644 --- a/nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/CircuitBreakerTest.java +++ b/fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/CircuitBreakerTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.time.Duration; import java.util.concurrent.ExecutionException; diff --git a/nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/DelayRetryPolicyTest.java b/fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/DelayRetryPolicyTest.java similarity index 98% rename from nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/DelayRetryPolicyTest.java rename to fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/DelayRetryPolicyTest.java index c11b5274d30..be6a24afae1 100644 --- a/nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/DelayRetryPolicyTest.java +++ b/fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/DelayRetryPolicyTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.time.Duration; import java.util.Optional; diff --git a/nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/FallbackTest.java b/fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/FallbackTest.java similarity index 88% rename from nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/FallbackTest.java rename to fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/FallbackTest.java index 656a02f0862..11bb912ba79 100644 --- a/nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/FallbackTest.java +++ b/fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/FallbackTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.util.Arrays; import java.util.concurrent.atomic.AtomicInteger; @@ -24,7 +24,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static io.helidon.nima.faulttolerance.Fallback.createFromMethod; import static org.hamcrest.CoreMatchers.instanceOf; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; @@ -42,7 +41,7 @@ void reset() { @Test void testFallback() { - String result = createFromMethod(this::fallback).invoke(this::primary); + String result = Fallback.createFromMethod(this::fallback).invoke(this::primary); assertThat(result, is("fallback")); assertThat(primaryCounter.get(), is(1)); @@ -52,7 +51,7 @@ void testFallback() { @Test void testFallbackFails() { ConfigException configException = assertThrows(ConfigException.class, - () -> createFromMethod(this::fallbackFail).invoke(this::primary)); + () -> Fallback.createFromMethod(this::fallbackFail).invoke(this::primary)); Throwable[] suppressed = configException.getSuppressed(); assertThat("Should have a suppressed exception: " + Arrays.toString(suppressed), suppressed.length, is(1)); assertThat(suppressed[0], instanceOf(IllegalArgumentException.class)); diff --git a/fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/FaultToleranceTest.java b/fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/FaultToleranceTest.java new file mode 100644 index 00000000000..ccdfe82ff93 --- /dev/null +++ b/fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/FaultToleranceTest.java @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.faulttolerance; + +import java.time.Duration; +import java.util.concurrent.CompletableFuture; + +import org.junit.jupiter.api.Test; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +class FaultToleranceTest { + + @Test + void testCustomCombination() { + CircuitBreaker breaker = CircuitBreaker.create(CircuitBreakerConfig.create()); + + Bulkhead bulkhead = Bulkhead.builder() + .limit(1) + .queueLength(0) + .build(); + + FtHandlerTyped faultTolerance = FaultTolerance.builder() + .addBreaker(breaker) + .addBulkhead(bulkhead) + .addTimeout(TimeoutConfig.builder().timeout(Duration.ofMillis(1000)).build()) + .addFallback(Fallback.create(builder -> builder + .fallback(this::fallback))) + .build(); + + // First call should not open breaker and execute call back + String result = faultTolerance.invoke(this::primary); + assertThat(result, is(MyException.class.getName())); // callback called + + // Manually open breaker + breaker.state(CircuitBreaker.State.OPEN); + assertThat(breaker.state(), is(CircuitBreaker.State.OPEN)); + + // Next call should fail on breaker but still execute fallback + result = faultTolerance.invoke(this::primary); + assertThat(result, is(CircuitBreakerOpenException.class.getName())); + + // Manually close breaker + breaker.state(CircuitBreaker.State.CLOSED); + assertThat(breaker.state(), is(CircuitBreaker.State.CLOSED)); + + // Second call forces timeout by calling a supplier that blocks indefinitely + Manual m = new Manual(); + result = faultTolerance.invoke(m::call); + assertThat(result, is(TimeoutException.class.getName())); // callback called + } + + private String primary() { + throw new MyException(); + } + + private String fallback(Throwable throwable) { + if (throwable instanceof RuntimeException && throwable.getCause() != null) { + throwable = throwable.getCause(); + } + return throwable.getClass().getName(); + } + + private static class Manual { + private final CompletableFuture future = new CompletableFuture<>(); + + private String call() { + try { + return future.get(); // blocks indefinitely + } catch (Throwable e) { + throw new RuntimeException(e); + } + } + } + + private static class MyException extends RuntimeException { + } +} diff --git a/nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/JitterRetryPolicyTest.java b/fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/JitterRetryPolicyTest.java similarity index 99% rename from nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/JitterRetryPolicyTest.java rename to fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/JitterRetryPolicyTest.java index c6f24daa324..e0aa572a3b2 100644 --- a/nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/JitterRetryPolicyTest.java +++ b/fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/JitterRetryPolicyTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.time.Duration; import java.util.Optional; diff --git a/nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/ResultWindowTest.java b/fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/ResultWindowTest.java similarity index 99% rename from nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/ResultWindowTest.java rename to fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/ResultWindowTest.java index 850935c1d0a..6ca9234c915 100644 --- a/nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/ResultWindowTest.java +++ b/fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/ResultWindowTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import org.junit.jupiter.api.Test; diff --git a/nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/RetryTest.java b/fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/RetryTest.java similarity index 99% rename from nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/RetryTest.java rename to fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/RetryTest.java index 4e90f182795..f73b9f85e22 100644 --- a/nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/RetryTest.java +++ b/fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/RetryTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.time.Duration; import java.util.ArrayList; diff --git a/nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/TimeoutTest.java b/fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/TimeoutTest.java similarity index 97% rename from nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/TimeoutTest.java rename to fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/TimeoutTest.java index 27b6b340553..e08b5e866eb 100644 --- a/nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/TimeoutTest.java +++ b/fault-tolerance/fault-tolerance/src/test/java/io/helidon/faulttolerance/TimeoutTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance; +package io.helidon.faulttolerance; import java.time.Duration; diff --git a/fault-tolerance/fault-tolerance/src/test/resources/logging.properties b/fault-tolerance/fault-tolerance/src/test/resources/logging.properties new file mode 100644 index 00000000000..963082e751c --- /dev/null +++ b/fault-tolerance/fault-tolerance/src/test/resources/logging.properties @@ -0,0 +1,27 @@ +# +# Copyright (c) 2020, 2023 Oracle and/or its affiliates. +# +# 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. +# + +# Example Logging Configuration File +# For more information see $JAVA_HOME/jre/lib/logging.properties +# Send messages to the console +handlers=io.helidon.logging.jul.HelidonConsoleHandler +# HelidonConsoleHandler uses a SimpleFormatter subclass that replaces "!thread!" with the current thread +java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$s %3$s !thread!: %5$s%6$s%n +# Global logging level. Can be overridden by specific loggers +.level=WARNING +io.helidon.level=INFO +io.helidon.faulttolerance.level=INFO + diff --git a/fault-tolerance/pom.xml b/fault-tolerance/pom.xml new file mode 100644 index 00000000000..08e9faa5307 --- /dev/null +++ b/fault-tolerance/pom.xml @@ -0,0 +1,36 @@ + + + + + 4.0.0 + + io.helidon + helidon-project + 4.0.0-SNAPSHOT + + io.helidon.fault-tolerance + helidon-fault-tolerance-project + Helidon Fault Tolerance Project + pom + + + fault-tolerance + processor + + diff --git a/fault-tolerance/processor/pom.xml b/fault-tolerance/processor/pom.xml new file mode 100644 index 00000000000..47b25ab4732 --- /dev/null +++ b/fault-tolerance/processor/pom.xml @@ -0,0 +1,42 @@ + + + + + 4.0.0 + + + io.helidon.fault-tolerance + helidon-fault-tolerance-project + 4.0.0-SNAPSHOT + + + helidon-fault-tolerance-processor + Helidon Fault Tolerance Annotation Processor + + + + io.helidon.inject + helidon-inject-api + + + io.helidon.inject + helidon-inject-processor + + + diff --git a/nima/fault-tolerance/processor/src/main/java/io/helidon/nima/faulttolerance/processor/CircuitBreakerMethodCreator.java b/fault-tolerance/processor/src/main/java/io/helidon/faulttolerance/processor/CircuitBreakerMethodCreator.java similarity index 97% rename from nima/fault-tolerance/processor/src/main/java/io/helidon/nima/faulttolerance/processor/CircuitBreakerMethodCreator.java rename to fault-tolerance/processor/src/main/java/io/helidon/faulttolerance/processor/CircuitBreakerMethodCreator.java index 659fd404508..e6ae892ce3b 100644 --- a/nima/fault-tolerance/processor/src/main/java/io/helidon/nima/faulttolerance/processor/CircuitBreakerMethodCreator.java +++ b/fault-tolerance/processor/src/main/java/io/helidon/faulttolerance/processor/CircuitBreakerMethodCreator.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance.processor; +package io.helidon.faulttolerance.processor; import java.util.HashMap; import java.util.List; @@ -42,7 +42,7 @@ * Service provider implementation of a {@link CustomAnnotationTemplateCreator}. */ public class CircuitBreakerMethodCreator extends FtMethodCreatorBase implements CustomAnnotationTemplateCreator { - private static final String FT_ANNOTATION = "io.helidon.nima.faulttolerance.FaultTolerance.CircuitBreaker"; + private static final String FT_ANNOTATION = "io.helidon.faulttolerance.FaultTolerance.CircuitBreaker"; private static final TypeName FT_ANNOTATION_TYPE = TypeName.create(FT_ANNOTATION); /** diff --git a/nima/fault-tolerance/processor/src/main/java/io/helidon/nima/faulttolerance/processor/FallbackMethodCreator.java b/fault-tolerance/processor/src/main/java/io/helidon/faulttolerance/processor/FallbackMethodCreator.java similarity index 99% rename from nima/fault-tolerance/processor/src/main/java/io/helidon/nima/faulttolerance/processor/FallbackMethodCreator.java rename to fault-tolerance/processor/src/main/java/io/helidon/faulttolerance/processor/FallbackMethodCreator.java index 672df5ebf00..458677e2599 100644 --- a/nima/fault-tolerance/processor/src/main/java/io/helidon/nima/faulttolerance/processor/FallbackMethodCreator.java +++ b/fault-tolerance/processor/src/main/java/io/helidon/faulttolerance/processor/FallbackMethodCreator.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance.processor; +package io.helidon.faulttolerance.processor; import java.util.ArrayList; import java.util.HashMap; @@ -43,7 +43,7 @@ * Service provider implementation of a {@link CustomAnnotationTemplateCreator}. */ public class FallbackMethodCreator extends FtMethodCreatorBase implements CustomAnnotationTemplateCreator { - private static final String FALLBACK_ANNOTATION = "io.helidon.nima.faulttolerance.FaultTolerance.Fallback"; + private static final String FALLBACK_ANNOTATION = "io.helidon.faulttolerance.FaultTolerance.Fallback"; private static final TypeName FALLBACK_ANNOTATION_TYPE = TypeName.create(FALLBACK_ANNOTATION); private static final TypeName THROWABLE_TYPE = TypeName.create(Throwable.class); diff --git a/nima/fault-tolerance/processor/src/main/java/io/helidon/nima/faulttolerance/processor/FtMethodCreatorBase.java b/fault-tolerance/processor/src/main/java/io/helidon/faulttolerance/processor/FtMethodCreatorBase.java similarity index 96% rename from nima/fault-tolerance/processor/src/main/java/io/helidon/nima/faulttolerance/processor/FtMethodCreatorBase.java rename to fault-tolerance/processor/src/main/java/io/helidon/faulttolerance/processor/FtMethodCreatorBase.java index 7746aef868b..18b9bbde49c 100644 --- a/nima/fault-tolerance/processor/src/main/java/io/helidon/nima/faulttolerance/processor/FtMethodCreatorBase.java +++ b/fault-tolerance/processor/src/main/java/io/helidon/faulttolerance/processor/FtMethodCreatorBase.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance.processor; +package io.helidon.faulttolerance.processor; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; diff --git a/nima/fault-tolerance/processor/src/main/java/io/helidon/nima/faulttolerance/processor/RetryMethodCreator.java b/fault-tolerance/processor/src/main/java/io/helidon/faulttolerance/processor/RetryMethodCreator.java similarity index 98% rename from nima/fault-tolerance/processor/src/main/java/io/helidon/nima/faulttolerance/processor/RetryMethodCreator.java rename to fault-tolerance/processor/src/main/java/io/helidon/faulttolerance/processor/RetryMethodCreator.java index bee075aec5e..3440db175dd 100644 --- a/nima/fault-tolerance/processor/src/main/java/io/helidon/nima/faulttolerance/processor/RetryMethodCreator.java +++ b/fault-tolerance/processor/src/main/java/io/helidon/faulttolerance/processor/RetryMethodCreator.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.faulttolerance.processor; +package io.helidon.faulttolerance.processor; import java.util.HashMap; import java.util.List; @@ -42,7 +42,7 @@ * Service provider implementation of a {@link CustomAnnotationTemplateCreator}. */ public class RetryMethodCreator extends FtMethodCreatorBase implements CustomAnnotationTemplateCreator { - private static final String RETRY_ANNOTATION = "io.helidon.nima.faulttolerance.FaultTolerance.Retry"; + private static final String RETRY_ANNOTATION = "io.helidon.faulttolerance.FaultTolerance.Retry"; private static final TypeName RETRY_ANNOTATION_TYPE = TypeName.create(RETRY_ANNOTATION); /** diff --git a/fault-tolerance/processor/src/main/java/io/helidon/faulttolerance/processor/Templates.java b/fault-tolerance/processor/src/main/java/io/helidon/faulttolerance/processor/Templates.java new file mode 100644 index 00000000000..829b6aff287 --- /dev/null +++ b/fault-tolerance/processor/src/main/java/io/helidon/faulttolerance/processor/Templates.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.faulttolerance.processor; + +import java.io.InputStream; +import java.nio.charset.StandardCharsets; + +final class Templates { + private Templates() { + } + + static String loadTemplate(String name) { + String path = "templates/inject/" + name; + try { + InputStream in = Templates.class.getClassLoader().getResourceAsStream(path); + if (in == null) { + throw new RuntimeException("Could not find template " + path + " on classpath."); + } + try (in) { + return new String(in.readAllBytes(), StandardCharsets.UTF_8); + } + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} diff --git a/fault-tolerance/processor/src/main/java/io/helidon/faulttolerance/processor/package-info.java b/fault-tolerance/processor/src/main/java/io/helidon/faulttolerance/processor/package-info.java new file mode 100644 index 00000000000..19750e7b344 --- /dev/null +++ b/fault-tolerance/processor/src/main/java/io/helidon/faulttolerance/processor/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Annotation processor that generates Fault tolerance services discoverable by Pico. + */ +package io.helidon.faulttolerance.processor; diff --git a/fault-tolerance/processor/src/main/java/module-info.java b/fault-tolerance/processor/src/main/java/module-info.java new file mode 100644 index 00000000000..18fe9a5614b --- /dev/null +++ b/fault-tolerance/processor/src/main/java/module-info.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.faulttolerance.processor.CircuitBreakerMethodCreator; +import io.helidon.faulttolerance.processor.FallbackMethodCreator; +import io.helidon.faulttolerance.processor.RetryMethodCreator; +import io.helidon.inject.tools.spi.CustomAnnotationTemplateCreator; + +/** + * Annotation processor that generates HTTP Endpoints. + */ +module io.helidon.faulttolerance.processor { + requires io.helidon.inject.api; + requires io.helidon.inject.tools; + requires io.helidon.inject.processor; + requires java.compiler; + + exports io.helidon.faulttolerance.processor; + opens templates.inject; + + provides CustomAnnotationTemplateCreator + with FallbackMethodCreator, + RetryMethodCreator, + CircuitBreakerMethodCreator; +} diff --git a/nima/fault-tolerance/processor/src/main/resources/templates/inject/nima/circuit-breaker-method.java.hbs b/fault-tolerance/processor/src/main/resources/templates/inject/circuit-breaker-method.java.hbs similarity index 92% rename from nima/fault-tolerance/processor/src/main/resources/templates/inject/nima/circuit-breaker-method.java.hbs rename to fault-tolerance/processor/src/main/resources/templates/inject/circuit-breaker-method.java.hbs index 3778ceb61c6..8722e76e4a3 100644 --- a/nima/fault-tolerance/processor/src/main/resources/templates/inject/nima/circuit-breaker-method.java.hbs +++ b/fault-tolerance/processor/src/main/resources/templates/inject/circuit-breaker-method.java.hbs @@ -22,10 +22,10 @@ import java.util.Optional; import java.util.Set; import io.helidon.common.GenericType; -import io.helidon.nima.faulttolerance.CircuitBreakerConfig; -import io.helidon.nima.faulttolerance.ErrorChecker; -import io.helidon.nima.faulttolerance.CircuitBreaker; -import io.helidon.nima.faulttolerance.CircuitBreakerMethod; +import io.helidon.faulttolerance.CircuitBreakerConfig; +import io.helidon.faulttolerance.ErrorChecker; +import io.helidon.faulttolerance.CircuitBreaker; +import io.helidon.faulttolerance.CircuitBreakerMethod; import jakarta.inject.Inject; import jakarta.inject.Named; diff --git a/nima/fault-tolerance/processor/src/main/resources/templates/inject/nima/fallback-method.java.hbs b/fault-tolerance/processor/src/main/resources/templates/inject/fallback-method.java.hbs similarity index 96% rename from nima/fault-tolerance/processor/src/main/resources/templates/inject/nima/fallback-method.java.hbs rename to fault-tolerance/processor/src/main/resources/templates/inject/fallback-method.java.hbs index be9791d3399..bd48fab4b69 100644 --- a/nima/fault-tolerance/processor/src/main/resources/templates/inject/nima/fallback-method.java.hbs +++ b/fault-tolerance/processor/src/main/resources/templates/inject/fallback-method.java.hbs @@ -19,8 +19,8 @@ import java.util.List; import java.util.Set; import io.helidon.common.GenericType; -import io.helidon.nima.faulttolerance.ErrorChecker; -import io.helidon.nima.faulttolerance.FallbackMethod; +import io.helidon.faulttolerance.ErrorChecker; +import io.helidon.faulttolerance.FallbackMethod; import jakarta.inject.Named; import jakarta.inject.Singleton; diff --git a/nima/fault-tolerance/processor/src/main/resources/templates/inject/nima/retry-method.java.hbs b/fault-tolerance/processor/src/main/resources/templates/inject/retry-method.java.hbs similarity index 93% rename from nima/fault-tolerance/processor/src/main/resources/templates/inject/nima/retry-method.java.hbs rename to fault-tolerance/processor/src/main/resources/templates/inject/retry-method.java.hbs index ab8526d7f19..1d7c8756d07 100644 --- a/nima/fault-tolerance/processor/src/main/resources/templates/inject/nima/retry-method.java.hbs +++ b/fault-tolerance/processor/src/main/resources/templates/inject/retry-method.java.hbs @@ -22,10 +22,10 @@ import java.util.Optional; import java.util.Set; import io.helidon.common.GenericType; -import io.helidon.nima.faulttolerance.RetryConfig; -import io.helidon.nima.faulttolerance.ErrorChecker; -import io.helidon.nima.faulttolerance.Retry; -import io.helidon.nima.faulttolerance.RetryMethod; +import io.helidon.faulttolerance.RetryConfig; +import io.helidon.faulttolerance.ErrorChecker; +import io.helidon.faulttolerance.Retry; +import io.helidon.faulttolerance.RetryMethod; import jakarta.inject.Inject; import jakarta.inject.Named; diff --git a/http/encoding/deflate/pom.xml b/http/encoding/deflate/pom.xml new file mode 100644 index 00000000000..0feca134648 --- /dev/null +++ b/http/encoding/deflate/pom.xml @@ -0,0 +1,63 @@ + + + + 4.0.0 + + io.helidon.http.encoding + helidon-http-encoding-project + 4.0.0-SNAPSHOT + + + helidon-http-encoding-deflate + Helidon HTTP Encoding deflate + + + + io.helidon.http.encoding + helidon-http-encoding + + + io.helidon.http + helidon-http + + + io.helidon.common.features + helidon-common-features-api + true + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + + + + + diff --git a/nima/http/encoding/deflate/src/main/java/io/helidon/nima/http/encoding/deflate/DeflateEncoding.java b/http/encoding/deflate/src/main/java/io/helidon/http/encoding/deflate/DeflateEncoding.java similarity index 89% rename from nima/http/encoding/deflate/src/main/java/io/helidon/nima/http/encoding/deflate/DeflateEncoding.java rename to http/encoding/deflate/src/main/java/io/helidon/http/encoding/deflate/DeflateEncoding.java index 0908693ee98..c4bc9861eda 100644 --- a/nima/http/encoding/deflate/src/main/java/io/helidon/nima/http/encoding/deflate/DeflateEncoding.java +++ b/http/encoding/deflate/src/main/java/io/helidon/http/encoding/deflate/DeflateEncoding.java @@ -14,18 +14,18 @@ * limitations under the License. */ -package io.helidon.nima.http.encoding.deflate; +package io.helidon.http.encoding.deflate; import java.io.OutputStream; import java.util.Set; import java.util.zip.DeflaterOutputStream; import java.util.zip.InflaterInputStream; -import io.helidon.common.http.Http; -import io.helidon.common.http.WritableHeaders; -import io.helidon.nima.http.encoding.ContentDecoder; -import io.helidon.nima.http.encoding.ContentEncoder; -import io.helidon.nima.http.encoding.ContentEncoding; +import io.helidon.http.Http; +import io.helidon.http.WritableHeaders; +import io.helidon.http.encoding.ContentDecoder; +import io.helidon.http.encoding.ContentEncoder; +import io.helidon.http.encoding.ContentEncoding; /** * Support for {@code deflate} content encoding. diff --git a/nima/http/encoding/deflate/src/main/java/io/helidon/nima/http/encoding/deflate/DeflateEncodingProvider.java b/http/encoding/deflate/src/main/java/io/helidon/http/encoding/deflate/DeflateEncodingProvider.java similarity index 85% rename from nima/http/encoding/deflate/src/main/java/io/helidon/nima/http/encoding/deflate/DeflateEncodingProvider.java rename to http/encoding/deflate/src/main/java/io/helidon/http/encoding/deflate/DeflateEncodingProvider.java index e5c0d7a84f1..4cb13a0c042 100644 --- a/nima/http/encoding/deflate/src/main/java/io/helidon/nima/http/encoding/deflate/DeflateEncodingProvider.java +++ b/http/encoding/deflate/src/main/java/io/helidon/http/encoding/deflate/DeflateEncodingProvider.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.helidon.nima.http.encoding.deflate; +package io.helidon.http.encoding.deflate; import io.helidon.common.config.Config; -import io.helidon.nima.http.encoding.ContentEncoding; -import io.helidon.nima.http.encoding.spi.ContentEncodingProvider; +import io.helidon.http.encoding.ContentEncoding; +import io.helidon.http.encoding.spi.ContentEncodingProvider; /** * Support for {@code deflate} content encoding. diff --git a/http/encoding/deflate/src/main/java/io/helidon/http/encoding/deflate/package-info.java b/http/encoding/deflate/src/main/java/io/helidon/http/encoding/deflate/package-info.java new file mode 100644 index 00000000000..c89ef1f4c78 --- /dev/null +++ b/http/encoding/deflate/src/main/java/io/helidon/http/encoding/deflate/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Deflate encoding support. + */ +package io.helidon.http.encoding.deflate; diff --git a/http/encoding/deflate/src/main/java/module-info.java b/http/encoding/deflate/src/main/java/module-info.java new file mode 100644 index 00000000000..4abc427573f --- /dev/null +++ b/http/encoding/deflate/src/main/java/module-info.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.common.features.api.Feature; +import io.helidon.common.features.api.HelidonFlavor; +import io.helidon.http.encoding.deflate.DeflateEncodingProvider; + +/** + * Deflate content encoding support. + */ +@Feature(value = "Deflate", + description = "Deflate content encoding support", + in = HelidonFlavor.SE, + path = {"Encoding", "Deflate"} +) +module io.helidon.http.encoding.deflate { + requires static io.helidon.common.features.api; + + requires io.helidon.common; + requires io.helidon.http.encoding; + + exports io.helidon.http.encoding.deflate; + + provides io.helidon.http.encoding.spi.ContentEncodingProvider with DeflateEncodingProvider; +} \ No newline at end of file diff --git a/http/encoding/encoding/pom.xml b/http/encoding/encoding/pom.xml new file mode 100644 index 00000000000..b80326fc56e --- /dev/null +++ b/http/encoding/encoding/pom.xml @@ -0,0 +1,129 @@ + + + + 4.0.0 + + io.helidon.http.encoding + helidon-http-encoding-project + 4.0.0-SNAPSHOT + + + helidon-http-encoding + Helidon HTTP Encoding + + + + io.helidon.common + helidon-common-config + + + io.helidon.http + helidon-http + + + io.helidon.common + helidon-common-uri + + + io.helidon.builder + helidon-builder-api + + + + jakarta.annotation + jakarta.annotation-api + true + + + io.helidon.config + helidon-config-metadata + true + + + io.helidon.common.features + helidon-common-features-api + true + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + io.helidon.builder + helidon-builder-processor + ${helidon.version} + + + io.helidon.config + helidon-config-metadata-processor + ${helidon.version} + + + io.helidon.common.processor + helidon-common-processor-helidon-copyright + ${helidon.version} + + + + + + io.helidon.builder + helidon-builder-processor + ${helidon.version} + + + io.helidon.config + helidon-config-metadata-processor + ${helidon.version} + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + io.helidon.common.processor + helidon-common-processor-helidon-copyright + ${helidon.version} + + + + + + diff --git a/nima/http/encoding/encoding/src/main/java/io/helidon/nima/http/encoding/ContentDecoder.java b/http/encoding/encoding/src/main/java/io/helidon/http/encoding/ContentDecoder.java similarity index 92% rename from nima/http/encoding/encoding/src/main/java/io/helidon/nima/http/encoding/ContentDecoder.java rename to http/encoding/encoding/src/main/java/io/helidon/http/encoding/ContentDecoder.java index cec924ee4cf..0825a5beb69 100644 --- a/nima/http/encoding/encoding/src/main/java/io/helidon/nima/http/encoding/ContentDecoder.java +++ b/http/encoding/encoding/src/main/java/io/helidon/http/encoding/ContentDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.encoding; +package io.helidon.http.encoding; import java.io.InputStream; import java.util.function.Function; diff --git a/nima/http/encoding/encoding/src/main/java/io/helidon/nima/http/encoding/ContentEncoder.java b/http/encoding/encoding/src/main/java/io/helidon/http/encoding/ContentEncoder.java similarity index 89% rename from nima/http/encoding/encoding/src/main/java/io/helidon/nima/http/encoding/ContentEncoder.java rename to http/encoding/encoding/src/main/java/io/helidon/http/encoding/ContentEncoder.java index 93fa4335c0a..11448d21d14 100644 --- a/nima/http/encoding/encoding/src/main/java/io/helidon/nima/http/encoding/ContentEncoder.java +++ b/http/encoding/encoding/src/main/java/io/helidon/http/encoding/ContentEncoder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.helidon.nima.http.encoding; +package io.helidon.http.encoding; import java.io.OutputStream; -import io.helidon.common.http.WritableHeaders; +import io.helidon.http.WritableHeaders; /** * Content encoder. diff --git a/nima/http/encoding/encoding/src/main/java/io/helidon/nima/http/encoding/ContentEncoding.java b/http/encoding/encoding/src/main/java/io/helidon/http/encoding/ContentEncoding.java similarity index 91% rename from nima/http/encoding/encoding/src/main/java/io/helidon/nima/http/encoding/ContentEncoding.java rename to http/encoding/encoding/src/main/java/io/helidon/http/encoding/ContentEncoding.java index d961c30c27d..e16e5df5dfd 100644 --- a/nima/http/encoding/encoding/src/main/java/io/helidon/nima/http/encoding/ContentEncoding.java +++ b/http/encoding/encoding/src/main/java/io/helidon/http/encoding/ContentEncoding.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.nima.http.encoding; +package io.helidon.http.encoding; import java.util.Set; import io.helidon.common.config.NamedService; /** - * Content encoding service created from {@link io.helidon.nima.http.encoding.spi.ContentEncodingProvider}, + * Content encoding service created from {@link io.helidon.http.encoding.spi.ContentEncodingProvider}, * or directly implemented. * Content encoding/decoding modifies bytes on the wire, for example to compress it. */ diff --git a/nima/http/encoding/encoding/src/main/java/io/helidon/nima/http/encoding/ContentEncodingContext.java b/http/encoding/encoding/src/main/java/io/helidon/http/encoding/ContentEncodingContext.java similarity index 98% rename from nima/http/encoding/encoding/src/main/java/io/helidon/nima/http/encoding/ContentEncodingContext.java rename to http/encoding/encoding/src/main/java/io/helidon/http/encoding/ContentEncodingContext.java index 1fa0ca9324e..87d171e3ff1 100644 --- a/nima/http/encoding/encoding/src/main/java/io/helidon/nima/http/encoding/ContentEncodingContext.java +++ b/http/encoding/encoding/src/main/java/io/helidon/http/encoding/ContentEncodingContext.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.nima.http.encoding; +package io.helidon.http.encoding; import java.util.NoSuchElementException; import java.util.function.Consumer; import io.helidon.builder.api.RuntimeType; import io.helidon.common.config.Config; -import io.helidon.common.http.Headers; +import io.helidon.http.Headers; /** * Content encoding support to obtain encoders and decoders. diff --git a/nima/http/encoding/encoding/src/main/java/io/helidon/nima/http/encoding/ContentEncodingContextConfigBlueprint.java b/http/encoding/encoding/src/main/java/io/helidon/http/encoding/ContentEncodingContextConfigBlueprint.java similarity index 92% rename from nima/http/encoding/encoding/src/main/java/io/helidon/nima/http/encoding/ContentEncodingContextConfigBlueprint.java rename to http/encoding/encoding/src/main/java/io/helidon/http/encoding/ContentEncodingContextConfigBlueprint.java index 2ded52a403c..2698ba65716 100644 --- a/nima/http/encoding/encoding/src/main/java/io/helidon/nima/http/encoding/ContentEncodingContextConfigBlueprint.java +++ b/http/encoding/encoding/src/main/java/io/helidon/http/encoding/ContentEncodingContextConfigBlueprint.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.nima.http.encoding; +package io.helidon.http.encoding; import java.util.List; import io.helidon.builder.api.Prototype; import io.helidon.config.metadata.Configured; import io.helidon.config.metadata.ConfiguredOption; -import io.helidon.nima.http.encoding.spi.ContentEncodingProvider; +import io.helidon.http.encoding.spi.ContentEncodingProvider; @Prototype.Blueprint @Configured diff --git a/nima/http/encoding/encoding/src/main/java/io/helidon/nima/http/encoding/ContentEncodingSupportImpl.java b/http/encoding/encoding/src/main/java/io/helidon/http/encoding/ContentEncodingSupportImpl.java similarity index 98% rename from nima/http/encoding/encoding/src/main/java/io/helidon/nima/http/encoding/ContentEncodingSupportImpl.java rename to http/encoding/encoding/src/main/java/io/helidon/http/encoding/ContentEncodingSupportImpl.java index f12040db5b0..52fa10d041f 100644 --- a/nima/http/encoding/encoding/src/main/java/io/helidon/nima/http/encoding/ContentEncodingSupportImpl.java +++ b/http/encoding/encoding/src/main/java/io/helidon/http/encoding/ContentEncodingSupportImpl.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.encoding; +package io.helidon.http.encoding; import java.util.ArrayList; import java.util.Collections; @@ -25,8 +25,8 @@ import java.util.Objects; import java.util.Set; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; +import io.helidon.http.Headers; +import io.helidon.http.Http; class ContentEncodingSupportImpl implements ContentEncodingContext { private static final String IDENTITY_ENCODING = "identity"; diff --git a/http/encoding/encoding/src/main/java/io/helidon/http/encoding/package-info.java b/http/encoding/encoding/src/main/java/io/helidon/http/encoding/package-info.java new file mode 100644 index 00000000000..3356387daac --- /dev/null +++ b/http/encoding/encoding/src/main/java/io/helidon/http/encoding/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * HTTP Content encoding support, usually used to compress entity, such as {@code gzip}. + */ +package io.helidon.http.encoding; diff --git a/nima/http/encoding/encoding/src/main/java/io/helidon/nima/http/encoding/spi/ContentEncodingProvider.java b/http/encoding/encoding/src/main/java/io/helidon/http/encoding/spi/ContentEncodingProvider.java similarity index 89% rename from nima/http/encoding/encoding/src/main/java/io/helidon/nima/http/encoding/spi/ContentEncodingProvider.java rename to http/encoding/encoding/src/main/java/io/helidon/http/encoding/spi/ContentEncodingProvider.java index b5c13a11bae..594b4bb2638 100644 --- a/nima/http/encoding/encoding/src/main/java/io/helidon/nima/http/encoding/spi/ContentEncodingProvider.java +++ b/http/encoding/encoding/src/main/java/io/helidon/http/encoding/spi/ContentEncodingProvider.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.helidon.nima.http.encoding.spi; +package io.helidon.http.encoding.spi; import io.helidon.common.config.ConfiguredProvider; -import io.helidon.nima.http.encoding.ContentEncoding; +import io.helidon.http.encoding.ContentEncoding; /** * Content encoding {@link java.util.ServiceLoader} service provider interface. diff --git a/http/encoding/encoding/src/main/java/io/helidon/http/encoding/spi/package-info.java b/http/encoding/encoding/src/main/java/io/helidon/http/encoding/spi/package-info.java new file mode 100644 index 00000000000..6bb5ae4b060 --- /dev/null +++ b/http/encoding/encoding/src/main/java/io/helidon/http/encoding/spi/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * SPI to create custom content encoding. + */ +package io.helidon.http.encoding.spi; diff --git a/http/encoding/encoding/src/main/java/module-info.java b/http/encoding/encoding/src/main/java/module-info.java new file mode 100644 index 00000000000..f7e5b900705 --- /dev/null +++ b/http/encoding/encoding/src/main/java/module-info.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.common.features.api.Feature; +import io.helidon.common.features.api.HelidonFlavor; +import io.helidon.http.encoding.spi.ContentEncodingProvider; + +/** + * Content encoding support. + */ +@Feature(value = "Encoding", + description = "Content encoding support", + in = HelidonFlavor.SE, + path = "Encoding" +) +module io.helidon.http.encoding { + requires static io.helidon.common.features.api; + requires io.helidon.builder.api; + requires static io.helidon.config.metadata; + requires static jakarta.annotation; + + requires io.helidon.common; + + requires transitive io.helidon.common.config; + requires transitive io.helidon.http; + + exports io.helidon.http.encoding; + exports io.helidon.http.encoding.spi; + + uses ContentEncodingProvider; +} \ No newline at end of file diff --git a/nima/http/encoding/encoding/src/test/java/io/helidon/nima/http/encoding/ContentEncodingSupportTest.java b/http/encoding/encoding/src/test/java/io/helidon/http/encoding/ContentEncodingSupportTest.java similarity index 90% rename from nima/http/encoding/encoding/src/test/java/io/helidon/nima/http/encoding/ContentEncodingSupportTest.java rename to http/encoding/encoding/src/test/java/io/helidon/http/encoding/ContentEncodingSupportTest.java index 141a6086d5a..7cf3b738ac7 100644 --- a/nima/http/encoding/encoding/src/test/java/io/helidon/nima/http/encoding/ContentEncodingSupportTest.java +++ b/http/encoding/encoding/src/test/java/io/helidon/http/encoding/ContentEncodingSupportTest.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package io.helidon.nima.http.encoding; +package io.helidon.http.encoding; import java.util.List; import org.junit.jupiter.api.Test; -import io.helidon.nima.http.encoding.ContentEncodingSupportImpl.EncodingWithQ; +import io.helidon.http.encoding.ContentEncodingSupportImpl.EncodingWithQ; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; -import static io.helidon.nima.http.encoding.ContentEncodingSupportImpl.encodings; +import static io.helidon.http.encoding.ContentEncodingSupportImpl.encodings; class ContentEncodingSupportTest { diff --git a/http/encoding/gzip/pom.xml b/http/encoding/gzip/pom.xml new file mode 100644 index 00000000000..7e7b09582a0 --- /dev/null +++ b/http/encoding/gzip/pom.xml @@ -0,0 +1,63 @@ + + + + 4.0.0 + + io.helidon.http.encoding + helidon-http-encoding-project + 4.0.0-SNAPSHOT + + + helidon-http-encoding-gzip + Helidon HTTP Encoding gzip + + + + io.helidon.http.encoding + helidon-http-encoding + + + io.helidon.http + helidon-http + + + io.helidon.common.features + helidon-common-features-api + true + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + + + + + diff --git a/nima/http/encoding/gzip/src/main/java/io/helidon/nima/http/encoding/gzip/GzipEncoding.java b/http/encoding/gzip/src/main/java/io/helidon/http/encoding/gzip/GzipEncoding.java similarity index 88% rename from nima/http/encoding/gzip/src/main/java/io/helidon/nima/http/encoding/gzip/GzipEncoding.java rename to http/encoding/gzip/src/main/java/io/helidon/http/encoding/gzip/GzipEncoding.java index d3995ad21cc..3874693d0b5 100644 --- a/nima/http/encoding/gzip/src/main/java/io/helidon/nima/http/encoding/gzip/GzipEncoding.java +++ b/http/encoding/gzip/src/main/java/io/helidon/http/encoding/gzip/GzipEncoding.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.encoding.gzip; +package io.helidon.http.encoding.gzip; import java.io.IOException; import java.io.OutputStream; @@ -23,13 +23,13 @@ import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; -import io.helidon.common.http.Http; -import io.helidon.common.http.WritableHeaders; -import io.helidon.nima.http.encoding.ContentDecoder; -import io.helidon.nima.http.encoding.ContentEncoder; -import io.helidon.nima.http.encoding.ContentEncoding; +import io.helidon.http.Http; +import io.helidon.http.WritableHeaders; +import io.helidon.http.encoding.ContentDecoder; +import io.helidon.http.encoding.ContentEncoder; +import io.helidon.http.encoding.ContentEncoding; -import static io.helidon.common.http.Http.HeaderNames.CONTENT_LENGTH; +import static io.helidon.http.Http.HeaderNames.CONTENT_LENGTH; /** * Support for gzip content encoding. diff --git a/nima/http/encoding/gzip/src/main/java/io/helidon/nima/http/encoding/gzip/GzipEncodingProvider.java b/http/encoding/gzip/src/main/java/io/helidon/http/encoding/gzip/GzipEncodingProvider.java similarity index 88% rename from nima/http/encoding/gzip/src/main/java/io/helidon/nima/http/encoding/gzip/GzipEncodingProvider.java rename to http/encoding/gzip/src/main/java/io/helidon/http/encoding/gzip/GzipEncodingProvider.java index 0f6375a2987..512ad387437 100644 --- a/nima/http/encoding/gzip/src/main/java/io/helidon/nima/http/encoding/gzip/GzipEncodingProvider.java +++ b/http/encoding/gzip/src/main/java/io/helidon/http/encoding/gzip/GzipEncodingProvider.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.nima.http.encoding.gzip; +package io.helidon.http.encoding.gzip; import io.helidon.common.Weighted; import io.helidon.common.config.Config; -import io.helidon.nima.http.encoding.ContentEncoding; -import io.helidon.nima.http.encoding.spi.ContentEncodingProvider; +import io.helidon.http.encoding.ContentEncoding; +import io.helidon.http.encoding.spi.ContentEncodingProvider; /** * Support for gzip content encoding. diff --git a/http/encoding/gzip/src/main/java/io/helidon/http/encoding/gzip/package-info.java b/http/encoding/gzip/src/main/java/io/helidon/http/encoding/gzip/package-info.java new file mode 100644 index 00000000000..5bddd02e1bd --- /dev/null +++ b/http/encoding/gzip/src/main/java/io/helidon/http/encoding/gzip/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Gzip encoding support. + */ +package io.helidon.http.encoding.gzip; diff --git a/http/encoding/gzip/src/main/java/module-info.java b/http/encoding/gzip/src/main/java/module-info.java new file mode 100644 index 00000000000..9e9af606506 --- /dev/null +++ b/http/encoding/gzip/src/main/java/module-info.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.common.features.api.Feature; +import io.helidon.common.features.api.HelidonFlavor; +import io.helidon.http.encoding.gzip.GzipEncodingProvider; + +/** + * GZip content encoding support. + */ +@Feature(value = "GZip", + description = "GZip content encoding support", + in = HelidonFlavor.SE, + path = {"Encoding", "GZip"} +) +module io.helidon.http.encoding.gzip { + requires static io.helidon.common.features.api; + + requires io.helidon.common; + requires io.helidon.http.encoding; + + exports io.helidon.http.encoding.gzip; + + provides io.helidon.http.encoding.spi.ContentEncodingProvider with GzipEncodingProvider; +} \ No newline at end of file diff --git a/http/encoding/pom.xml b/http/encoding/pom.xml new file mode 100644 index 00000000000..b705fd1d864 --- /dev/null +++ b/http/encoding/pom.xml @@ -0,0 +1,38 @@ + + + + 4.0.0 + + io.helidon.http + helidon-http-project + 4.0.0-SNAPSHOT + + + io.helidon.http.encoding + helidon-http-encoding-project + Helidon HTTP Encoding Project + Content-Encoding schemes + pom + + + encoding + gzip + deflate + + diff --git a/common/http/README.md b/http/http/README.md similarity index 100% rename from common/http/README.md rename to http/http/README.md diff --git a/http/http/pom.xml b/http/http/pom.xml new file mode 100644 index 00000000000..73ca3324e4b --- /dev/null +++ b/http/http/pom.xml @@ -0,0 +1,90 @@ + + + + 4.0.0 + + io.helidon.http + helidon-http-project + 4.0.0-SNAPSHOT + + + helidon-http + Helidon HTTP + HTTP primitives for client and server + + + + io.helidon.common + helidon-common + + + io.helidon.common + helidon-common-configurable + + + io.helidon.common + helidon-common-buffers + + + io.helidon.common + helidon-common-mapper + + + io.helidon.common + helidon-common-media-type + + + io.helidon.common + helidon-common-uri + + + io.helidon.config + helidon-config-metadata + true + + + io.helidon.config + helidon-config-metadata-processor + true + + + io.helidon.common.testing + helidon-common-testing-junit5 + test + + + org.junit.jupiter + junit-jupiter-api + test + + + junit-jupiter-params + org.junit.jupiter + test + + + org.hamcrest + hamcrest-all + test + + + + diff --git a/common/http/src/main/java/io/helidon/common/http/BadRequestException.java b/http/http/src/main/java/io/helidon/http/BadRequestException.java similarity index 93% rename from common/http/src/main/java/io/helidon/common/http/BadRequestException.java rename to http/http/src/main/java/io/helidon/http/BadRequestException.java index e857612aaff..2a7256e2174 100644 --- a/common/http/src/main/java/io/helidon/common/http/BadRequestException.java +++ b/http/http/src/main/java/io/helidon/http/BadRequestException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022 Oracle and/or its affiliates. + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; /** * A runtime exception indicating a {@link Http.Status#BAD_REQUEST_400 bad request}. diff --git a/common/http/src/main/java/io/helidon/common/http/ByteBufferDataChunk.java b/http/http/src/main/java/io/helidon/http/ByteBufferDataChunk.java similarity index 97% rename from common/http/src/main/java/io/helidon/common/http/ByteBufferDataChunk.java rename to http/http/src/main/java/io/helidon/http/ByteBufferDataChunk.java index d3b41535a4c..0e69b99b7be 100644 --- a/common/http/src/main/java/io/helidon/common/http/ByteBufferDataChunk.java +++ b/http/http/src/main/java/io/helidon/http/ByteBufferDataChunk.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. + * Copyright (c) 2021, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.nio.ByteBuffer; import java.util.Objects; diff --git a/common/http/src/main/java/io/helidon/common/http/ClientRequestHeaders.java b/http/http/src/main/java/io/helidon/http/ClientRequestHeaders.java similarity index 98% rename from common/http/src/main/java/io/helidon/common/http/ClientRequestHeaders.java rename to http/http/src/main/java/io/helidon/http/ClientRequestHeaders.java index a9cf5306918..f573cec4e29 100644 --- a/common/http/src/main/java/io/helidon/common/http/ClientRequestHeaders.java +++ b/http/http/src/main/java/io/helidon/http/ClientRequestHeaders.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import io.helidon.common.media.type.MediaType; diff --git a/common/http/src/main/java/io/helidon/common/http/ClientRequestHeadersImpl.java b/http/http/src/main/java/io/helidon/http/ClientRequestHeadersImpl.java similarity index 97% rename from common/http/src/main/java/io/helidon/common/http/ClientRequestHeadersImpl.java rename to http/http/src/main/java/io/helidon/http/ClientRequestHeadersImpl.java index 8b7ec911027..b14cb554569 100644 --- a/common/http/src/main/java/io/helidon/common/http/ClientRequestHeadersImpl.java +++ b/http/http/src/main/java/io/helidon/http/ClientRequestHeadersImpl.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.util.ArrayList; import java.util.Collections; @@ -23,7 +23,7 @@ import java.util.function.Consumer; import java.util.function.Supplier; -import io.helidon.common.http.Http.HeaderName; +import io.helidon.http.Http.HeaderName; /** * Client request headers. diff --git a/common/http/src/main/java/io/helidon/common/http/ClientResponseHeaders.java b/http/http/src/main/java/io/helidon/http/ClientResponseHeaders.java similarity index 84% rename from common/http/src/main/java/io/helidon/common/http/ClientResponseHeaders.java rename to http/http/src/main/java/io/helidon/http/ClientResponseHeaders.java index 0dff36cd2c1..e4fa88d981f 100644 --- a/common/http/src/main/java/io/helidon/common/http/ClientResponseHeaders.java +++ b/http/http/src/main/java/io/helidon/http/ClientResponseHeaders.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.net.URI; import java.time.ZonedDateTime; @@ -22,13 +22,13 @@ import java.util.List; import java.util.Optional; -import io.helidon.common.http.Http.DateTime; import io.helidon.common.media.type.ParserMode; +import io.helidon.http.Http.DateTime; -import static io.helidon.common.http.Http.HeaderNames.ACCEPT_PATCH; -import static io.helidon.common.http.Http.HeaderNames.EXPIRES; -import static io.helidon.common.http.Http.HeaderNames.LAST_MODIFIED; -import static io.helidon.common.http.Http.HeaderNames.LOCATION; +import static io.helidon.http.Http.HeaderNames.ACCEPT_PATCH; +import static io.helidon.http.Http.HeaderNames.EXPIRES; +import static io.helidon.http.Http.HeaderNames.LAST_MODIFIED; +import static io.helidon.http.Http.HeaderNames.LOCATION; /** * HTTP Headers of a client response. @@ -71,7 +71,7 @@ default List acceptPatches() { } /** - * Optionally gets the value of {@link io.helidon.common.http.Http.HeaderNames#LOCATION} header. + * Optionally gets the value of {@link io.helidon.http.Http.HeaderNames#LOCATION} header. *

* Used in redirection, or when a new resource has been created. * @@ -87,7 +87,7 @@ default Optional location() { } /** - * Optionally gets the value of {@link io.helidon.common.http.Http.HeaderNames#LAST_MODIFIED} header. + * Optionally gets the value of {@link io.helidon.http.Http.HeaderNames#LAST_MODIFIED} header. *

* The last modified date for the requested object. * @@ -103,7 +103,7 @@ default Optional lastModified() { } /** - * Optionally gets the value of {@link io.helidon.common.http.Http.HeaderNames#EXPIRES} header. + * Optionally gets the value of {@link io.helidon.http.Http.HeaderNames#EXPIRES} header. *

* Gives the date/time after which the response is considered stale. * diff --git a/common/http/src/main/java/io/helidon/common/http/ClientResponseHeadersImpl.java b/http/http/src/main/java/io/helidon/http/ClientResponseHeadersImpl.java similarity index 98% rename from common/http/src/main/java/io/helidon/common/http/ClientResponseHeadersImpl.java rename to http/http/src/main/java/io/helidon/http/ClientResponseHeadersImpl.java index 776f903532c..edb3111e034 100644 --- a/common/http/src/main/java/io/helidon/common/http/ClientResponseHeadersImpl.java +++ b/http/http/src/main/java/io/helidon/http/ClientResponseHeadersImpl.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.util.Iterator; import java.util.List; diff --git a/common/http/src/main/java/io/helidon/common/http/ContentDisposition.java b/http/http/src/main/java/io/helidon/http/ContentDisposition.java similarity index 99% rename from common/http/src/main/java/io/helidon/common/http/ContentDisposition.java rename to http/http/src/main/java/io/helidon/http/ContentDisposition.java index fe5f95fc55a..0a07ded6eda 100644 --- a/common/http/src/main/java/io/helidon/common/http/ContentDisposition.java +++ b/http/http/src/main/java/io/helidon/http/ContentDisposition.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.net.URLDecoder; import java.net.URLEncoder; @@ -276,7 +276,7 @@ public String type() { } /** - * Fluent API builder for {@link io.helidon.common.http.ContentDisposition}. + * Fluent API builder for {@link ContentDisposition}. */ public static final class Builder implements io.helidon.common.Builder { /** diff --git a/common/http/src/main/java/io/helidon/common/http/CookieParser.java b/http/http/src/main/java/io/helidon/http/CookieParser.java similarity index 99% rename from common/http/src/main/java/io/helidon/common/http/CookieParser.java rename to http/http/src/main/java/io/helidon/http/CookieParser.java index 0d95befe5b3..c75e62fde39 100644 --- a/common/http/src/main/java/io/helidon/common/http/CookieParser.java +++ b/http/http/src/main/java/io/helidon/http/CookieParser.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.util.ArrayList; import java.util.HashMap; diff --git a/common/http/src/main/java/io/helidon/common/http/DataChunk.java b/http/http/src/main/java/io/helidon/http/DataChunk.java similarity index 99% rename from common/http/src/main/java/io/helidon/common/http/DataChunk.java rename to http/http/src/main/java/io/helidon/http/DataChunk.java index 15d51a988f3..6945119d301 100644 --- a/common/http/src/main/java/io/helidon/common/http/DataChunk.java +++ b/http/http/src/main/java/io/helidon/http/DataChunk.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021 Oracle and/or its affiliates. + * Copyright (c) 2018, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.nio.ByteBuffer; import java.util.Iterator; diff --git a/common/http/src/main/java/io/helidon/common/http/DirectHandler.java b/http/http/src/main/java/io/helidon/http/DirectHandler.java similarity index 99% rename from common/http/src/main/java/io/helidon/common/http/DirectHandler.java rename to http/http/src/main/java/io/helidon/http/DirectHandler.java index 9ce4bffc56d..ef0f1c7a608 100644 --- a/common/http/src/main/java/io/helidon/common/http/DirectHandler.java +++ b/http/http/src/main/java/io/helidon/http/DirectHandler.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.lang.System.Logger.Level; import java.nio.charset.StandardCharsets; diff --git a/common/http/src/main/java/io/helidon/common/http/DirectHandlerDefault.java b/http/http/src/main/java/io/helidon/http/DirectHandlerDefault.java similarity index 94% rename from common/http/src/main/java/io/helidon/common/http/DirectHandlerDefault.java rename to http/http/src/main/java/io/helidon/http/DirectHandlerDefault.java index 6102606a34b..9cbb09ec6e3 100644 --- a/common/http/src/main/java/io/helidon/common/http/DirectHandlerDefault.java +++ b/http/http/src/main/java/io/helidon/http/DirectHandlerDefault.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; final class DirectHandlerDefault implements DirectHandler { static final DirectHandler INSTANCE = new DirectHandlerDefault(); diff --git a/common/http/src/main/java/io/helidon/common/http/DirectHandlerEmptyRequest.java b/http/http/src/main/java/io/helidon/http/DirectHandlerEmptyRequest.java similarity index 92% rename from common/http/src/main/java/io/helidon/common/http/DirectHandlerEmptyRequest.java rename to http/http/src/main/java/io/helidon/http/DirectHandlerEmptyRequest.java index 11f28ea4a01..206cdfb9034 100644 --- a/common/http/src/main/java/io/helidon/common/http/DirectHandlerEmptyRequest.java +++ b/http/http/src/main/java/io/helidon/http/DirectHandlerEmptyRequest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; record DirectHandlerEmptyRequest(String protocolVersion, String method, String path, ServerRequestHeaders headers) implements DirectHandler.TransportRequest { diff --git a/common/http/src/main/java/io/helidon/common/http/Endpoint.java b/http/http/src/main/java/io/helidon/http/Endpoint.java similarity index 99% rename from common/http/src/main/java/io/helidon/common/http/Endpoint.java rename to http/http/src/main/java/io/helidon/http/Endpoint.java index 9599c492473..e0f18ddebb8 100644 --- a/common/http/src/main/java/io/helidon/common/http/Endpoint.java +++ b/http/http/src/main/java/io/helidon/http/Endpoint.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; diff --git a/common/http/src/main/java/io/helidon/common/http/ForbiddenException.java b/http/http/src/main/java/io/helidon/http/ForbiddenException.java similarity index 76% rename from common/http/src/main/java/io/helidon/common/http/ForbiddenException.java rename to http/http/src/main/java/io/helidon/http/ForbiddenException.java index bdfa049ad38..a1de924a14f 100644 --- a/common/http/src/main/java/io/helidon/common/http/ForbiddenException.java +++ b/http/http/src/main/java/io/helidon/http/ForbiddenException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022 Oracle and/or its affiliates. + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,15 +14,15 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; /** - * A runtime exception indicating a {@link io.helidon.common.http.Http.Status#FORBIDDEN_403 forbidden}. + * A runtime exception indicating a {@link Http.Status#FORBIDDEN_403 forbidden}. */ public class ForbiddenException extends HttpException { /** - * Creates {@link io.helidon.common.http.ForbiddenException}. + * Creates {@link ForbiddenException}. * * @param message the message */ @@ -31,7 +31,7 @@ public ForbiddenException(String message) { } /** - * Creates {@link io.helidon.common.http.ForbiddenException}. + * Creates {@link ForbiddenException}. * * @param message the message * @param cause the cause of this exception diff --git a/common/http/src/main/java/io/helidon/common/http/Forwarded.java b/http/http/src/main/java/io/helidon/http/Forwarded.java similarity index 96% rename from common/http/src/main/java/io/helidon/common/http/Forwarded.java rename to http/http/src/main/java/io/helidon/http/Forwarded.java index bf4b04ea310..619043adc18 100644 --- a/common/http/src/main/java/io/helidon/common/http/Forwarded.java +++ b/http/http/src/main/java/io/helidon/http/Forwarded.java @@ -14,17 +14,17 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.util.Arrays; import java.util.List; import java.util.Locale; import java.util.Optional; -import static io.helidon.common.http.Http.HeaderNames.FORWARDED; +import static io.helidon.http.Http.HeaderNames.FORWARDED; /** - * A representation of the {@link io.helidon.common.http.Http.HeaderNames#FORWARDED} HTTP header. + * A representation of the {@link io.helidon.http.Http.HeaderNames#FORWARDED} HTTP header. */ public class Forwarded { private static final System.Logger LOGGER = System.getLogger(Forwarded.class.getName()); diff --git a/common/http/src/main/java/io/helidon/common/http/HeaderHelper.java b/http/http/src/main/java/io/helidon/http/HeaderHelper.java similarity index 96% rename from common/http/src/main/java/io/helidon/common/http/HeaderHelper.java rename to http/http/src/main/java/io/helidon/http/HeaderHelper.java index 6aa0b807b11..6f1a88b1ebc 100644 --- a/common/http/src/main/java/io/helidon/common/http/HeaderHelper.java +++ b/http/http/src/main/java/io/helidon/http/HeaderHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022 Oracle and/or its affiliates. + * Copyright (c) 2018, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.util.ArrayList; import java.util.List; diff --git a/common/http/src/main/java/io/helidon/common/http/HeaderNameEnum.java b/http/http/src/main/java/io/helidon/http/HeaderNameEnum.java similarity index 99% rename from common/http/src/main/java/io/helidon/common/http/HeaderNameEnum.java rename to http/http/src/main/java/io/helidon/http/HeaderNameEnum.java index 260294d07e6..d4c707065ef 100644 --- a/common/http/src/main/java/io/helidon/common/http/HeaderNameEnum.java +++ b/http/http/src/main/java/io/helidon/http/HeaderNameEnum.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.util.HashMap; import java.util.Map; diff --git a/common/http/src/main/java/io/helidon/common/http/HeaderNameImpl.java b/http/http/src/main/java/io/helidon/http/HeaderNameImpl.java similarity index 97% rename from common/http/src/main/java/io/helidon/common/http/HeaderNameImpl.java rename to http/http/src/main/java/io/helidon/http/HeaderNameImpl.java index 153f60b4df6..cf1ff32e7a6 100644 --- a/common/http/src/main/java/io/helidon/common/http/HeaderNameImpl.java +++ b/http/http/src/main/java/io/helidon/http/HeaderNameImpl.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.util.Objects; diff --git a/common/http/src/main/java/io/helidon/common/http/HeaderValueArray.java b/http/http/src/main/java/io/helidon/http/HeaderValueArray.java similarity index 92% rename from common/http/src/main/java/io/helidon/common/http/HeaderValueArray.java rename to http/http/src/main/java/io/helidon/http/HeaderValueArray.java index 2967d71ba95..f61cea5dcf8 100644 --- a/common/http/src/main/java/io/helidon/common/http/HeaderValueArray.java +++ b/http/http/src/main/java/io/helidon/http/HeaderValueArray.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.util.ArrayList; import java.util.List; -import io.helidon.common.http.Http.HeaderName; +import io.helidon.http.Http.HeaderName; class HeaderValueArray extends HeaderValueBase { private final String[] originalValues; diff --git a/common/http/src/main/java/io/helidon/common/http/HeaderValueBase.java b/http/http/src/main/java/io/helidon/http/HeaderValueBase.java similarity index 95% rename from common/http/src/main/java/io/helidon/common/http/HeaderValueBase.java rename to http/http/src/main/java/io/helidon/http/HeaderValueBase.java index c40d6eab9bd..c627d6323e1 100644 --- a/common/http/src/main/java/io/helidon/common/http/HeaderValueBase.java +++ b/http/http/src/main/java/io/helidon/http/HeaderValueBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.util.Objects; -import io.helidon.common.http.Http.HeaderName; import io.helidon.common.mapper.MapperManager; +import io.helidon.http.Http.HeaderName; abstract class HeaderValueBase implements Http.HeaderValueWriteable { private static final MapperManager MAPPER_MANAGER = MapperManager.create(); diff --git a/common/http/src/main/java/io/helidon/common/http/HeaderValueCached.java b/http/http/src/main/java/io/helidon/http/HeaderValueCached.java similarity index 96% rename from common/http/src/main/java/io/helidon/common/http/HeaderValueCached.java rename to http/http/src/main/java/io/helidon/http/HeaderValueCached.java index 0b4526c3d0e..715f0120ee4 100644 --- a/common/http/src/main/java/io/helidon/common/http/HeaderValueCached.java +++ b/http/http/src/main/java/io/helidon/http/HeaderValueCached.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.nio.charset.StandardCharsets; import java.util.List; diff --git a/common/http/src/main/java/io/helidon/common/http/HeaderValueCopy.java b/http/http/src/main/java/io/helidon/http/HeaderValueCopy.java similarity index 97% rename from common/http/src/main/java/io/helidon/common/http/HeaderValueCopy.java rename to http/http/src/main/java/io/helidon/http/HeaderValueCopy.java index fcde92aba87..2e4b63dae30 100644 --- a/common/http/src/main/java/io/helidon/common/http/HeaderValueCopy.java +++ b/http/http/src/main/java/io/helidon/http/HeaderValueCopy.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.util.ArrayList; import java.util.List; diff --git a/common/http/src/main/java/io/helidon/common/http/HeaderValueLazy.java b/http/http/src/main/java/io/helidon/http/HeaderValueLazy.java similarity index 95% rename from common/http/src/main/java/io/helidon/common/http/HeaderValueLazy.java rename to http/http/src/main/java/io/helidon/http/HeaderValueLazy.java index a20b989c2f3..3250c1d0d0e 100644 --- a/common/http/src/main/java/io/helidon/common/http/HeaderValueLazy.java +++ b/http/http/src/main/java/io/helidon/http/HeaderValueLazy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.util.ArrayList; import java.util.List; diff --git a/common/http/src/main/java/io/helidon/common/http/HeaderValueList.java b/http/http/src/main/java/io/helidon/http/HeaderValueList.java similarity index 97% rename from common/http/src/main/java/io/helidon/common/http/HeaderValueList.java rename to http/http/src/main/java/io/helidon/http/HeaderValueList.java index a0a98e44c4f..af7ca5b8e4c 100644 --- a/common/http/src/main/java/io/helidon/common/http/HeaderValueList.java +++ b/http/http/src/main/java/io/helidon/http/HeaderValueList.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.util.ArrayList; import java.util.Collection; diff --git a/common/http/src/main/java/io/helidon/common/http/HeaderValueSingle.java b/http/http/src/main/java/io/helidon/http/HeaderValueSingle.java similarity index 94% rename from common/http/src/main/java/io/helidon/common/http/HeaderValueSingle.java rename to http/http/src/main/java/io/helidon/http/HeaderValueSingle.java index 9c947868e8b..6a2ecb8b426 100644 --- a/common/http/src/main/java/io/helidon/common/http/HeaderValueSingle.java +++ b/http/http/src/main/java/io/helidon/http/HeaderValueSingle.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.util.ArrayList; import java.util.List; diff --git a/common/http/src/main/java/io/helidon/common/http/Headers.java b/http/http/src/main/java/io/helidon/http/Headers.java similarity index 90% rename from common/http/src/main/java/io/helidon/common/http/Headers.java rename to http/http/src/main/java/io/helidon/http/Headers.java index f4f32a496af..95c12f2a082 100644 --- a/common/http/src/main/java/io/helidon/common/http/Headers.java +++ b/http/http/src/main/java/io/helidon/http/Headers.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.util.HashMap; import java.util.List; @@ -35,7 +35,7 @@ * case. * When you configure headers to be sent using HTTP/2, all names will be lowercase. * When you configure headers to be sent using HTTP/1, names will be sent as configured. - * When you receive headers, the stored values (as can be obtained by {@link io.helidon.common.http.Http.Header#name()}) + * When you receive headers, the stored values (as can be obtained by {@link io.helidon.http.Http.Header#name()}) * will be as sent on the transport. These value will be available using any cased names (though performance may be worse * if uppercase letters are used to obtain HTTP/2 headers). */ @@ -76,7 +76,7 @@ public interface Headers extends Iterable { /** * Returns a header value as a single {@link String} potentially concatenated using comma character - * from {@link #all(io.helidon.common.http.Http.HeaderName, java.util.function.Supplier)} header fields. + * from {@link #all(io.helidon.http.Http.HeaderName, java.util.function.Supplier)} header fields. *

* According to RFC2616, Message Headers: *

@@ -92,8 +92,8 @@ public interface Headers extends Iterable { * @param headerName the header name * @return all header values concatenated using comma separator * @throws NullPointerException if {@code headerName} is {@code null} - * @see #all(io.helidon.common.http.Http.HeaderName, java.util.function.Supplier) - * @see #values(io.helidon.common.http.Http.HeaderName) + * @see #all(io.helidon.http.Http.HeaderName, java.util.function.Supplier) + * @see #values(io.helidon.http.Http.HeaderName) */ default Optional value(Http.HeaderName headerName) { if (contains(headerName)) { @@ -130,8 +130,8 @@ default Optional first(Http.HeaderName headerName) { * @param headerName the header name * @return a {@code List} of values with zero or greater size, never {@code null} * @throws NullPointerException if {@code headerName} is {@code null} - * @see #all(io.helidon.common.http.Http.HeaderName, java.util.function.Supplier) - * @see #value(io.helidon.common.http.Http.HeaderName) + * @see #all(io.helidon.http.Http.HeaderName, java.util.function.Supplier) + * @see #value(io.helidon.http.Http.HeaderName) */ default List values(Http.HeaderName headerName) { return all(headerName, List::of) @@ -144,7 +144,7 @@ default List values(Http.HeaderName headerName) { * Content length if defined. * * @return content length or empty if not defined - * @see io.helidon.common.http.Http.HeaderNames#CONTENT_LENGTH + * @see io.helidon.http.Http.HeaderNames#CONTENT_LENGTH */ default OptionalLong contentLength() { if (contains(HeaderNameEnum.CONTENT_LENGTH)) { @@ -157,7 +157,7 @@ default OptionalLong contentLength() { * Content type (if defined). * * @return content type, empty if content type is not present - * @see io.helidon.common.http.Http.HeaderNames#CONTENT_TYPE + * @see io.helidon.http.Http.HeaderNames#CONTENT_TYPE */ default Optional contentType() { if (contains(HeaderNameEnum.CONTENT_TYPE)) { @@ -175,7 +175,7 @@ default Optional contentType() { int size(); /** - * Returns a list of acceptedTypes ({@link io.helidon.common.http.Http.HeaderNames#ACCEPT} header) content discoveryTypes in + * Returns a list of acceptedTypes ({@link io.helidon.http.Http.HeaderNames#ACCEPT} header) content discoveryTypes in * quality factor order. Never {@code null}. * Returns an empty list by default. * diff --git a/common/http/src/main/java/io/helidon/common/http/HeadersImpl.java b/http/http/src/main/java/io/helidon/http/HeadersImpl.java similarity index 97% rename from common/http/src/main/java/io/helidon/common/http/HeadersImpl.java rename to http/http/src/main/java/io/helidon/http/HeadersImpl.java index 70d11a9a2f2..194a3e4e6ef 100644 --- a/common/http/src/main/java/io/helidon/common/http/HeadersImpl.java +++ b/http/http/src/main/java/io/helidon/http/HeadersImpl.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.util.ArrayList; import java.util.Arrays; @@ -27,9 +27,9 @@ import java.util.function.Consumer; import java.util.function.Supplier; -import io.helidon.common.http.Http.Header; -import io.helidon.common.http.Http.HeaderName; -import io.helidon.common.http.Http.HeaderValueWriteable; +import io.helidon.http.Http.Header; +import io.helidon.http.Http.HeaderName; +import io.helidon.http.Http.HeaderValueWriteable; @SuppressWarnings("unchecked") class HeadersImpl> implements WritableHeaders { diff --git a/common/http/src/main/java/io/helidon/common/http/HtmlEncoder.java b/http/http/src/main/java/io/helidon/http/HtmlEncoder.java similarity index 93% rename from common/http/src/main/java/io/helidon/common/http/HtmlEncoder.java rename to http/http/src/main/java/io/helidon/http/HtmlEncoder.java index 6fcf390f0dc..75b7c47ae30 100644 --- a/common/http/src/main/java/io/helidon/common/http/HtmlEncoder.java +++ b/http/http/src/main/java/io/helidon/http/HtmlEncoder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ */ /* - * Copyright (c) 2021, 2022 Oracle and/or its affiliates. + * Copyright (c) 2021, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,7 +30,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; /** * HTML encoding of special characters to prevent cross site scripting (XSS) attacks. diff --git a/common/http/src/main/java/io/helidon/common/http/Http.java b/http/http/src/main/java/io/helidon/http/Http.java similarity index 98% rename from common/http/src/main/java/io/helidon/common/http/Http.java rename to http/http/src/main/java/io/helidon/http/Http.java index 9200357d97d..8499b2e9cb0 100644 --- a/common/http/src/main/java/io/helidon/common/http/Http.java +++ b/http/http/src/main/java/io/helidon/http/Http.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.nio.charset.StandardCharsets; import java.time.LocalDate; @@ -56,7 +56,7 @@ private Http() { } /** - * Interface representing an HTTP request method, all standard methods are in {@link io.helidon.common.http.Http.Method} + * Interface representing an HTTP request method, all standard methods are in {@link io.helidon.http.Http.Method} * enumeration. *

* Although the constants are instances of this class, they can be compared using instance equality, as the only @@ -65,7 +65,7 @@ private Http() { *

* Methods that are not known (e.g. there is no constant for them) must be compared using {@link #equals(Object)} as usual. * - * @see io.helidon.common.http.Http.Method + * @see io.helidon.http.Http.Method */ public static final class Method { private static final String GET_STRING = "GET"; @@ -164,7 +164,7 @@ private Method(String name, boolean instance) { /** * Create new HTTP request method instance from the provided name. *

- * In case the method name is recognized as one of the {@link io.helidon.common.http.Http.Method standard HTTP methods}, + * In case the method name is recognized as one of the {@link io.helidon.http.Http.Method standard HTTP methods}, * the respective enumeration * value is returned. * @@ -578,10 +578,10 @@ private Status(int statusCode, String reasonPhrase, Family family, String codeTe /** * Convert a numerical status code into the corresponding Status. *

- * For an unknown code, an ad-hoc {@link io.helidon.common.http.Http.Status} is created. + * For an unknown code, an ad-hoc {@link io.helidon.http.Http.Status} is created. * * @param statusCode the numerical status code - * @return the matching Status; either a constant from this class, or an ad-hoc {@link io.helidon.common.http.Http.Status} + * @return the matching Status; either a constant from this class, or an ad-hoc {@link io.helidon.http.Http.Status} */ public static Status create(int statusCode) { Status found = StatusHelper.find(statusCode); @@ -595,9 +595,9 @@ public static Status create(int statusCode) { /** * Convert a numerical status code into the corresponding Status. *

- * It either returns an existing {@link io.helidon.common.http.Http.Status} constant if possible. + * It either returns an existing {@link io.helidon.http.Http.Status} constant if possible. * For an unknown code, or code/reason phrase combination it creates - * an ad-hoc {@link io.helidon.common.http.Http.Status}. + * an ad-hoc {@link io.helidon.http.Http.Status}. * * @param statusCode the numerical status code * @param reasonPhrase the reason phrase; if {@code null} or a known reason phrase, an instance with the default @@ -786,9 +786,9 @@ default boolean isPseudoHeader() { } /** - * HTTP Header with {@link io.helidon.common.http.Http.HeaderName} and value. + * HTTP Header with {@link io.helidon.http.Http.HeaderName} and value. * - * @see io.helidon.common.http.Http.Headers + * @see io.helidon.http.Http.Headers */ public interface Header { @@ -1603,7 +1603,7 @@ public static Header createCached(HeaderName name, long value) { * @param name name of the header * @param value lazy string with the value * @return a new header - * @see #create(io.helidon.common.http.Http.HeaderName, boolean, boolean, String...) + * @see #create(io.helidon.http.Http.HeaderName, boolean, boolean, String...) */ public static Header create(HeaderName name, LazyString value) { Objects.requireNonNull(name); @@ -1618,7 +1618,7 @@ public static Header create(HeaderName name, LazyString value) { * @param name name of the header * @param value integer value of the header * @return a new header - * @see #create(io.helidon.common.http.Http.HeaderName, boolean, boolean, String...) + * @see #create(io.helidon.http.Http.HeaderName, boolean, boolean, String...) */ public static Header create(HeaderName name, int value) { Objects.requireNonNull(name); @@ -1632,7 +1632,7 @@ public static Header create(HeaderName name, int value) { * @param name name of the header * @param value long value of the header * @return a new header - * @see #create(io.helidon.common.http.Http.HeaderName, boolean, boolean, String...) + * @see #create(io.helidon.http.Http.HeaderName, boolean, boolean, String...) */ public static Header create(HeaderName name, long value) { Objects.requireNonNull(name); @@ -1646,7 +1646,7 @@ public static Header create(HeaderName name, long value) { * @param name name of the header * @param value value of the header * @return a new header - * @see #create(io.helidon.common.http.Http.HeaderName, boolean, boolean, String...) + * @see #create(io.helidon.http.Http.HeaderName, boolean, boolean, String...) */ public static Header create(HeaderName name, String value) { Objects.requireNonNull(name, "HeaderName must not be null"); @@ -1664,7 +1664,7 @@ public static Header create(HeaderName name, String value) { * @param name name of the header * @param value value of the header * @return a new header - * @see #create(io.helidon.common.http.Http.HeaderName, boolean, boolean, String...) + * @see #create(io.helidon.http.Http.HeaderName, boolean, boolean, String...) */ public static Header create(String name, String value) { Objects.requireNonNull(name, "Header name must not be null"); @@ -1678,7 +1678,7 @@ public static Header create(String name, String value) { * @param name name of the header * @param value value of the header * @return a new header - * @see #create(io.helidon.common.http.Http.HeaderName, boolean, boolean, String...) + * @see #create(io.helidon.http.Http.HeaderName, boolean, boolean, String...) */ public static Header create(String name, int value) { Objects.requireNonNull(name, "Header name must not be null"); @@ -1692,7 +1692,7 @@ public static Header create(String name, int value) { * @param name name of the header * @param value value of the header * @return a new header - * @see #create(io.helidon.common.http.Http.HeaderName, boolean, boolean, String...) + * @see #create(io.helidon.http.Http.HeaderName, boolean, boolean, String...) */ public static Header create(String name, long value) { Objects.requireNonNull(name, "Header name must not be null"); @@ -1706,7 +1706,7 @@ public static Header create(String name, long value) { * @param name name of the header * @param values values of the header * @return a new header - * @see #create(io.helidon.common.http.Http.HeaderName, boolean, boolean, String...) + * @see #create(io.helidon.http.Http.HeaderName, boolean, boolean, String...) */ public static Header create(HeaderName name, String... values) { if (values.length == 0) { @@ -1721,7 +1721,7 @@ public static Header create(HeaderName name, String... values) { * @param name name of the header * @param values values of the header * @return a new header - * @see #create(io.helidon.common.http.Http.HeaderName, boolean, boolean, String...) + * @see #create(io.helidon.http.Http.HeaderName, boolean, boolean, String...) */ public static Header create(String name, String... values) { return create(HeaderNames.create(name), values); @@ -1733,7 +1733,7 @@ public static Header create(String name, String... values) { * @param name name of the header * @param values values of the header * @return a new header - * @see #create(io.helidon.common.http.Http.HeaderName, boolean, boolean, String...) + * @see #create(io.helidon.http.Http.HeaderName, boolean, boolean, String...) */ public static Header create(HeaderName name, Collection values) { return new HeaderValueList(name, false, false, values); @@ -1745,7 +1745,7 @@ public static Header create(HeaderName name, Collection values) { * @param name name of the header * @param values values of the header * @return a new header - * @see #create(io.helidon.common.http.Http.HeaderName, boolean, boolean, String...) + * @see #create(io.helidon.http.Http.HeaderName, boolean, boolean, String...) */ public static Header create(String name, Collection values) { return create(HeaderNames.create(name), values); diff --git a/common/http/src/main/java/io/helidon/common/http/Http1HeadersParser.java b/http/http/src/main/java/io/helidon/http/Http1HeadersParser.java similarity index 99% rename from common/http/src/main/java/io/helidon/common/http/Http1HeadersParser.java rename to http/http/src/main/java/io/helidon/http/Http1HeadersParser.java index a2f8dfa3422..1051190db19 100644 --- a/common/http/src/main/java/io/helidon/common/http/Http1HeadersParser.java +++ b/http/http/src/main/java/io/helidon/http/Http1HeadersParser.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.nio.charset.StandardCharsets; diff --git a/common/http/src/main/java/io/helidon/common/http/HttpException.java b/http/http/src/main/java/io/helidon/http/HttpException.java similarity index 95% rename from common/http/src/main/java/io/helidon/common/http/HttpException.java rename to http/http/src/main/java/io/helidon/http/HttpException.java index f0580bda340..8314203288b 100644 --- a/common/http/src/main/java/io/helidon/common/http/HttpException.java +++ b/http/http/src/main/java/io/helidon/http/HttpException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022 Oracle and/or its affiliates. + * Copyright (c) 2018, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; /** * Runtime exception for applications. @@ -106,7 +106,7 @@ public final Http.Status status() { /** * Whether we should attempt to keep the connection alive (if enabled for it). - * Some exceptions may allow the connection to be further used (such as {@link io.helidon.common.http.NotFoundException}. + * Some exceptions may allow the connection to be further used (such as {@link NotFoundException}. * * @return whether to keep alive */ diff --git a/common/http/src/main/java/io/helidon/common/http/HttpMediaType.java b/http/http/src/main/java/io/helidon/http/HttpMediaType.java similarity index 95% rename from common/http/src/main/java/io/helidon/common/http/HttpMediaType.java rename to http/http/src/main/java/io/helidon/http/HttpMediaType.java index a3ac51d54c8..1eb2f945b91 100644 --- a/common/http/src/main/java/io/helidon/common/http/HttpMediaType.java +++ b/http/http/src/main/java/io/helidon/http/HttpMediaType.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.nio.charset.Charset; import java.util.Map; @@ -30,7 +30,7 @@ * Media type used in HTTP headers, in addition to the media type definition, these may contain additional * parameters, such as {@link #QUALITY_FACTOR_PARAMETER} and {@link #CHARSET_PARAMETER}. * - * @see io.helidon.common.http.HttpMediaTypes + * @see io.helidon.http.HttpMediaTypes */ public sealed interface HttpMediaType extends Predicate, Comparable, @@ -149,7 +149,7 @@ default String subtype() { } /** - * Create a new {@link io.helidon.common.http.HttpMediaType} instance with the same type, subtype and parameters + * Create a new {@link HttpMediaType} instance with the same type, subtype and parameters * copied from the original instance and the supplied {@value #CHARSET_PARAMETER} parameter. * * @param charset the {@value #CHARSET_PARAMETER} parameter value. If {@code null} or empty @@ -166,7 +166,7 @@ default HttpMediaType withCharset(String charset) { } /** - * Create a new {@link io.helidon.common.http.HttpMediaType} instance with the same type, subtype and parameters + * Create a new {@link HttpMediaType} instance with the same type, subtype and parameters * copied from the original instance and the supplied {@value #CHARSET_PARAMETER} parameter. * * @param charset the {@value #CHARSET_PARAMETER} parameter value @@ -185,7 +185,7 @@ default HttpMediaType withCharset(Charset charset) { String text(); /** - * Create a new {@link io.helidon.common.http.HttpMediaType} instance with the same type, subtype and parameters + * Create a new {@link HttpMediaType} instance with the same type, subtype and parameters * copied from the original instance and the supplied custom parameter. * * @param name name of the parameter @@ -202,7 +202,7 @@ default HttpMediaType withParameter(String name, String value) { } /** - * Fluent API builder for {@link io.helidon.common.http.HttpMediaType}. + * Fluent API builder for {@link HttpMediaType}. */ class Builder implements io.helidon.common.Builder { private final Map parameters = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); diff --git a/common/http/src/main/java/io/helidon/common/http/HttpMediaTypeImpl.java b/http/http/src/main/java/io/helidon/http/HttpMediaTypeImpl.java similarity index 98% rename from common/http/src/main/java/io/helidon/common/http/HttpMediaTypeImpl.java rename to http/http/src/main/java/io/helidon/http/HttpMediaTypeImpl.java index cc1e2826c71..3210bbc0dba 100644 --- a/common/http/src/main/java/io/helidon/common/http/HttpMediaTypeImpl.java +++ b/http/http/src/main/java/io/helidon/http/HttpMediaTypeImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.util.Map; import java.util.Objects; diff --git a/common/http/src/main/java/io/helidon/common/http/HttpMediaTypes.java b/http/http/src/main/java/io/helidon/http/HttpMediaTypes.java similarity index 95% rename from common/http/src/main/java/io/helidon/common/http/HttpMediaTypes.java rename to http/http/src/main/java/io/helidon/http/HttpMediaTypes.java index 1674d950240..c9f9bc8a25d 100644 --- a/common/http/src/main/java/io/helidon/common/http/HttpMediaTypes.java +++ b/http/http/src/main/java/io/helidon/http/HttpMediaTypes.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.util.function.Predicate; import io.helidon.common.media.type.MediaTypes; /** - * Constants for {@link io.helidon.common.http.HttpMediaType}. + * Constants for {@link io.helidon.http.HttpMediaType}. */ public final class HttpMediaTypes { /** diff --git a/common/http/src/main/java/io/helidon/common/http/HttpPrologue.java b/http/http/src/main/java/io/helidon/http/HttpPrologue.java similarity index 99% rename from common/http/src/main/java/io/helidon/common/http/HttpPrologue.java rename to http/http/src/main/java/io/helidon/http/HttpPrologue.java index a4819ae6b60..bfe9792cc6e 100644 --- a/common/http/src/main/java/io/helidon/common/http/HttpPrologue.java +++ b/http/http/src/main/java/io/helidon/http/HttpPrologue.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.util.Objects; diff --git a/common/http/src/main/java/io/helidon/common/http/HttpToken.java b/http/http/src/main/java/io/helidon/http/HttpToken.java similarity index 95% rename from common/http/src/main/java/io/helidon/common/http/HttpToken.java rename to http/http/src/main/java/io/helidon/http/HttpToken.java index 40b57d36c02..fc88cf2c7cb 100644 --- a/common/http/src/main/java/io/helidon/common/http/HttpToken.java +++ b/http/http/src/main/java/io/helidon/http/HttpToken.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; /** * HTTP Token utility. diff --git a/common/http/src/main/java/io/helidon/common/http/IntSet.java b/http/http/src/main/java/io/helidon/http/IntSet.java similarity index 96% rename from common/http/src/main/java/io/helidon/common/http/IntSet.java rename to http/http/src/main/java/io/helidon/http/IntSet.java index 8d96afb7ae0..2ea1c8e53c5 100644 --- a/common/http/src/main/java/io/helidon/common/http/IntSet.java +++ b/http/http/src/main/java/io/helidon/http/IntSet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; /** * A Set like implementation optimized for integers. diff --git a/common/http/src/main/java/io/helidon/common/http/InternalServerException.java b/http/http/src/main/java/io/helidon/http/InternalServerException.java similarity index 77% rename from common/http/src/main/java/io/helidon/common/http/InternalServerException.java rename to http/http/src/main/java/io/helidon/http/InternalServerException.java index e5c25b668ce..74ac5b0fb0d 100644 --- a/common/http/src/main/java/io/helidon/common/http/InternalServerException.java +++ b/http/http/src/main/java/io/helidon/http/InternalServerException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022 Oracle and/or its affiliates. + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; /** - * A runtime exception indicating a {@link io.helidon.common.http.Http.Status#INTERNAL_SERVER_ERROR_500 internal server error}. + * A runtime exception indicating a {@link Http.Status#INTERNAL_SERVER_ERROR_500 internal server error}. */ public class InternalServerException extends HttpException { /** - * Creates {@link io.helidon.common.http.InternalServerException}. + * Creates {@link InternalServerException}. * * @param message the message * @param cause the cause of this exception @@ -31,7 +31,7 @@ public InternalServerException(String message, Throwable cause) { } /** - * Creates {@link io.helidon.common.http.InternalServerException}. + * Creates {@link InternalServerException}. * * @param message the message * @param cause the cause of this exception diff --git a/common/http/src/main/java/io/helidon/common/http/MethodHelper.java b/http/http/src/main/java/io/helidon/http/MethodHelper.java similarity index 95% rename from common/http/src/main/java/io/helidon/common/http/MethodHelper.java rename to http/http/src/main/java/io/helidon/http/MethodHelper.java index 293ae7d5fd5..3897c409dc8 100644 --- a/common/http/src/main/java/io/helidon/common/http/MethodHelper.java +++ b/http/http/src/main/java/io/helidon/http/MethodHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.util.ArrayList; import java.util.List; diff --git a/common/http/src/main/java/io/helidon/common/http/MethodPredicates.java b/http/http/src/main/java/io/helidon/http/MethodPredicates.java similarity index 94% rename from common/http/src/main/java/io/helidon/common/http/MethodPredicates.java rename to http/http/src/main/java/io/helidon/http/MethodPredicates.java index 27bed67062c..b1564c5af70 100644 --- a/common/http/src/main/java/io/helidon/common/http/MethodPredicates.java +++ b/http/http/src/main/java/io/helidon/http/MethodPredicates.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.util.Set; -import io.helidon.common.http.Http.Method; -import io.helidon.common.http.Http.MethodPredicate; +import io.helidon.http.Http.Method; +import io.helidon.http.Http.MethodPredicate; class MethodPredicates { static class TruePredicate implements MethodPredicate { diff --git a/common/http/src/main/java/io/helidon/common/http/NotFoundException.java b/http/http/src/main/java/io/helidon/http/NotFoundException.java similarity index 93% rename from common/http/src/main/java/io/helidon/common/http/NotFoundException.java rename to http/http/src/main/java/io/helidon/http/NotFoundException.java index 522ed365757..d6fc847ca4c 100644 --- a/common/http/src/main/java/io/helidon/common/http/NotFoundException.java +++ b/http/http/src/main/java/io/helidon/http/NotFoundException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022 Oracle and/or its affiliates. + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; /** * A runtime exception indicating a {@link Http.Status#NOT_FOUND_404 not found}. diff --git a/common/http/src/main/java/io/helidon/common/http/PathMatcher.java b/http/http/src/main/java/io/helidon/http/PathMatcher.java similarity index 94% rename from common/http/src/main/java/io/helidon/common/http/PathMatcher.java rename to http/http/src/main/java/io/helidon/http/PathMatcher.java index bb528ddc489..fbfaf1ec6ef 100644 --- a/common/http/src/main/java/io/helidon/common/http/PathMatcher.java +++ b/http/http/src/main/java/io/helidon/http/PathMatcher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import io.helidon.common.uri.UriPath; diff --git a/common/http/src/main/java/io/helidon/common/http/PathMatchers.java b/http/http/src/main/java/io/helidon/http/PathMatchers.java similarity index 99% rename from common/http/src/main/java/io/helidon/common/http/PathMatchers.java rename to http/http/src/main/java/io/helidon/http/PathMatchers.java index 839b82de0b9..459bda78798 100644 --- a/common/http/src/main/java/io/helidon/common/http/PathMatchers.java +++ b/http/http/src/main/java/io/helidon/http/PathMatchers.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.util.Arrays; import java.util.HashMap; diff --git a/common/http/src/main/java/io/helidon/common/http/RequestException.java b/http/http/src/main/java/io/helidon/http/RequestException.java similarity index 96% rename from common/http/src/main/java/io/helidon/common/http/RequestException.java rename to http/http/src/main/java/io/helidon/http/RequestException.java index cf3ae50fb3d..a9c5bf758aa 100644 --- a/common/http/src/main/java/io/helidon/common/http/RequestException.java +++ b/http/http/src/main/java/io/helidon/http/RequestException.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; /** - * Exception that will be handled by {@link io.helidon.common.http.DirectHandler}, unless server request and server response + * Exception that will be handled by {@link DirectHandler}, unless server request and server response * are already available, in which case it would be handled by appropriate error handler of routing. * This exception is not used by clients. */ @@ -191,7 +191,7 @@ public Builder type(DirectHandler.EventType type) { /** * Http status to use. This will override default status from - * {@link io.helidon.common.http.DirectHandler.EventType#defaultStatus()}. + * {@link io.helidon.http.DirectHandler.EventType#defaultStatus()}. * * @param status status to use * @return updated builder diff --git a/common/http/src/main/java/io/helidon/common/http/RequestedUriDiscoveryContext.java b/http/http/src/main/java/io/helidon/http/RequestedUriDiscoveryContext.java similarity index 97% rename from common/http/src/main/java/io/helidon/common/http/RequestedUriDiscoveryContext.java rename to http/http/src/main/java/io/helidon/http/RequestedUriDiscoveryContext.java index e632821b76a..35a0c691710 100644 --- a/common/http/src/main/java/io/helidon/common/http/RequestedUriDiscoveryContext.java +++ b/http/http/src/main/java/io/helidon/http/RequestedUriDiscoveryContext.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.util.ArrayList; import java.util.List; @@ -460,20 +460,20 @@ private record XForwardedDiscovery(String scheme, String host, int port, String */ enum RequestedUriDiscoveryType { /** - * The {@code io.helidon.common.http.Http.Header#FORWARDED} header is used to discover the original requested URI. + * The {@code io.helidon.http.Http.Header#FORWARDED} header is used to discover the original requested URI. */ FORWARDED, /** * The - * {@code io.helidon.common.http.Http.Header#X_FORWARDED_PROTO}, - * {@code io.helidon.common.http.Http.Header#X_FORWARDED_HOST}, - * {@code io.helidon.common.http.Http.Header#X_FORWARDED_PORT}, - * {@code io.helidon.common.http.Http.Header#X_FORWARDED_PREFIX} + * {@code io.helidon.http.Http.Header#X_FORWARDED_PROTO}, + * {@code io.helidon.http.Http.Header#X_FORWARDED_HOST}, + * {@code io.helidon.http.Http.Header#X_FORWARDED_PORT}, + * {@code io.helidon.http.Http.Header#X_FORWARDED_PREFIX} * headers are used to discover the original requested URI. */ X_FORWARDED, /** - * This is the default, only the {@code io.helidon.common.http.Http.Header#HOST} header is used to discover + * This is the default, only the {@code io.helidon.http.Http.Header#HOST} header is used to discover * requested URI. */ HOST diff --git a/common/http/src/main/java/io/helidon/common/http/RoutedPath.java b/http/http/src/main/java/io/helidon/http/RoutedPath.java similarity index 94% rename from common/http/src/main/java/io/helidon/common/http/RoutedPath.java rename to http/http/src/main/java/io/helidon/http/RoutedPath.java index 7ab990bbe40..56327393e3a 100644 --- a/common/http/src/main/java/io/helidon/common/http/RoutedPath.java +++ b/http/http/src/main/java/io/helidon/http/RoutedPath.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import io.helidon.common.parameters.Parameters; import io.helidon.common.uri.UriPath; diff --git a/common/http/src/main/java/io/helidon/common/http/ServerRequestHeaders.java b/http/http/src/main/java/io/helidon/http/ServerRequestHeaders.java similarity index 89% rename from common/http/src/main/java/io/helidon/common/http/ServerRequestHeaders.java rename to http/http/src/main/java/io/helidon/http/ServerRequestHeaders.java index 82ee7df6358..fafea8126fa 100644 --- a/common/http/src/main/java/io/helidon/common/http/ServerRequestHeaders.java +++ b/http/http/src/main/java/io/helidon/http/ServerRequestHeaders.java @@ -14,17 +14,17 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.net.URI; import java.time.ZonedDateTime; import java.util.List; import java.util.Optional; -import io.helidon.common.http.Http.Header; import io.helidon.common.media.type.MediaType; import io.helidon.common.media.type.MediaTypes; import io.helidon.common.parameters.Parameters; +import io.helidon.http.Http.Header; /** * HTTP headers of a server request. @@ -70,11 +70,11 @@ static ServerRequestHeaders create() { } /** - * Optionally returns a value of {@link io.helidon.common.http.Http.HeaderNames#IF_MODIFIED_SINCE} header. + * Optionally returns a value of {@link io.helidon.http.Http.HeaderNames#IF_MODIFIED_SINCE} header. *

* Allows a 304 Not Modified to be returned if content is unchanged. * - * @return Content of {@link io.helidon.common.http.Http.HeaderNames#IF_MODIFIED_SINCE} header. + * @return Content of {@link io.helidon.http.Http.HeaderNames#IF_MODIFIED_SINCE} header. */ default Optional ifModifiedSince() { if (contains(Http.HeaderNames.IF_MODIFIED_SINCE)) { @@ -87,11 +87,11 @@ default Optional ifModifiedSince() { } /** - * Optionally returns a value of {@link io.helidon.common.http.Http.HeaderNames#IF_UNMODIFIED_SINCE} header. + * Optionally returns a value of {@link io.helidon.http.Http.HeaderNames#IF_UNMODIFIED_SINCE} header. *

* Only send the response if the entity has not been modified since a specific time. * - * @return Content of {@link io.helidon.common.http.Http.HeaderNames#IF_UNMODIFIED_SINCE} header. + * @return Content of {@link io.helidon.http.Http.HeaderNames#IF_UNMODIFIED_SINCE} header. */ default Optional ifUnmodifiedSince() { if (contains(Http.HeaderNames.IF_UNMODIFIED_SINCE)) { @@ -127,7 +127,7 @@ default boolean isAccepted(MediaType mediaType) { /** * Optionally returns a single media type from the given media types that is the * best one accepted by the client. - * Method uses content negotiation {@link io.helidon.common.http.Http.HeaderNames#ACCEPT} + * Method uses content negotiation {@link io.helidon.http.Http.HeaderNames#ACCEPT} * header parameter and returns an empty value in case nothing matches. * * @param mediaTypes media type candidates, never null @@ -180,7 +180,7 @@ default Parameters cookies() { } /** - * Optionally returns acceptedTypes version in time ({@link io.helidon.common.http.Http.HeaderNames#ACCEPT_DATETIME} header). + * Optionally returns acceptedTypes version in time ({@link io.helidon.http.Http.HeaderNames#ACCEPT_DATETIME} header). * * @return Acceptable version in time. */ @@ -194,7 +194,7 @@ default Optional acceptDatetime() { } /** - * Optionally returns request date ({@link io.helidon.common.http.Http.HeaderNames#DATE} header). + * Optionally returns request date ({@link io.helidon.http.Http.HeaderNames#DATE} header). * * @return Request date. */ @@ -208,7 +208,7 @@ default Optional date() { } /** - * Optionally returns the address of the previous web page (header {@link io.helidon.common.http.Http.HeaderNames#REFERER}) from which a link + * Optionally returns the address of the previous web page (header {@link io.helidon.http.Http.HeaderNames#REFERER}) from which a link * to the currently requested page was followed. *

* The word {@code referrer} has been misspelled in the RFC as well as in most implementations to the point that it diff --git a/common/http/src/main/java/io/helidon/common/http/ServerRequestHeadersImpl.java b/http/http/src/main/java/io/helidon/http/ServerRequestHeadersImpl.java similarity index 97% rename from common/http/src/main/java/io/helidon/common/http/ServerRequestHeadersImpl.java rename to http/http/src/main/java/io/helidon/http/ServerRequestHeadersImpl.java index 6e5aeeea428..6817d3697b9 100644 --- a/common/http/src/main/java/io/helidon/common/http/ServerRequestHeadersImpl.java +++ b/http/http/src/main/java/io/helidon/http/ServerRequestHeadersImpl.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.util.ArrayList; import java.util.Collections; @@ -23,8 +23,8 @@ import java.util.Optional; import java.util.function.Supplier; -import io.helidon.common.http.Http.HeaderName; import io.helidon.common.parameters.Parameters; +import io.helidon.http.Http.HeaderName; class ServerRequestHeadersImpl implements ServerRequestHeaders { private final Headers headers; diff --git a/common/http/src/main/java/io/helidon/common/http/ServerResponseHeaders.java b/http/http/src/main/java/io/helidon/http/ServerResponseHeaders.java similarity index 87% rename from common/http/src/main/java/io/helidon/common/http/ServerResponseHeaders.java rename to http/http/src/main/java/io/helidon/http/ServerResponseHeaders.java index d64e2f17a30..053844dd149 100644 --- a/common/http/src/main/java/io/helidon/common/http/ServerResponseHeaders.java +++ b/http/http/src/main/java/io/helidon/http/ServerResponseHeaders.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.net.URI; import java.time.Duration; @@ -24,9 +24,9 @@ import io.helidon.common.media.type.MediaType; -import static io.helidon.common.http.Http.HeaderNames.EXPIRES; -import static io.helidon.common.http.Http.HeaderNames.LAST_MODIFIED; -import static io.helidon.common.http.Http.HeaderNames.LOCATION; +import static io.helidon.http.Http.HeaderNames.EXPIRES; +import static io.helidon.http.Http.HeaderNames.LAST_MODIFIED; +import static io.helidon.http.Http.HeaderNames.LOCATION; /** * Mutable headers of a server response. @@ -55,7 +55,7 @@ static ServerResponseHeaders create(Headers existing) { /** * Adds one or more acceptedTypes path document formats - * (header {@link io.helidon.common.http.Http.HeaderNames#ACCEPT_PATCH}). + * (header {@link io.helidon.http.Http.HeaderNames#ACCEPT_PATCH}). * * @param acceptableMediaTypes media types to add. * @return this instance @@ -113,7 +113,7 @@ default ServerResponseHeaders addCookie(String name, String value) { ServerResponseHeaders clearCookie(String name); /** - * Sets the value of {@link io.helidon.common.http.Http.HeaderNames#LAST_MODIFIED} header. + * Sets the value of {@link io.helidon.http.Http.HeaderNames#LAST_MODIFIED} header. *

* The last modified date for the requested object * @@ -126,7 +126,7 @@ default ServerResponseHeaders lastModified(Instant modified) { } /** - * Sets the value of {@link io.helidon.common.http.Http.HeaderNames#LAST_MODIFIED} header. + * Sets the value of {@link io.helidon.http.Http.HeaderNames#LAST_MODIFIED} header. *

* The last modified date for the requested object * @@ -138,7 +138,7 @@ default ServerResponseHeaders lastModified(ZonedDateTime modified) { } /** - * Sets the value of {@link io.helidon.common.http.Http.HeaderNames#LOCATION} header. + * Sets the value of {@link io.helidon.http.Http.HeaderNames#LOCATION} header. *

* Used in redirection, or when a new resource has been created. * @@ -150,7 +150,7 @@ default ServerResponseHeaders location(URI location) { } /** - * Sets the value of {@link io.helidon.common.http.Http.HeaderNames#EXPIRES} header. + * Sets the value of {@link io.helidon.http.Http.HeaderNames#EXPIRES} header. *

* The date/time after which the response is considered stale. * @@ -162,7 +162,7 @@ default ServerResponseHeaders expires(ZonedDateTime dateTime) { } /** - * Sets the value of {@link io.helidon.common.http.Http.HeaderNames#EXPIRES} header. + * Sets the value of {@link io.helidon.http.Http.HeaderNames#EXPIRES} header. *

* The date/time after which the response is considered stale. * diff --git a/common/http/src/main/java/io/helidon/common/http/ServerResponseHeadersImpl.java b/http/http/src/main/java/io/helidon/http/ServerResponseHeadersImpl.java similarity index 98% rename from common/http/src/main/java/io/helidon/common/http/ServerResponseHeadersImpl.java rename to http/http/src/main/java/io/helidon/http/ServerResponseHeadersImpl.java index ffefb0241b7..29f78e59094 100644 --- a/common/http/src/main/java/io/helidon/common/http/ServerResponseHeadersImpl.java +++ b/http/http/src/main/java/io/helidon/http/ServerResponseHeadersImpl.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.time.ZoneId; import java.time.ZonedDateTime; diff --git a/common/http/src/main/java/io/helidon/common/http/SetCookie.java b/http/http/src/main/java/io/helidon/http/SetCookie.java similarity index 99% rename from common/http/src/main/java/io/helidon/common/http/SetCookie.java rename to http/http/src/main/java/io/helidon/http/SetCookie.java index efe30fc2dff..36c36ea7b12 100644 --- a/common/http/src/main/java/io/helidon/common/http/SetCookie.java +++ b/http/http/src/main/java/io/helidon/http/SetCookie.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022 Oracle and/or its affiliates. + * Copyright (c) 2018, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.net.URI; import java.time.Duration; diff --git a/common/http/src/main/java/io/helidon/common/http/StatusHelper.java b/http/http/src/main/java/io/helidon/http/StatusHelper.java similarity index 94% rename from common/http/src/main/java/io/helidon/common/http/StatusHelper.java rename to http/http/src/main/java/io/helidon/http/StatusHelper.java index 0ce802ee147..a77de58e3c9 100644 --- a/common/http/src/main/java/io/helidon/common/http/StatusHelper.java +++ b/http/http/src/main/java/io/helidon/http/StatusHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.util.ArrayList; import java.util.List; diff --git a/http/http/src/main/java/io/helidon/http/UnauthorizedException.java b/http/http/src/main/java/io/helidon/http/UnauthorizedException.java new file mode 100644 index 00000000000..f52e4ed0ea2 --- /dev/null +++ b/http/http/src/main/java/io/helidon/http/UnauthorizedException.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.http; + +import static io.helidon.http.Http.Status.UNAUTHORIZED_401; + +/** + * A runtime exception indicating a {@link Http.Status#UNAUTHORIZED_401 unauthorized}. + */ +public class UnauthorizedException extends HttpException { + + /** + * Creates {@link UnauthorizedException}. + * + * @param message the message + */ + public UnauthorizedException(String message) { + super(message, UNAUTHORIZED_401, null, true); + } + + /** + * Creates {@link UnauthorizedException}. + * + * @param message the message + * @param cause the cause of this exception + */ + public UnauthorizedException(String message, Throwable cause) { + super(message, UNAUTHORIZED_401, cause, true); + } +} diff --git a/common/http/src/main/java/io/helidon/common/http/Utils.java b/http/http/src/main/java/io/helidon/http/Utils.java similarity index 98% rename from common/http/src/main/java/io/helidon/common/http/Utils.java rename to http/http/src/main/java/io/helidon/http/Utils.java index 89b5176e877..28b1da8c65a 100644 --- a/common/http/src/main/java/io/helidon/common/http/Utils.java +++ b/http/http/src/main/java/io/helidon/http/Utils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022 Oracle and/or its affiliates. + * Copyright (c) 2018, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.io.IOException; import java.io.OutputStream; diff --git a/common/http/src/main/java/io/helidon/common/http/WritableHeaders.java b/http/http/src/main/java/io/helidon/http/WritableHeaders.java similarity index 91% rename from common/http/src/main/java/io/helidon/common/http/WritableHeaders.java rename to http/http/src/main/java/io/helidon/http/WritableHeaders.java index e023bf26eed..3be2232417b 100644 --- a/common/http/src/main/java/io/helidon/common/http/WritableHeaders.java +++ b/http/http/src/main/java/io/helidon/http/WritableHeaders.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.util.Collection; import java.util.function.Consumer; -import io.helidon.common.http.Http.Header; -import io.helidon.common.http.Http.HeaderName; import io.helidon.common.media.type.MediaType; +import io.helidon.http.Http.Header; +import io.helidon.http.Http.HeaderName; /** * HTTP Headers that are mutable. @@ -118,7 +118,7 @@ default B add(HeaderName header, long value) { /** * Sets the MIME type of the response body. * - * @param contentType Media type of the content, {@link io.helidon.common.http.HttpMediaType} may be used to add parameters + * @param contentType Media type of the content, {@link io.helidon.http.HttpMediaType} may be used to add parameters * @return this instance */ default B contentType(MediaType contentType) { @@ -135,7 +135,7 @@ default B contentType(MediaType contentType) { /** * Set a header and replace it if it already existed. - * Use {@link #set(io.helidon.common.http.Http.Header)} for headers that are known in advance (use a constant), + * Use {@link #set(io.helidon.http.Http.Header)} for headers that are known in advance (use a constant), * or for headers obtained from Helidon server or client. This method is intended for headers that are unknown or change * value often. * @@ -150,7 +150,7 @@ default B set(HeaderName name, String... values) { /** * Set a header and replace it if it already existed. - * Use {@link #set(io.helidon.common.http.Http.Header)} for headers that are known in advance (use a constant), + * Use {@link #set(io.helidon.http.Http.Header)} for headers that are known in advance (use a constant), * or for headers obtained from Helidon server or client. This method is intended for headers that are unknown or change * value often. * @@ -164,7 +164,7 @@ default B set(HeaderName name, int value) { /** * Set a header and replace it if it already existed. - * Use {@link #set(io.helidon.common.http.Http.Header)} for headers that are known in advance (use a constant), + * Use {@link #set(io.helidon.http.Http.Header)} for headers that are known in advance (use a constant), * or for headers obtained from Helidon server or client. This method is intended for headers that are unknown or change * value often. * @@ -178,7 +178,7 @@ default B set(HeaderName name, long value) { /** * Set a header and replace it if it already existed. - * Use {@link #set(io.helidon.common.http.Http.Header)} for headers that are known in advance (use a constant), + * Use {@link #set(io.helidon.http.Http.Header)} for headers that are known in advance (use a constant), * or for headers obtained from Helidon server or client. This method is intended for headers that are unknown or change * value often. * diff --git a/http/http/src/main/java/io/helidon/http/package-info.java b/http/http/src/main/java/io/helidon/http/package-info.java new file mode 100644 index 00000000000..e4c117bc2aa --- /dev/null +++ b/http/http/src/main/java/io/helidon/http/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2018, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * HTTP APIs and implementations usable by both server and client side of the HTTP story. + */ +package io.helidon.http; diff --git a/http/http/src/main/java/module-info.java b/http/http/src/main/java/module-info.java new file mode 100644 index 00000000000..ad351ef2115 --- /dev/null +++ b/http/http/src/main/java/module-info.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2018, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon Common HTTP classes. + */ +module io.helidon.http { + requires transitive io.helidon.common; + requires transitive io.helidon.common.configurable; + requires transitive io.helidon.common.mapper; + requires transitive io.helidon.common.buffers; + requires transitive io.helidon.common.media.type; + requires transitive io.helidon.common.uri; + requires static io.helidon.config.metadata; + + exports io.helidon.http; +} diff --git a/common/http/src/test/java/io/helidon/common/http/ContentDispositionTest.java b/http/http/src/test/java/io/helidon/http/ContentDispositionTest.java similarity index 99% rename from common/http/src/test/java/io/helidon/common/http/ContentDispositionTest.java rename to http/http/src/test/java/io/helidon/http/ContentDispositionTest.java index bbe5c44ccbf..85dc4b8f5ad 100644 --- a/common/http/src/test/java/io/helidon/common/http/ContentDispositionTest.java +++ b/http/http/src/test/java/io/helidon/http/ContentDispositionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.time.ZoneId; import java.time.ZonedDateTime; diff --git a/common/http/src/test/java/io/helidon/common/http/CookieParserTest.java b/http/http/src/test/java/io/helidon/http/CookieParserTest.java similarity index 96% rename from common/http/src/test/java/io/helidon/common/http/CookieParserTest.java rename to http/http/src/test/java/io/helidon/http/CookieParserTest.java index 62e5a59e7fc..bc6a6e29220 100644 --- a/common/http/src/test/java/io/helidon/common/http/CookieParserTest.java +++ b/http/http/src/test/java/io/helidon/http/CookieParserTest.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import io.helidon.common.parameters.Parameters; import org.junit.jupiter.api.Test; -import static io.helidon.common.http.Http.HeaderNames.COOKIE; +import static io.helidon.http.Http.HeaderNames.COOKIE; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.MatcherAssert.assertThat; diff --git a/common/http/src/test/java/io/helidon/common/http/DataChunkTest.java b/http/http/src/test/java/io/helidon/http/DataChunkTest.java similarity index 96% rename from common/http/src/test/java/io/helidon/common/http/DataChunkTest.java rename to http/http/src/test/java/io/helidon/http/DataChunkTest.java index d3d0a732b17..f2d75871019 100644 --- a/common/http/src/test/java/io/helidon/common/http/DataChunkTest.java +++ b/http/http/src/test/java/io/helidon/http/DataChunkTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021 Oracle and/or its affiliates. + * Copyright (c) 2018, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; diff --git a/common/http/src/test/java/io/helidon/common/http/DateTimeTest.java b/http/http/src/test/java/io/helidon/http/DateTimeTest.java similarity index 97% rename from common/http/src/test/java/io/helidon/common/http/DateTimeTest.java rename to http/http/src/test/java/io/helidon/http/DateTimeTest.java index 231ae23da5d..9c0bc8f8e53 100644 --- a/common/http/src/test/java/io/helidon/common/http/DateTimeTest.java +++ b/http/http/src/test/java/io/helidon/http/DateTimeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021 Oracle and/or its affiliates. + * Copyright (c) 2018, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.time.LocalDate; import java.time.ZoneId; diff --git a/common/http/src/test/java/io/helidon/common/http/ForwardedTest.java b/http/http/src/test/java/io/helidon/http/ForwardedTest.java similarity index 99% rename from common/http/src/test/java/io/helidon/common/http/ForwardedTest.java rename to http/http/src/test/java/io/helidon/http/ForwardedTest.java index 36e5a180d28..0564e14f04d 100644 --- a/common/http/src/test/java/io/helidon/common/http/ForwardedTest.java +++ b/http/http/src/test/java/io/helidon/http/ForwardedTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.util.List; diff --git a/common/http/src/test/java/io/helidon/common/http/HeaderNamesTest.java b/http/http/src/test/java/io/helidon/http/HeaderNamesTest.java similarity index 99% rename from common/http/src/test/java/io/helidon/common/http/HeaderNamesTest.java rename to http/http/src/test/java/io/helidon/http/HeaderNamesTest.java index 4a2b5ee8e7e..5f309c8917c 100644 --- a/common/http/src/test/java/io/helidon/common/http/HeaderNamesTest.java +++ b/http/http/src/test/java/io/helidon/http/HeaderNamesTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.lang.reflect.Field; import java.lang.reflect.Modifier; diff --git a/common/http/src/test/java/io/helidon/common/http/HtmlEncoderTest.java b/http/http/src/test/java/io/helidon/http/HtmlEncoderTest.java similarity index 92% rename from common/http/src/test/java/io/helidon/common/http/HtmlEncoderTest.java rename to http/http/src/test/java/io/helidon/http/HtmlEncoderTest.java index 7e4566b6f99..d89ad9a95f4 100644 --- a/common/http/src/test/java/io/helidon/common/http/HtmlEncoderTest.java +++ b/http/http/src/test/java/io/helidon/http/HtmlEncoderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import org.junit.jupiter.api.Test; diff --git a/common/http/src/test/java/io/helidon/common/http/Http1HeadersParserTest.java b/http/http/src/test/java/io/helidon/http/Http1HeadersParserTest.java similarity index 99% rename from common/http/src/test/java/io/helidon/common/http/Http1HeadersParserTest.java rename to http/http/src/test/java/io/helidon/http/Http1HeadersParserTest.java index a3a49871156..dfb124857db 100644 --- a/common/http/src/test/java/io/helidon/common/http/Http1HeadersParserTest.java +++ b/http/http/src/test/java/io/helidon/http/Http1HeadersParserTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.nio.charset.StandardCharsets; import java.util.stream.Stream; diff --git a/common/http/src/test/java/io/helidon/common/http/HttpMediaTypeImplTest.java b/http/http/src/test/java/io/helidon/http/HttpMediaTypeImplTest.java similarity index 97% rename from common/http/src/test/java/io/helidon/common/http/HttpMediaTypeImplTest.java rename to http/http/src/test/java/io/helidon/http/HttpMediaTypeImplTest.java index f9bc589479c..eaad1afc27b 100644 --- a/common/http/src/test/java/io/helidon/common/http/HttpMediaTypeImplTest.java +++ b/http/http/src/test/java/io/helidon/http/HttpMediaTypeImplTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.util.ArrayList; import java.util.Collections; diff --git a/common/http/src/test/java/io/helidon/common/http/HttpMethodTest.java b/http/http/src/test/java/io/helidon/http/HttpMethodTest.java similarity index 96% rename from common/http/src/test/java/io/helidon/common/http/HttpMethodTest.java rename to http/http/src/test/java/io/helidon/http/HttpMethodTest.java index ec45e5ece76..a9c0eeb9063 100644 --- a/common/http/src/test/java/io/helidon/common/http/HttpMethodTest.java +++ b/http/http/src/test/java/io/helidon/http/HttpMethodTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.lang.reflect.Field; import java.lang.reflect.Modifier; diff --git a/common/http/src/test/java/io/helidon/common/http/HttpPrologueTest.java b/http/http/src/test/java/io/helidon/http/HttpPrologueTest.java similarity index 97% rename from common/http/src/test/java/io/helidon/common/http/HttpPrologueTest.java rename to http/http/src/test/java/io/helidon/http/HttpPrologueTest.java index baac2230851..d0c510fcc4b 100644 --- a/common/http/src/test/java/io/helidon/common/http/HttpPrologueTest.java +++ b/http/http/src/test/java/io/helidon/http/HttpPrologueTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import org.junit.jupiter.api.Test; diff --git a/common/http/src/test/java/io/helidon/common/http/HttpStatusTest.java b/http/http/src/test/java/io/helidon/http/HttpStatusTest.java similarity index 97% rename from common/http/src/test/java/io/helidon/common/http/HttpStatusTest.java rename to http/http/src/test/java/io/helidon/http/HttpStatusTest.java index bd35cd72ed7..7733a735822 100644 --- a/common/http/src/test/java/io/helidon/common/http/HttpStatusTest.java +++ b/http/http/src/test/java/io/helidon/http/HttpStatusTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.lang.reflect.Field; import java.lang.reflect.Modifier; diff --git a/common/http/src/test/java/io/helidon/common/http/HttpTest.java b/http/http/src/test/java/io/helidon/http/HttpTest.java similarity index 79% rename from common/http/src/test/java/io/helidon/common/http/HttpTest.java rename to http/http/src/test/java/io/helidon/http/HttpTest.java index 9d32a116c92..7bc8153963c 100644 --- a/common/http/src/test/java/io/helidon/common/http/HttpTest.java +++ b/http/http/src/test/java/io/helidon/http/HttpTest.java @@ -14,17 +14,18 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.util.stream.Stream; +import org.hamcrest.CoreMatchers; +import org.hamcrest.MatcherAssert; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -import static io.helidon.common.http.Http.Status.TEMPORARY_REDIRECT_307; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.sameInstance; @@ -37,25 +38,25 @@ class HttpTest { @Test void testStatusIsStatus() { - Http.Status rs = Http.Status.create(TEMPORARY_REDIRECT_307.code()); - assertThat(rs, sameInstance(TEMPORARY_REDIRECT_307)); + Http.Status rs = Http.Status.create(Http.Status.TEMPORARY_REDIRECT_307.code()); + assertThat(rs, sameInstance(Http.Status.TEMPORARY_REDIRECT_307)); } @Test void testStatusWithReasonIsStatus() { Http.Status rs = Http.Status - .create(TEMPORARY_REDIRECT_307.code(), TEMPORARY_REDIRECT_307.reasonPhrase().toUpperCase()); - assertThat(rs, sameInstance(TEMPORARY_REDIRECT_307)); + .create(Http.Status.TEMPORARY_REDIRECT_307.code(), Http.Status.TEMPORARY_REDIRECT_307.reasonPhrase().toUpperCase()); + assertThat(rs, sameInstance(Http.Status.TEMPORARY_REDIRECT_307)); } @Test void testResposneStatusCustomReason() { Http.Status rs = Http.Status - .create(TEMPORARY_REDIRECT_307.code(), "Custom reason phrase"); - assertThat(rs, not(TEMPORARY_REDIRECT_307)); + .create(Http.Status.TEMPORARY_REDIRECT_307.code(), "Custom reason phrase"); + assertThat(rs, CoreMatchers.not(Http.Status.TEMPORARY_REDIRECT_307)); assertThat(rs.reasonPhrase(), is("Custom reason phrase")); - assertThat(rs.code(), is(TEMPORARY_REDIRECT_307.code())); - assertThat(rs.family(), is(TEMPORARY_REDIRECT_307.family())); + MatcherAssert.assertThat(rs.code(), CoreMatchers.is(Http.Status.TEMPORARY_REDIRECT_307.code())); + MatcherAssert.assertThat(rs.family(), CoreMatchers.is(Http.Status.TEMPORARY_REDIRECT_307.family())); } @ParameterizedTest diff --git a/common/http/src/test/java/io/helidon/common/http/IntSetTest.java b/http/http/src/test/java/io/helidon/http/IntSetTest.java similarity index 94% rename from common/http/src/test/java/io/helidon/common/http/IntSetTest.java rename to http/http/src/test/java/io/helidon/http/IntSetTest.java index 41c4b0ff432..75d340ae215 100644 --- a/common/http/src/test/java/io/helidon/common/http/IntSetTest.java +++ b/http/http/src/test/java/io/helidon/http/IntSetTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.util.HashSet; import java.util.Random; diff --git a/common/http/src/test/java/io/helidon/common/http/MediaTypeTest.java b/http/http/src/test/java/io/helidon/http/MediaTypeTest.java similarity index 99% rename from common/http/src/test/java/io/helidon/common/http/MediaTypeTest.java rename to http/http/src/test/java/io/helidon/http/MediaTypeTest.java index 1c783ffeb6b..9b6f1bc36a9 100644 --- a/common/http/src/test/java/io/helidon/common/http/MediaTypeTest.java +++ b/http/http/src/test/java/io/helidon/http/MediaTypeTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.util.Map; import java.util.Optional; diff --git a/common/http/src/test/java/io/helidon/common/http/SetCookieTest.java b/http/http/src/test/java/io/helidon/http/SetCookieTest.java similarity index 95% rename from common/http/src/test/java/io/helidon/common/http/SetCookieTest.java rename to http/http/src/test/java/io/helidon/http/SetCookieTest.java index da15367c025..956addb3ad4 100644 --- a/common/http/src/test/java/io/helidon/common/http/SetCookieTest.java +++ b/http/http/src/test/java/io/helidon/http/SetCookieTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Oracle and/or its affiliates. + * Copyright (c) 2020, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import org.junit.jupiter.api.Test; diff --git a/common/http/src/test/java/io/helidon/common/http/UtilsTest.java b/http/http/src/test/java/io/helidon/http/UtilsTest.java similarity index 96% rename from common/http/src/test/java/io/helidon/common/http/UtilsTest.java rename to http/http/src/test/java/io/helidon/http/UtilsTest.java index cbd361dfdbc..076a7d6360f 100644 --- a/common/http/src/test/java/io/helidon/common/http/UtilsTest.java +++ b/http/http/src/test/java/io/helidon/http/UtilsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021 Oracle and/or its affiliates. + * Copyright (c) 2018, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.common.http; +package io.helidon.http; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; diff --git a/nima/http2/README.md b/http/http2/README.md similarity index 100% rename from nima/http2/README.md rename to http/http2/README.md diff --git a/http/http2/pom.xml b/http/http2/pom.xml new file mode 100644 index 00000000000..ba0a1452a70 --- /dev/null +++ b/http/http2/pom.xml @@ -0,0 +1,65 @@ + + + + 4.0.0 + + io.helidon.http + helidon-http-project + 4.0.0-SNAPSHOT + + + helidon-http-http2 + Helidon HTTP HTTP/2 + + + + io.helidon.http + helidon-http + + + io.helidon.common + helidon-common-socket + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + org.junit.jupiter + junit-jupiter-params + test + + + io.helidon.logging + helidon-logging-jul + test + + + org.mockito + mockito-core + test + + + diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/ConnectionFlowControl.java b/http/http2/src/main/java/io/helidon/http/http2/ConnectionFlowControl.java similarity index 99% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/ConnectionFlowControl.java rename to http/http2/src/main/java/io/helidon/http/http2/ConnectionFlowControl.java index d919a4a8932..998ae16b10a 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/ConnectionFlowControl.java +++ b/http/http2/src/main/java/io/helidon/http/http2/ConnectionFlowControl.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import java.time.Duration; import java.util.function.BiConsumer; diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/FlowControl.java b/http/http2/src/main/java/io/helidon/http/http2/FlowControl.java similarity index 98% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/FlowControl.java rename to http/http2/src/main/java/io/helidon/http/http2/FlowControl.java index ceaa4d20192..2bbf8b4482c 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/FlowControl.java +++ b/http/http2/src/main/java/io/helidon/http/http2/FlowControl.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; /** * Flow control used by HTTP/2 for backpressure. diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/FlowControlImpl.java b/http/http2/src/main/java/io/helidon/http/http2/FlowControlImpl.java similarity index 99% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/FlowControlImpl.java rename to http/http2/src/main/java/io/helidon/http/http2/FlowControlImpl.java index 14f5d29c75f..fbcf604a354 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/FlowControlImpl.java +++ b/http/http2/src/main/java/io/helidon/http/http2/FlowControlImpl.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import java.util.Objects; import java.util.function.BiConsumer; diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/FlowControlNoop.java b/http/http2/src/main/java/io/helidon/http/http2/FlowControlNoop.java similarity index 98% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/FlowControlNoop.java rename to http/http2/src/main/java/io/helidon/http/http2/FlowControlNoop.java index 14296f8fc8c..4b710e495d0 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/FlowControlNoop.java +++ b/http/http2/src/main/java/io/helidon/http/http2/FlowControlNoop.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import java.util.function.BiConsumer; diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2ConnectionWriter.java b/http/http2/src/main/java/io/helidon/http/http2/Http2ConnectionWriter.java similarity index 99% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2ConnectionWriter.java rename to http/http2/src/main/java/io/helidon/http/http2/Http2ConnectionWriter.java index b2b6f294a7a..75536aff36a 100755 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2ConnectionWriter.java +++ b/http/http2/src/main/java/io/helidon/http/http2/Http2ConnectionWriter.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import java.util.List; import java.util.concurrent.Callable; diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Continuation.java b/http/http2/src/main/java/io/helidon/http/http2/Http2Continuation.java similarity index 98% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Continuation.java rename to http/http2/src/main/java/io/helidon/http/http2/Http2Continuation.java index 273f09abef2..511be4c2dcd 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Continuation.java +++ b/http/http2/src/main/java/io/helidon/http/http2/Http2Continuation.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import io.helidon.common.buffers.BufferData; diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2DataFrame.java b/http/http2/src/main/java/io/helidon/http/http2/Http2DataFrame.java similarity index 98% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2DataFrame.java rename to http/http2/src/main/java/io/helidon/http/http2/Http2DataFrame.java index b597567fde1..5e2a177aaea 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2DataFrame.java +++ b/http/http2/src/main/java/io/helidon/http/http2/Http2DataFrame.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import io.helidon.common.buffers.BufferData; diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2ErrorCode.java b/http/http2/src/main/java/io/helidon/http/http2/Http2ErrorCode.java similarity index 99% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2ErrorCode.java rename to http/http2/src/main/java/io/helidon/http/http2/Http2ErrorCode.java index 59888524995..4cea7e2acf2 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2ErrorCode.java +++ b/http/http2/src/main/java/io/helidon/http/http2/Http2ErrorCode.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import java.util.HashMap; import java.util.Map; diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Exception.java b/http/http2/src/main/java/io/helidon/http/http2/Http2Exception.java similarity index 94% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Exception.java rename to http/http2/src/main/java/io/helidon/http/http2/Http2Exception.java index 1ed764dffa1..25f480f2e69 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Exception.java +++ b/http/http2/src/main/java/io/helidon/http/http2/Http2Exception.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; /** * HTTP/2 exception. diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Flag.java b/http/http2/src/main/java/io/helidon/http/http2/Http2Flag.java similarity index 98% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Flag.java rename to http/http2/src/main/java/io/helidon/http/http2/Http2Flag.java index 325a26790ea..4337ceabcd2 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Flag.java +++ b/http/http2/src/main/java/io/helidon/http/http2/Http2Flag.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import java.util.LinkedList; import java.util.List; diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Frame.java b/http/http2/src/main/java/io/helidon/http/http2/Http2Frame.java similarity index 98% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Frame.java rename to http/http2/src/main/java/io/helidon/http/http2/Http2Frame.java index 631e3378058..9123006e4b5 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Frame.java +++ b/http/http2/src/main/java/io/helidon/http/http2/Http2Frame.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; /** * HTTP/2 frame. diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2FrameData.java b/http/http2/src/main/java/io/helidon/http/http2/Http2FrameData.java similarity index 99% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2FrameData.java rename to http/http2/src/main/java/io/helidon/http/http2/Http2FrameData.java index 6cac83d87d3..9f6dc31e34b 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2FrameData.java +++ b/http/http2/src/main/java/io/helidon/http/http2/Http2FrameData.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import io.helidon.common.buffers.BufferData; diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2FrameHeader.java b/http/http2/src/main/java/io/helidon/http/http2/Http2FrameHeader.java similarity index 98% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2FrameHeader.java rename to http/http2/src/main/java/io/helidon/http/http2/Http2FrameHeader.java index 52436488152..4b92f71c2e6 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2FrameHeader.java +++ b/http/http2/src/main/java/io/helidon/http/http2/Http2FrameHeader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import io.helidon.common.buffers.BufferData; diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2FrameListener.java b/http/http2/src/main/java/io/helidon/http/http2/Http2FrameListener.java similarity index 99% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2FrameListener.java rename to http/http2/src/main/java/io/helidon/http/http2/Http2FrameListener.java index 0eb30dde8c8..ed10141592b 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2FrameListener.java +++ b/http/http2/src/main/java/io/helidon/http/http2/Http2FrameListener.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import java.util.List; diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2FrameListenerUtil.java b/http/http2/src/main/java/io/helidon/http/http2/Http2FrameListenerUtil.java similarity index 99% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2FrameListenerUtil.java rename to http/http2/src/main/java/io/helidon/http/http2/Http2FrameListenerUtil.java index 772bf80fba1..24e28ed36c2 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2FrameListenerUtil.java +++ b/http/http2/src/main/java/io/helidon/http/http2/Http2FrameListenerUtil.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import java.util.List; diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2FrameType.java b/http/http2/src/main/java/io/helidon/http/http2/Http2FrameType.java similarity index 96% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2FrameType.java rename to http/http2/src/main/java/io/helidon/http/http2/Http2FrameType.java index 5aba9f94bcf..b2961ac55ff 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2FrameType.java +++ b/http/http2/src/main/java/io/helidon/http/http2/Http2FrameType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import java.util.HashMap; import java.util.Map; diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2FrameTypeUtil.java b/http/http2/src/main/java/io/helidon/http/http2/Http2FrameTypeUtil.java similarity index 96% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2FrameTypeUtil.java rename to http/http2/src/main/java/io/helidon/http/http2/Http2FrameTypeUtil.java index f716200c001..d43f0a1dda3 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2FrameTypeUtil.java +++ b/http/http2/src/main/java/io/helidon/http/http2/Http2FrameTypeUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import java.util.EnumMap; import java.util.Map; diff --git a/http/http2/src/main/java/io/helidon/http/http2/Http2FrameTypes.java b/http/http2/src/main/java/io/helidon/http/http2/Http2FrameTypes.java new file mode 100644 index 00000000000..c2b4cae3870 --- /dev/null +++ b/http/http2/src/main/java/io/helidon/http/http2/Http2FrameTypes.java @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.http.http2; + +import io.helidon.http.http2.Http2Flag.ContinuationFlags; +import io.helidon.http.http2.Http2Flag.DataFlags; +import io.helidon.http.http2.Http2Flag.HeaderFlags; +import io.helidon.http.http2.Http2Flag.NoFlags; +import io.helidon.http.http2.Http2Flag.PingFlags; +import io.helidon.http.http2.Http2Flag.PushPromiseFlags; +import io.helidon.http.http2.Http2Flag.SettingsFlags; +import io.helidon.http.http2.Http2FrameTypeUtil.FrameTypeImpl; + +/** + * Frame types with types flags. + * + * @param type of flags + */ +public interface Http2FrameTypes { + /** + * Data frame types. + */ + Http2FrameTypes DATA = new FrameTypeImpl<>(Http2FrameType.DATA, DataFlags::create); + /** + * Headers frame types. + */ + Http2FrameTypes HEADERS = new FrameTypeImpl<>(Http2FrameType.HEADERS, HeaderFlags::create); + /** + * Priority frame types. + */ + Http2FrameTypes PRIORITY = new FrameTypeImpl<>(Http2FrameType.PRIORITY, NoFlags::create); + /** + * RST stream frame types. + */ + Http2FrameTypes RST_STREAM = new FrameTypeImpl<>(Http2FrameType.RST_STREAM, NoFlags::create); + /** + * Settings frame types. + */ + Http2FrameTypes SETTINGS = new FrameTypeImpl<>(Http2FrameType.SETTINGS, SettingsFlags::create); + /** + * Push promise frame types. + */ + Http2FrameTypes PUSH_PROMISE = new FrameTypeImpl<>(Http2FrameType.PUSH_PROMISE, PushPromiseFlags::create); + /** + * Ping frame types. + */ + Http2FrameTypes PING = new FrameTypeImpl<>(Http2FrameType.PING, PingFlags::create); + /** + * Go away frame types. + */ + Http2FrameTypes GO_AWAY = new FrameTypeImpl<>(Http2FrameType.GO_AWAY, NoFlags::create); + /** + * Window update frame types. + */ + Http2FrameTypes WINDOW_UPDATE = new FrameTypeImpl<>(Http2FrameType.WINDOW_UPDATE, + NoFlags::create); + /** + * Continuation frame types. + */ + Http2FrameTypes CONTINUATION = new FrameTypeImpl<>(Http2FrameType.CONTINUATION, ContinuationFlags::create); + /** + * Unknown frame types. + */ + Http2FrameTypes UNKNOWN = new FrameTypeImpl<>(Http2FrameType.UNKNOWN, NoFlags::create); + + /** + * Get frame types based on frame type enum. + * + * @param frameType frame type + * @return frame types + */ + static Http2FrameTypes get(Http2FrameType frameType) { + return Http2FrameTypeUtil.get(frameType); + } + + /** + * Frame type enum. + * + * @return frame type + */ + Http2FrameType type(); + + /** + * Typed flags. + * + * @param flags flags number + * @return typed flags instances + */ + T flags(int flags); +} diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2GoAway.java b/http/http2/src/main/java/io/helidon/http/http2/Http2GoAway.java similarity index 99% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2GoAway.java rename to http/http2/src/main/java/io/helidon/http/http2/Http2GoAway.java index e94d298d98d..45f0ea4106a 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2GoAway.java +++ b/http/http2/src/main/java/io/helidon/http/http2/Http2GoAway.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import java.nio.charset.StandardCharsets; diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Headers.java b/http/http2/src/main/java/io/helidon/http/http2/Http2Headers.java similarity index 99% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Headers.java rename to http/http2/src/main/java/io/helidon/http/http2/Http2Headers.java index ea67050f80e..40333a7bebb 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Headers.java +++ b/http/http2/src/main/java/io/helidon/http/http2/Http2Headers.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import java.nio.charset.StandardCharsets; import java.util.ArrayList; @@ -26,18 +26,18 @@ import java.util.function.Supplier; import io.helidon.common.buffers.BufferData; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.Header; -import io.helidon.common.http.Http.HeaderName; -import io.helidon.common.http.Http.HeaderNames; -import io.helidon.common.http.ServerRequestHeaders; -import io.helidon.common.http.WritableHeaders; +import io.helidon.http.Headers; +import io.helidon.http.Http; +import io.helidon.http.Http.Header; +import io.helidon.http.Http.HeaderName; +import io.helidon.http.Http.HeaderNames; +import io.helidon.http.ServerRequestHeaders; +import io.helidon.http.WritableHeaders; import static java.lang.System.Logger.Level.DEBUG; /** - * HTTP/2 headers combining pseudo headers and {@link io.helidon.common.http.Headers}. + * HTTP/2 headers combining pseudo headers and {@link io.helidon.http.Headers}. * HTTP/2 headers are all lower case. */ public class Http2Headers { diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2HuffmanConstants.java b/http/http2/src/main/java/io/helidon/http/http2/Http2HuffmanConstants.java similarity index 99% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2HuffmanConstants.java rename to http/http2/src/main/java/io/helidon/http/http2/Http2HuffmanConstants.java index b1988e80d63..85bcb9615d8 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2HuffmanConstants.java +++ b/http/http2/src/main/java/io/helidon/http/http2/Http2HuffmanConstants.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; final class Http2HuffmanConstants { static final byte HUFFMAN_COMPLETE = 1; diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2HuffmanDecoder.java b/http/http2/src/main/java/io/helidon/http/http2/Http2HuffmanDecoder.java similarity index 99% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2HuffmanDecoder.java rename to http/http2/src/main/java/io/helidon/http/http2/Http2HuffmanDecoder.java index c22a71aab58..025328b77b0 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2HuffmanDecoder.java +++ b/http/http2/src/main/java/io/helidon/http/http2/Http2HuffmanDecoder.java @@ -32,7 +32,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import java.nio.charset.StandardCharsets; import java.util.function.BiFunction; diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2HuffmanEncoder.java b/http/http2/src/main/java/io/helidon/http/http2/Http2HuffmanEncoder.java similarity index 98% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2HuffmanEncoder.java rename to http/http2/src/main/java/io/helidon/http/http2/Http2HuffmanEncoder.java index 974b01729ef..7274b11846f 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2HuffmanEncoder.java +++ b/http/http2/src/main/java/io/helidon/http/http2/Http2HuffmanEncoder.java @@ -32,7 +32,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import io.helidon.common.buffers.BufferData; diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2LoggingFrameListener.java b/http/http2/src/main/java/io/helidon/http/http2/Http2LoggingFrameListener.java similarity index 99% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2LoggingFrameListener.java rename to http/http2/src/main/java/io/helidon/http/http2/Http2LoggingFrameListener.java index 4f06594062f..675e8d6b28d 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2LoggingFrameListener.java +++ b/http/http2/src/main/java/io/helidon/http/http2/Http2LoggingFrameListener.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import io.helidon.common.buffers.BufferData; import io.helidon.common.socket.SocketContext; diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Ping.java b/http/http2/src/main/java/io/helidon/http/http2/Http2Ping.java similarity index 98% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Ping.java rename to http/http2/src/main/java/io/helidon/http/http2/Http2Ping.java index 36ba80011c0..7518bfcf527 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Ping.java +++ b/http/http2/src/main/java/io/helidon/http/http2/Http2Ping.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import io.helidon.common.buffers.BufferData; diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Priority.java b/http/http2/src/main/java/io/helidon/http/http2/Http2Priority.java similarity index 98% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Priority.java rename to http/http2/src/main/java/io/helidon/http/http2/Http2Priority.java index 3a399818d9e..7cc09a38947 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Priority.java +++ b/http/http2/src/main/java/io/helidon/http/http2/Http2Priority.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import io.helidon.common.buffers.BufferData; diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2RstStream.java b/http/http2/src/main/java/io/helidon/http/http2/Http2RstStream.java similarity index 98% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2RstStream.java rename to http/http2/src/main/java/io/helidon/http/http2/Http2RstStream.java index f22717f9457..357a02819af 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2RstStream.java +++ b/http/http2/src/main/java/io/helidon/http/http2/Http2RstStream.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import io.helidon.common.buffers.BufferData; diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Setting.java b/http/http2/src/main/java/io/helidon/http/http2/Http2Setting.java similarity index 99% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Setting.java rename to http/http2/src/main/java/io/helidon/http/http2/Http2Setting.java index ce82da8770c..6c1984b1ecd 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Setting.java +++ b/http/http2/src/main/java/io/helidon/http/http2/Http2Setting.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import java.util.Map; diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2SettingBase.java b/http/http2/src/main/java/io/helidon/http/http2/Http2SettingBase.java similarity index 97% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2SettingBase.java rename to http/http2/src/main/java/io/helidon/http/http2/Http2SettingBase.java index e59d620393a..1a92d8d9e2e 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2SettingBase.java +++ b/http/http2/src/main/java/io/helidon/http/http2/Http2SettingBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import io.helidon.common.buffers.BufferData; diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Settings.java b/http/http2/src/main/java/io/helidon/http/http2/Http2Settings.java similarity index 98% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Settings.java rename to http/http2/src/main/java/io/helidon/http/http2/Http2Settings.java index 87425ed0fc2..756230adda6 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Settings.java +++ b/http/http2/src/main/java/io/helidon/http/http2/Http2Settings.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import java.util.ArrayList; import java.util.HashMap; @@ -182,7 +182,7 @@ public String toString() { } /** - * Fluent API builder for {@link io.helidon.nima.http2.Http2Settings}. + * Fluent API builder for {@link Http2Settings}. */ public static class Builder implements io.helidon.common.Builder { private final Map settings = new HashMap<>(); diff --git a/http/http2/src/main/java/io/helidon/http/http2/Http2Stream.java b/http/http2/src/main/java/io/helidon/http/http2/Http2Stream.java new file mode 100644 index 00000000000..505ca0c48b7 --- /dev/null +++ b/http/http2/src/main/java/io/helidon/http/http2/Http2Stream.java @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.http.http2; + +import io.helidon.common.buffers.BufferData; + +/** + * HTTP/2 stream. + * A stream represents a single request/response exchange in HTTP/2. + */ +public interface Http2Stream { + /** + * Close the stream. + * + * @param rstStream rst stream frame + */ + void rstStream(Http2RstStream rstStream); + + /** + * Flow control window update. + * + * @param windowUpdate window update frame + */ + void windowUpdate(Http2WindowUpdate windowUpdate); + + /** + * Headers received. + * + * @param headers request headers + * @param endOfStream whether these headers are the last data that would be received + */ + void headers(Http2Headers headers, boolean endOfStream); + + /** + * Data frame. + * + * @param header frame header + * @param data frame data + */ + void data(Http2FrameHeader header, BufferData data); + + /** + * Priority. + * + * @param http2Priority priority frame + */ + void priority(Http2Priority http2Priority); + + /** + * Stream ID. + * + * @return id of this stream + */ + int streamId(); + + /** + * State of this stream. + * + * @return state + */ + Http2StreamState streamState(); + + /** + * Outbound flow control of this stream. + * + * @return flow control + */ + StreamFlowControl flowControl(); + +} diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2StreamState.java b/http/http2/src/main/java/io/helidon/http/http2/Http2StreamState.java similarity index 75% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2StreamState.java rename to http/http2/src/main/java/io/helidon/http/http2/Http2StreamState.java index e53858d3720..667da344967 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2StreamState.java +++ b/http/http2/src/main/java/io/helidon/http/http2/Http2StreamState.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; /** * Stream state. @@ -31,8 +31,8 @@ public enum Http2StreamState { *

* Transitions from this state: *

    - *
  • send {@link io.helidon.nima.http2.Http2FrameType#PUSH_PROMISE} -> {@link #RESERVED_LOCAL}
  • - *
  • recv {@link io.helidon.nima.http2.Http2FrameType#PUSH_PROMISE} -> {@link #RESERVED_REMOTE}
  • + *
  • send {@link Http2FrameType#PUSH_PROMISE} -> {@link #RESERVED_LOCAL}
  • + *
  • recv {@link Http2FrameType#PUSH_PROMISE} -> {@link #RESERVED_REMOTE}
  • *
*/ IDLE, @@ -41,14 +41,14 @@ public enum Http2StreamState { *

* Transitions to this state: *

    - *
  • {@link #IDLE} -> send {@link io.helidon.nima.http2.Http2FrameType#PUSH_PROMISE}
  • + *
  • {@link #IDLE} -> send {@link Http2FrameType#PUSH_PROMISE}
  • *
*

* Transitions from this state: *

    - *
  • send {@link io.helidon.nima.http2.Http2FrameType#HEADERS} -> {@link #HALF_CLOSED_REMOTE}
  • - *
  • send {@link io.helidon.nima.http2.Http2FrameType#RST_STREAM} -> {@link #CLOSED}
  • - *
  • recv {@link io.helidon.nima.http2.Http2FrameType#RST_STREAM} -> {@link #CLOSED}
  • + *
  • send {@link Http2FrameType#HEADERS} -> {@link #HALF_CLOSED_REMOTE}
  • + *
  • send {@link Http2FrameType#RST_STREAM} -> {@link #CLOSED}
  • + *
  • recv {@link Http2FrameType#RST_STREAM} -> {@link #CLOSED}
  • *
*/ RESERVED_LOCAL, @@ -57,14 +57,14 @@ public enum Http2StreamState { *

* Transitions to this state: *

    - *
  • {@link #IDLE} -> recv {@link io.helidon.nima.http2.Http2FrameType#PUSH_PROMISE}
  • + *
  • {@link #IDLE} -> recv {@link Http2FrameType#PUSH_PROMISE}
  • *
*

* Transitions from this state: *

    - *
  • recv {@link io.helidon.nima.http2.Http2FrameType#HEADERS} -> {@link #HALF_CLOSED_LOCAL}
  • - *
  • recv {@link io.helidon.nima.http2.Http2FrameType#RST_STREAM} -> {@link #CLOSED}
  • - *
  • send {@link io.helidon.nima.http2.Http2FrameType#RST_STREAM} -> {@link #CLOSED}
  • + *
  • recv {@link Http2FrameType#HEADERS} -> {@link #HALF_CLOSED_LOCAL}
  • + *
  • recv {@link Http2FrameType#RST_STREAM} -> {@link #CLOSED}
  • + *
  • send {@link Http2FrameType#RST_STREAM} -> {@link #CLOSED}
  • *
*/ RESERVED_REMOTE, @@ -73,18 +73,18 @@ public enum Http2StreamState { *

* Transitions to this state: *

    - *
  • {@link #IDLE} -> send {@link io.helidon.nima.http2.Http2FrameType#HEADERS}
  • - *
  • {@link #IDLE} -> recv {@link io.helidon.nima.http2.Http2FrameType#HEADERS}
  • + *
  • {@link #IDLE} -> send {@link Http2FrameType#HEADERS}
  • + *
  • {@link #IDLE} -> recv {@link Http2FrameType#HEADERS}
  • *
*

* Transitions from this state - * (end of stream may be part of {@link io.helidon.nima.http2.Http2FrameType#HEADERS} or - * {@link io.helidon.nima.http2.Http2FrameType#DATA}): + * (end of stream may be part of {@link Http2FrameType#HEADERS} or + * {@link Http2FrameType#DATA}): *

    - *
  • send {@link io.helidon.nima.http2.Http2Flag#END_OF_STREAM} -> {@link #HALF_CLOSED_LOCAL}
  • - *
  • recv {@link io.helidon.nima.http2.Http2Flag#END_OF_STREAM} -> {@link #HALF_CLOSED_REMOTE}
  • - *
  • send {@link io.helidon.nima.http2.Http2FrameType#RST_STREAM} -> {@link #CLOSED}
  • - *
  • recv {@link io.helidon.nima.http2.Http2FrameType#RST_STREAM} -> {@link #CLOSED}
  • + *
  • send {@link Http2Flag#END_OF_STREAM} -> {@link #HALF_CLOSED_LOCAL}
  • + *
  • recv {@link Http2Flag#END_OF_STREAM} -> {@link #HALF_CLOSED_REMOTE}
  • + *
  • send {@link Http2FrameType#RST_STREAM} -> {@link #CLOSED}
  • + *
  • recv {@link Http2FrameType#RST_STREAM} -> {@link #CLOSED}
  • *
*/ OPEN, @@ -94,15 +94,15 @@ public enum Http2StreamState { *

* Transitions to this state: *

    - *
  • {@link #RESERVED_REMOTE} -> recv {@link io.helidon.nima.http2.Http2FrameType#HEADERS}
  • - *
  • {@link #OPEN} -> send {@link io.helidon.nima.http2.Http2Flag#END_OF_STREAM}
  • + *
  • {@link #RESERVED_REMOTE} -> recv {@link Http2FrameType#HEADERS}
  • + *
  • {@link #OPEN} -> send {@link Http2Flag#END_OF_STREAM}
  • *
*

* Transitions from this state: *

    - *
  • recv {@link io.helidon.nima.http2.Http2Flag#END_OF_STREAM} -> {@link #CLOSED}
  • - *
  • send {@link io.helidon.nima.http2.Http2FrameType#RST_STREAM} -> {@link #CLOSED}
  • - *
  • recv {@link io.helidon.nima.http2.Http2FrameType#RST_STREAM} -> {@link #CLOSED}
  • + *
  • recv {@link Http2Flag#END_OF_STREAM} -> {@link #CLOSED}
  • + *
  • send {@link Http2FrameType#RST_STREAM} -> {@link #CLOSED}
  • + *
  • recv {@link Http2FrameType#RST_STREAM} -> {@link #CLOSED}
  • *
*/ HALF_CLOSED_LOCAL, @@ -112,15 +112,15 @@ public enum Http2StreamState { *

* Transitions to this state: *

    - *
  • {@link #RESERVED_LOCAL} -> send {@link io.helidon.nima.http2.Http2FrameType#HEADERS}
  • - *
  • {@link #OPEN} -> recv {@link io.helidon.nima.http2.Http2Flag#END_OF_STREAM}
  • + *
  • {@link #RESERVED_LOCAL} -> send {@link Http2FrameType#HEADERS}
  • + *
  • {@link #OPEN} -> recv {@link Http2Flag#END_OF_STREAM}
  • *
*

* Transitions from this state: *

    - *
  • send {@link io.helidon.nima.http2.Http2Flag#END_OF_STREAM} -> {@link #CLOSED}
  • - *
  • send {@link io.helidon.nima.http2.Http2FrameType#RST_STREAM} -> {@link #CLOSED}
  • - *
  • recv {@link io.helidon.nima.http2.Http2FrameType#RST_STREAM} -> {@link #CLOSED}
  • + *
  • send {@link Http2Flag#END_OF_STREAM} -> {@link #CLOSED}
  • + *
  • send {@link Http2FrameType#RST_STREAM} -> {@link #CLOSED}
  • + *
  • recv {@link Http2FrameType#RST_STREAM} -> {@link #CLOSED}
  • *
*/ HALF_CLOSED_REMOTE, @@ -130,11 +130,11 @@ public enum Http2StreamState { * Transitions to this state: *
    *
  • {@link #HALF_CLOSED_REMOTE} -> by sending "END_STREAM", sending or receiving - * {@link io.helidon.nima.http2.Http2FrameType#RST_STREAM}
  • + * {@link Http2FrameType#RST_STREAM} *
  • {@link #HALF_CLOSED_LOCAL} -> by receiving "END_STREAM", sending or receiving - * {@link io.helidon.nima.http2.Http2FrameType#RST_STREAM}
  • + * {@link Http2FrameType#RST_STREAM} *
  • {@link #OPEN}, {@link #RESERVED_LOCAL}, or {@link #RESERVED_REMOTE} - by sending or receiving - * {@link io.helidon.nima.http2.Http2FrameType#RST_STREAM}
  • + * {@link Http2FrameType#RST_STREAM} *
*

* Transitions from this state: none diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2StreamWriter.java b/http/http2/src/main/java/io/helidon/http/http2/Http2StreamWriter.java similarity index 98% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2StreamWriter.java rename to http/http2/src/main/java/io/helidon/http/http2/Http2StreamWriter.java index 34eade9838d..3e8b2661dbd 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2StreamWriter.java +++ b/http/http2/src/main/java/io/helidon/http/http2/Http2StreamWriter.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; /** * Writer for a single stream. diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Util.java b/http/http2/src/main/java/io/helidon/http/http2/Http2Util.java similarity index 98% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Util.java rename to http/http2/src/main/java/io/helidon/http/http2/Http2Util.java index f996c666459..b306adb9d97 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Util.java +++ b/http/http2/src/main/java/io/helidon/http/http2/Http2Util.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import java.nio.charset.StandardCharsets; import java.util.Arrays; diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2WindowUpdate.java b/http/http2/src/main/java/io/helidon/http/http2/Http2WindowUpdate.java similarity index 98% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2WindowUpdate.java rename to http/http2/src/main/java/io/helidon/http/http2/Http2WindowUpdate.java index d19ca4ab752..38201da59e4 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2WindowUpdate.java +++ b/http/http2/src/main/java/io/helidon/http/http2/Http2WindowUpdate.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import io.helidon.common.buffers.BufferData; diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/StreamFlowControl.java b/http/http2/src/main/java/io/helidon/http/http2/StreamFlowControl.java similarity index 98% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/StreamFlowControl.java rename to http/http2/src/main/java/io/helidon/http/http2/StreamFlowControl.java index 22ee2509d14..3d0781451ca 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/StreamFlowControl.java +++ b/http/http2/src/main/java/io/helidon/http/http2/StreamFlowControl.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import java.util.function.BiConsumer; diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/WindowSize.java b/http/http2/src/main/java/io/helidon/http/http2/WindowSize.java similarity index 97% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/WindowSize.java rename to http/http2/src/main/java/io/helidon/http/http2/WindowSize.java index 1759405acd4..3c8724205b6 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/WindowSize.java +++ b/http/http2/src/main/java/io/helidon/http/http2/WindowSize.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import java.util.function.BiConsumer; /** - * Window size container, used with {@link io.helidon.nima.http2.FlowControl}. + * Window size container, used with {@link FlowControl}. */ public interface WindowSize { diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/WindowSizeImpl.java b/http/http2/src/main/java/io/helidon/http/http2/WindowSizeImpl.java similarity index 98% rename from nima/http2/http2/src/main/java/io/helidon/nima/http2/WindowSizeImpl.java rename to http/http2/src/main/java/io/helidon/http/http2/WindowSizeImpl.java index 58f27cde1e0..f5107d7b375 100644 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/WindowSizeImpl.java +++ b/http/http2/src/main/java/io/helidon/http/http2/WindowSizeImpl.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; @@ -26,7 +26,7 @@ import static java.lang.System.Logger.Level.DEBUG; /** - * Window size container, used with {@link io.helidon.nima.http2.FlowControl}. + * Window size container, used with {@link FlowControl}. */ abstract class WindowSizeImpl implements WindowSize { @@ -199,7 +199,7 @@ public void resetWindowSize(int size) { @Override public int decrementWindowSize(int decrement) { - return WindowSize.MAX_WIN_SIZE; + return MAX_WIN_SIZE; } @Override diff --git a/http/http2/src/main/java/io/helidon/http/http2/package-info.java b/http/http2/src/main/java/io/helidon/http/http2/package-info.java new file mode 100644 index 00000000000..f34bd4fe128 --- /dev/null +++ b/http/http2/src/main/java/io/helidon/http/http2/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon Common HTTP/2 classes. + */ +package io.helidon.http.http2; diff --git a/http/http2/src/main/java/module-info.java b/http/http2/src/main/java/module-info.java new file mode 100644 index 00000000000..33ce2c6b8a3 --- /dev/null +++ b/http/http2/src/main/java/module-info.java @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon Common HTTP/2 classes. + */ +module io.helidon.http.http2 { + requires transitive io.helidon.common.socket; + requires transitive io.helidon.http; + requires io.helidon.common; + + exports io.helidon.http.http2; +} diff --git a/nima/http2/http2/src/test/java/io/helidon/nima/http2/DynamicTableTest.java b/http/http2/src/test/java/io/helidon/http/http2/DynamicTableTest.java similarity index 95% rename from nima/http2/http2/src/test/java/io/helidon/nima/http2/DynamicTableTest.java rename to http/http2/src/test/java/io/helidon/http/http2/DynamicTableTest.java index dee7ebf87bb..f56a2ac7334 100644 --- a/nima/http2/http2/src/test/java/io/helidon/nima/http2/DynamicTableTest.java +++ b/http/http2/src/test/java/io/helidon/http/http2/DynamicTableTest.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderNames; +import io.helidon.http.Http; +import io.helidon.http.Http.HeaderNames; import org.junit.jupiter.api.Test; diff --git a/nima/http2/http2/src/test/java/io/helidon/nima/http2/Http2FrameHeaderTest.java b/http/http2/src/test/java/io/helidon/http/http2/Http2FrameHeaderTest.java similarity index 90% rename from nima/http2/http2/src/test/java/io/helidon/nima/http2/Http2FrameHeaderTest.java rename to http/http2/src/test/java/io/helidon/http/http2/Http2FrameHeaderTest.java index 3aeb15c9dd1..f417473731b 100644 --- a/nima/http2/http2/src/test/java/io/helidon/nima/http2/Http2FrameHeaderTest.java +++ b/http/http2/src/test/java/io/helidon/http/http2/Http2FrameHeaderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,12 +14,11 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import java.util.HexFormat; import io.helidon.common.buffers.BufferData; -import io.helidon.nima.http2.Http2Flag.NoFlags; import org.junit.jupiter.api.Test; @@ -31,8 +30,8 @@ class Http2FrameHeaderTest { @Test void testWriteRead() { int length = 439; - Http2FrameTypes frameType = Http2FrameTypes.GO_AWAY; - NoFlags flags = NoFlags.create(); + Http2FrameTypes frameType = Http2FrameTypes.GO_AWAY; + Http2Flag.NoFlags flags = Http2Flag.NoFlags.create(); int streamId = 0; Http2FrameHeader frameHeader = Http2FrameHeader.create(length, frameType, flags, streamId); diff --git a/nima/http2/http2/src/test/java/io/helidon/nima/http2/Http2FrameTypeUtilTest.java b/http/http2/src/test/java/io/helidon/http/http2/Http2FrameTypeUtilTest.java similarity index 92% rename from nima/http2/http2/src/test/java/io/helidon/nima/http2/Http2FrameTypeUtilTest.java rename to http/http2/src/test/java/io/helidon/http/http2/Http2FrameTypeUtilTest.java index 002b1815263..85cddf72a2d 100644 --- a/nima/http2/http2/src/test/java/io/helidon/nima/http2/Http2FrameTypeUtilTest.java +++ b/http/http2/src/test/java/io/helidon/http/http2/Http2FrameTypeUtilTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import org.junit.jupiter.api.Test; diff --git a/nima/http2/http2/src/test/java/io/helidon/nima/http2/Http2HeadersTest.java b/http/http2/src/test/java/io/helidon/http/http2/Http2HeadersTest.java similarity index 97% rename from nima/http2/http2/src/test/java/io/helidon/nima/http2/Http2HeadersTest.java rename to http/http2/src/test/java/io/helidon/http/http2/Http2HeadersTest.java index b144303521c..883c6b03eb6 100644 --- a/nima/http2/http2/src/test/java/io/helidon/nima/http2/Http2HeadersTest.java +++ b/http/http2/src/test/java/io/helidon/http/http2/Http2HeadersTest.java @@ -14,18 +14,18 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import java.util.HexFormat; import io.helidon.common.buffers.BufferData; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderName; -import io.helidon.common.http.Http.HeaderNames; -import io.helidon.common.http.WritableHeaders; -import io.helidon.nima.http2.Http2Headers.DynamicTable; -import io.helidon.nima.http2.Http2Headers.HeaderRecord; +import io.helidon.http.Headers; +import io.helidon.http.Http; +import io.helidon.http.Http.HeaderName; +import io.helidon.http.Http.HeaderNames; +import io.helidon.http.WritableHeaders; +import io.helidon.http.http2.Http2Headers.DynamicTable; +import io.helidon.http.http2.Http2Headers.HeaderRecord; import org.junit.jupiter.api.Test; import org.mockito.Mockito; diff --git a/nima/http2/http2/src/test/java/io/helidon/nima/http2/Http2HuffmanTest.java b/http/http2/src/test/java/io/helidon/http/http2/Http2HuffmanTest.java similarity index 97% rename from nima/http2/http2/src/test/java/io/helidon/nima/http2/Http2HuffmanTest.java rename to http/http2/src/test/java/io/helidon/http/http2/Http2HuffmanTest.java index 865a69223b4..e2c629a5ac2 100644 --- a/nima/http2/http2/src/test/java/io/helidon/nima/http2/Http2HuffmanTest.java +++ b/http/http2/src/test/java/io/helidon/http/http2/Http2HuffmanTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import io.helidon.common.buffers.BufferData; diff --git a/nima/http2/http2/src/test/java/io/helidon/nima/http2/MaxFrameSizeSplitTest.java b/http/http2/src/test/java/io/helidon/http/http2/MaxFrameSizeSplitTest.java similarity index 99% rename from nima/http2/http2/src/test/java/io/helidon/nima/http2/MaxFrameSizeSplitTest.java rename to http/http2/src/test/java/io/helidon/http/http2/MaxFrameSizeSplitTest.java index acc08d096b9..922a3f6addf 100644 --- a/nima/http2/http2/src/test/java/io/helidon/nima/http2/MaxFrameSizeSplitTest.java +++ b/http/http2/src/test/java/io/helidon/http/http2/MaxFrameSizeSplitTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2; +package io.helidon.http.http2; import java.nio.charset.StandardCharsets; import java.util.Arrays; diff --git a/http/http2/src/test/resources/logging-test.properties b/http/http2/src/test/resources/logging-test.properties new file mode 100644 index 00000000000..fa435d0ca2b --- /dev/null +++ b/http/http2/src/test/resources/logging-test.properties @@ -0,0 +1,23 @@ +# +# Copyright (c) 2023 Oracle and/or its affiliates. +# +# 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. +# +handlers=io.helidon.logging.jul.HelidonConsoleHandler +# HelidonConsoleHandler uses a SimpleFormatter subclass that replaces "!thread!" with the current thread +java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$s %3$s !thread!: %5$s%6$s%n +#java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS.%1$tL %5$s%6$s%n +# Global logging level. Can be overridden by specific loggers +.level=INFO +io.helidon.http.level=INFO +#io.helidon.http.http2.MaxFrameSizeSplitTest.level=ALL diff --git a/http/media/jackson/pom.xml b/http/media/jackson/pom.xml new file mode 100644 index 00000000000..25f30e660bb --- /dev/null +++ b/http/media/jackson/pom.xml @@ -0,0 +1,90 @@ + + + + 4.0.0 + + io.helidon.http.media + helidon-http-media-project + 4.0.0-SNAPSHOT + + + helidon-http-media-jackson + Helidon HTTP Media Jackson + + + + io.helidon.http.media + helidon-http-media + + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.module + jackson-module-parameter-names + + + com.fasterxml.jackson.datatype + jackson-datatype-jdk8 + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + io.helidon.common.features + helidon-common-features-api + true + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + io.helidon.common.testing + helidon-common-testing-http-junit5 + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + + + + + diff --git a/nima/http/media/jackson/src/main/java/io/helidon/nima/http/media/jackson/JacksonMediaSupportProvider.java b/http/media/jackson/src/main/java/io/helidon/http/media/jackson/JacksonMediaSupportProvider.java similarity index 90% rename from nima/http/media/jackson/src/main/java/io/helidon/nima/http/media/jackson/JacksonMediaSupportProvider.java rename to http/media/jackson/src/main/java/io/helidon/http/media/jackson/JacksonMediaSupportProvider.java index 6daabb0fda9..3635db025f5 100644 --- a/nima/http/media/jackson/src/main/java/io/helidon/nima/http/media/jackson/JacksonMediaSupportProvider.java +++ b/http/media/jackson/src/main/java/io/helidon/http/media/jackson/JacksonMediaSupportProvider.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.nima.http.media.jackson; +package io.helidon.http.media.jackson; import io.helidon.common.Weighted; import io.helidon.common.config.Config; -import io.helidon.nima.http.media.MediaSupport; -import io.helidon.nima.http.media.spi.MediaSupportProvider; +import io.helidon.http.media.MediaSupport; +import io.helidon.http.media.spi.MediaSupportProvider; /** * {@link java.util.ServiceLoader} provider implementation for Jackson media support. diff --git a/nima/http/media/jackson/src/main/java/io/helidon/nima/http/media/jackson/JacksonReader.java b/http/media/jackson/src/main/java/io/helidon/http/media/jackson/JacksonReader.java similarity index 93% rename from nima/http/media/jackson/src/main/java/io/helidon/nima/http/media/jackson/JacksonReader.java rename to http/media/jackson/src/main/java/io/helidon/http/media/jackson/JacksonReader.java index a18f7d40102..a4208c89275 100644 --- a/nima/http/media/jackson/src/main/java/io/helidon/nima/http/media/jackson/JacksonReader.java +++ b/http/media/jackson/src/main/java/io/helidon/http/media/jackson/JacksonReader.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.media.jackson; +package io.helidon.http.media.jackson; import java.io.IOException; import java.io.InputStream; @@ -26,9 +26,9 @@ import java.nio.charset.StandardCharsets; import io.helidon.common.GenericType; -import io.helidon.common.http.Headers; -import io.helidon.common.http.HttpMediaType; -import io.helidon.nima.http.media.EntityReader; +import io.helidon.http.Headers; +import io.helidon.http.HttpMediaType; +import io.helidon.http.media.EntityReader; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/nima/http/media/jackson/src/main/java/io/helidon/nima/http/media/jackson/JacksonRuntimeException.java b/http/media/jackson/src/main/java/io/helidon/http/media/jackson/JacksonRuntimeException.java similarity index 95% rename from nima/http/media/jackson/src/main/java/io/helidon/nima/http/media/jackson/JacksonRuntimeException.java rename to http/media/jackson/src/main/java/io/helidon/http/media/jackson/JacksonRuntimeException.java index 7c4bfe3f2d2..bd3b87ddfda 100644 --- a/nima/http/media/jackson/src/main/java/io/helidon/nima/http/media/jackson/JacksonRuntimeException.java +++ b/http/media/jackson/src/main/java/io/helidon/http/media/jackson/JacksonRuntimeException.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.media.jackson; +package io.helidon.http.media.jackson; /** * A {@link RuntimeException} that indicates a problem was encountered diff --git a/nima/http/media/jackson/src/main/java/io/helidon/nima/http/media/jackson/JacksonSupport.java b/http/media/jackson/src/main/java/io/helidon/http/media/jackson/JacksonSupport.java similarity index 94% rename from nima/http/media/jackson/src/main/java/io/helidon/nima/http/media/jackson/JacksonSupport.java rename to http/media/jackson/src/main/java/io/helidon/http/media/jackson/JacksonSupport.java index 0e9f0b758d9..d448901f3cf 100644 --- a/nima/http/media/jackson/src/main/java/io/helidon/nima/http/media/jackson/JacksonSupport.java +++ b/http/media/jackson/src/main/java/io/helidon/http/media/jackson/JacksonSupport.java @@ -14,27 +14,27 @@ * limitations under the License. */ -package io.helidon.nima.http.media.jackson; +package io.helidon.http.media.jackson; import java.util.Objects; import io.helidon.common.GenericType; import io.helidon.common.config.Config; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpMediaType; -import io.helidon.common.http.WritableHeaders; import io.helidon.common.media.type.MediaTypes; -import io.helidon.nima.http.media.EntityReader; -import io.helidon.nima.http.media.EntityWriter; -import io.helidon.nima.http.media.MediaSupport; +import io.helidon.http.Headers; +import io.helidon.http.Http; +import io.helidon.http.HttpMediaType; +import io.helidon.http.WritableHeaders; +import io.helidon.http.media.EntityReader; +import io.helidon.http.media.EntityWriter; +import io.helidon.http.media.MediaSupport; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.fasterxml.jackson.module.paramnames.ParameterNamesModule; -import static io.helidon.common.http.Http.Headers.CONTENT_TYPE_JSON; +import static io.helidon.http.Http.Headers.CONTENT_TYPE_JSON; /** * {@link java.util.ServiceLoader} provider implementation for Jackson media support. diff --git a/nima/http/media/jackson/src/main/java/io/helidon/nima/http/media/jackson/JacksonWriter.java b/http/media/jackson/src/main/java/io/helidon/http/media/jackson/JacksonWriter.java similarity index 92% rename from nima/http/media/jackson/src/main/java/io/helidon/nima/http/media/jackson/JacksonWriter.java rename to http/media/jackson/src/main/java/io/helidon/http/media/jackson/JacksonWriter.java index 313677a3299..4328bb6210c 100644 --- a/nima/http/media/jackson/src/main/java/io/helidon/nima/http/media/jackson/JacksonWriter.java +++ b/http/media/jackson/src/main/java/io/helidon/http/media/jackson/JacksonWriter.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.media.jackson; +package io.helidon.http.media.jackson; import java.io.IOException; import java.io.OutputStream; @@ -26,12 +26,12 @@ import java.util.Optional; import io.helidon.common.GenericType; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpMediaType; -import io.helidon.common.http.WritableHeaders; import io.helidon.common.media.type.MediaTypes; -import io.helidon.nima.http.media.EntityWriter; +import io.helidon.http.Headers; +import io.helidon.http.Http; +import io.helidon.http.HttpMediaType; +import io.helidon.http.WritableHeaders; +import io.helidon.http.media.EntityWriter; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/http/media/jackson/src/main/java/io/helidon/http/media/jackson/package-info.java b/http/media/jackson/src/main/java/io/helidon/http/media/jackson/package-info.java new file mode 100644 index 00000000000..be67293d32c --- /dev/null +++ b/http/media/jackson/src/main/java/io/helidon/http/media/jackson/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Jackson media type support. + */ +package io.helidon.http.media.jackson; diff --git a/http/media/jackson/src/main/java/module-info.java b/http/media/jackson/src/main/java/module-info.java new file mode 100644 index 00000000000..0ccb973228c --- /dev/null +++ b/http/media/jackson/src/main/java/module-info.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.common.features.api.Feature; +import io.helidon.common.features.api.HelidonFlavor; +import io.helidon.http.media.jackson.JacksonMediaSupportProvider; +import io.helidon.http.media.spi.MediaSupportProvider; + +/** + * Jackson media support. + */ +@Feature(value = "Jackson", + description = "Jackson media support", + in = HelidonFlavor.SE, + path = {"Media", "Jackson"} +) +module io.helidon.http.media.jackson { + requires static io.helidon.common.features.api; + + requires io.helidon.http.media; + + requires com.fasterxml.jackson.databind; + requires com.fasterxml.jackson.core; + requires com.fasterxml.jackson.datatype.jdk8; + requires com.fasterxml.jackson.datatype.jsr310; + requires com.fasterxml.jackson.module.paramnames; + + exports io.helidon.http.media.jackson; + + provides MediaSupportProvider + with JacksonMediaSupportProvider; +} \ No newline at end of file diff --git a/nima/http/media/jackson/src/main/resources/META-INF/native-image/io.helidon.nima.http.media/helidon-nima-http-media-jackson/native-image.properties b/http/media/jackson/src/main/resources/META-INF/native-image/io.helidon.nima.http.media/helidon-nima-http-media-jackson/native-image.properties similarity index 100% rename from nima/http/media/jackson/src/main/resources/META-INF/native-image/io.helidon.nima.http.media/helidon-nima-http-media-jackson/native-image.properties rename to http/media/jackson/src/main/resources/META-INF/native-image/io.helidon.nima.http.media/helidon-nima-http-media-jackson/native-image.properties diff --git a/nima/http/media/jackson/src/test/java/io/helidon/nima/http/media/jackson/JacksonMediaTest.java b/http/media/jackson/src/test/java/io/helidon/http/media/jackson/JacksonMediaTest.java similarity index 97% rename from nima/http/media/jackson/src/test/java/io/helidon/nima/http/media/jackson/JacksonMediaTest.java rename to http/media/jackson/src/test/java/io/helidon/http/media/jackson/JacksonMediaTest.java index 5fa72d56baa..7617c93a18e 100644 --- a/nima/http/media/jackson/src/test/java/io/helidon/nima/http/media/jackson/JacksonMediaTest.java +++ b/http/media/jackson/src/test/java/io/helidon/http/media/jackson/JacksonMediaTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.media.jackson; +package io.helidon.http.media.jackson; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -26,13 +26,13 @@ import io.helidon.common.GenericType; import io.helidon.common.config.Config; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpMediaType; -import io.helidon.common.http.WritableHeaders; +import io.helidon.http.Http; +import io.helidon.http.HttpMediaType; +import io.helidon.http.WritableHeaders; import io.helidon.common.media.type.MediaTypes; import io.helidon.common.testing.http.junit5.HttpHeaderMatcher; -import io.helidon.nima.http.media.MediaContext; -import io.helidon.nima.http.media.MediaSupport; +import io.helidon.http.media.MediaContext; +import io.helidon.http.media.MediaSupport; import org.junit.jupiter.api.Test; diff --git a/http/media/jsonb/pom.xml b/http/media/jsonb/pom.xml new file mode 100644 index 00000000000..5e5653bc36f --- /dev/null +++ b/http/media/jsonb/pom.xml @@ -0,0 +1,87 @@ + + + + 4.0.0 + + io.helidon.http.media + helidon-http-media-project + 4.0.0-SNAPSHOT + + + helidon-http-media-jsonb + Helidon HTTP Media JSON-B + + + + io.helidon.http.media + helidon-http-media + + + org.eclipse + yasson + runtime + + + jakarta.json + jakarta.json-api + + + jakarta.json.bind + jakarta.json.bind-api + + + io.helidon.common.features + helidon-common-features-api + true + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + io.helidon.common.testing + helidon-common-testing-http-junit5 + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + + + + + diff --git a/nima/http/media/jsonb/src/main/java/io/helidon/nima/http/media/jsonb/JsonbMediaSupportProvider.java b/http/media/jsonb/src/main/java/io/helidon/http/media/jsonb/JsonbMediaSupportProvider.java similarity index 90% rename from nima/http/media/jsonb/src/main/java/io/helidon/nima/http/media/jsonb/JsonbMediaSupportProvider.java rename to http/media/jsonb/src/main/java/io/helidon/http/media/jsonb/JsonbMediaSupportProvider.java index 05a01d5643d..d29be1fc967 100644 --- a/nima/http/media/jsonb/src/main/java/io/helidon/nima/http/media/jsonb/JsonbMediaSupportProvider.java +++ b/http/media/jsonb/src/main/java/io/helidon/http/media/jsonb/JsonbMediaSupportProvider.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.nima.http.media.jsonb; +package io.helidon.http.media.jsonb; import io.helidon.common.Weighted; import io.helidon.common.config.Config; -import io.helidon.nima.http.media.MediaSupport; -import io.helidon.nima.http.media.spi.MediaSupportProvider; +import io.helidon.http.media.MediaSupport; +import io.helidon.http.media.spi.MediaSupportProvider; /** * {@link java.util.ServiceLoader} provider implementation for JSON Binding media support. diff --git a/nima/http/media/jsonb/src/main/java/io/helidon/nima/http/media/jsonb/JsonbReader.java b/http/media/jsonb/src/main/java/io/helidon/http/media/jsonb/JsonbReader.java similarity index 92% rename from nima/http/media/jsonb/src/main/java/io/helidon/nima/http/media/jsonb/JsonbReader.java rename to http/media/jsonb/src/main/java/io/helidon/http/media/jsonb/JsonbReader.java index 293e230173c..3c6ec7e0132 100644 --- a/nima/http/media/jsonb/src/main/java/io/helidon/nima/http/media/jsonb/JsonbReader.java +++ b/http/media/jsonb/src/main/java/io/helidon/http/media/jsonb/JsonbReader.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.media.jsonb; +package io.helidon.http.media.jsonb; import java.io.IOException; import java.io.InputStream; @@ -25,9 +25,9 @@ import java.nio.charset.StandardCharsets; import io.helidon.common.GenericType; -import io.helidon.common.http.Headers; -import io.helidon.common.http.HttpMediaType; -import io.helidon.nima.http.media.EntityReader; +import io.helidon.http.Headers; +import io.helidon.http.HttpMediaType; +import io.helidon.http.media.EntityReader; import jakarta.json.bind.Jsonb; diff --git a/nima/http/media/jsonb/src/main/java/io/helidon/nima/http/media/jsonb/JsonbSupport.java b/http/media/jsonb/src/main/java/io/helidon/http/media/jsonb/JsonbSupport.java similarity index 92% rename from nima/http/media/jsonb/src/main/java/io/helidon/nima/http/media/jsonb/JsonbSupport.java rename to http/media/jsonb/src/main/java/io/helidon/http/media/jsonb/JsonbSupport.java index 8b5257aef84..81fad1dcd8c 100644 --- a/nima/http/media/jsonb/src/main/java/io/helidon/nima/http/media/jsonb/JsonbSupport.java +++ b/http/media/jsonb/src/main/java/io/helidon/http/media/jsonb/JsonbSupport.java @@ -14,26 +14,26 @@ * limitations under the License. */ -package io.helidon.nima.http.media.jsonb; +package io.helidon.http.media.jsonb; import java.util.Objects; import io.helidon.common.GenericType; import io.helidon.common.config.Config; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpMediaType; -import io.helidon.common.http.WritableHeaders; import io.helidon.common.media.type.MediaTypes; -import io.helidon.nima.http.media.EntityReader; -import io.helidon.nima.http.media.EntityWriter; -import io.helidon.nima.http.media.MediaSupport; +import io.helidon.http.Headers; +import io.helidon.http.Http; +import io.helidon.http.HttpMediaType; +import io.helidon.http.WritableHeaders; +import io.helidon.http.media.EntityReader; +import io.helidon.http.media.EntityWriter; +import io.helidon.http.media.MediaSupport; import jakarta.json.JsonObject; import jakarta.json.bind.Jsonb; import jakarta.json.bind.JsonbBuilder; -import static io.helidon.common.http.Http.Headers.CONTENT_TYPE_JSON; +import static io.helidon.http.Http.Headers.CONTENT_TYPE_JSON; /** * {@link java.util.ServiceLoader} provider implementation for JSON Binding media support. diff --git a/nima/http/media/jsonb/src/main/java/io/helidon/nima/http/media/jsonb/JsonbWriter.java b/http/media/jsonb/src/main/java/io/helidon/http/media/jsonb/JsonbWriter.java similarity index 91% rename from nima/http/media/jsonb/src/main/java/io/helidon/nima/http/media/jsonb/JsonbWriter.java rename to http/media/jsonb/src/main/java/io/helidon/http/media/jsonb/JsonbWriter.java index dc410b27e31..b4e5c9f2ca9 100644 --- a/nima/http/media/jsonb/src/main/java/io/helidon/nima/http/media/jsonb/JsonbWriter.java +++ b/http/media/jsonb/src/main/java/io/helidon/http/media/jsonb/JsonbWriter.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.media.jsonb; +package io.helidon.http.media.jsonb; import java.io.IOException; import java.io.OutputStream; @@ -25,12 +25,12 @@ import java.util.Optional; import io.helidon.common.GenericType; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpMediaType; -import io.helidon.common.http.WritableHeaders; import io.helidon.common.media.type.MediaTypes; -import io.helidon.nima.http.media.EntityWriter; +import io.helidon.http.Headers; +import io.helidon.http.Http; +import io.helidon.http.HttpMediaType; +import io.helidon.http.WritableHeaders; +import io.helidon.http.media.EntityWriter; import jakarta.json.bind.Jsonb; diff --git a/http/media/jsonb/src/main/java/io/helidon/http/media/jsonb/package-info.java b/http/media/jsonb/src/main/java/io/helidon/http/media/jsonb/package-info.java new file mode 100644 index 00000000000..1756c0a3eb2 --- /dev/null +++ b/http/media/jsonb/src/main/java/io/helidon/http/media/jsonb/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * JSON-Binding Entity Media handling support. + */ +package io.helidon.http.media.jsonb; diff --git a/http/media/jsonb/src/main/java/module-info.java b/http/media/jsonb/src/main/java/module-info.java new file mode 100644 index 00000000000..23d90d84a4d --- /dev/null +++ b/http/media/jsonb/src/main/java/module-info.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.common.features.api.Feature; +import io.helidon.common.features.api.HelidonFlavor; +import io.helidon.http.media.jsonb.JsonbMediaSupportProvider; +import io.helidon.http.media.spi.MediaSupportProvider; + +/** + * JSON-B media support. + */ +@Feature(value = "JSONB", + description = "JSON-B media support", + in = HelidonFlavor.SE, + path = {"Media", "JSON-B"} +) +module io.helidon.http.media.jsonb { + requires static io.helidon.common.features.api; + + requires io.helidon.http.media; + requires jakarta.json; + requires jakarta.json.bind; + + exports io.helidon.http.media.jsonb; + + provides MediaSupportProvider with JsonbMediaSupportProvider; +} \ No newline at end of file diff --git a/http/media/jsonb/src/main/resources/META-INF/native-image/io.helidon.nima.http.media/helidon-nima-http-media-jsonb/native-image.properties b/http/media/jsonb/src/main/resources/META-INF/native-image/io.helidon.nima.http.media/helidon-nima-http-media-jsonb/native-image.properties new file mode 100644 index 00000000000..fbdd1e45d6c --- /dev/null +++ b/http/media/jsonb/src/main/resources/META-INF/native-image/io.helidon.nima.http.media/helidon-nima-http-media-jsonb/native-image.properties @@ -0,0 +1,17 @@ +# +# Copyright (c) 2022, 2023 Oracle and/or its affiliates. +# +# 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. +# + +Args=--initialize-at-build-time=org.eclipse.yasson diff --git a/nima/http/media/jsonb/src/main/resources/META-INF/native-image/io.helidon.nima.http.media/helidon-nima-http-media-jsonb/resource-config.json b/http/media/jsonb/src/main/resources/META-INF/native-image/io.helidon.nima.http.media/helidon-nima-http-media-jsonb/resource-config.json similarity index 100% rename from nima/http/media/jsonb/src/main/resources/META-INF/native-image/io.helidon.nima.http.media/helidon-nima-http-media-jsonb/resource-config.json rename to http/media/jsonb/src/main/resources/META-INF/native-image/io.helidon.nima.http.media/helidon-nima-http-media-jsonb/resource-config.json diff --git a/nima/http/media/jsonb/src/test/java/io/helidon/nima/http/media/jsonb/JsonbMediaTest.java b/http/media/jsonb/src/test/java/io/helidon/http/media/jsonb/JsonbMediaTest.java similarity index 97% rename from nima/http/media/jsonb/src/test/java/io/helidon/nima/http/media/jsonb/JsonbMediaTest.java rename to http/media/jsonb/src/test/java/io/helidon/http/media/jsonb/JsonbMediaTest.java index 56b8b587613..96465912609 100644 --- a/nima/http/media/jsonb/src/test/java/io/helidon/nima/http/media/jsonb/JsonbMediaTest.java +++ b/http/media/jsonb/src/test/java/io/helidon/http/media/jsonb/JsonbMediaTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.media.jsonb; +package io.helidon.http.media.jsonb; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -26,13 +26,13 @@ import io.helidon.common.GenericType; import io.helidon.common.config.Config; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpMediaType; -import io.helidon.common.http.WritableHeaders; +import io.helidon.http.Http; +import io.helidon.http.HttpMediaType; +import io.helidon.http.WritableHeaders; import io.helidon.common.media.type.MediaTypes; import io.helidon.common.testing.http.junit5.HttpHeaderMatcher; -import io.helidon.nima.http.media.MediaContext; -import io.helidon.nima.http.media.MediaSupport; +import io.helidon.http.media.MediaContext; +import io.helidon.http.media.MediaSupport; import org.junit.jupiter.api.Test; diff --git a/http/media/jsonp/pom.xml b/http/media/jsonp/pom.xml new file mode 100644 index 00000000000..7eeb52b1a51 --- /dev/null +++ b/http/media/jsonp/pom.xml @@ -0,0 +1,83 @@ + + + + 4.0.0 + + io.helidon.http.media + helidon-http-media-project + 4.0.0-SNAPSHOT + + + helidon-http-media-jsonp + Helidon HTTP Media JSON-P + + + + io.helidon.http.media + helidon-http-media + + + org.eclipse.parsson + parsson + runtime + + + jakarta.json + jakarta.json-api + + + io.helidon.common.features + helidon-common-features-api + true + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + io.helidon.common.testing + helidon-common-testing-http-junit5 + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + + + + + diff --git a/nima/http/media/jsonp/src/main/java/io/helidon/nima/http/media/jsonp/JsonpMediaSupportProvider.java b/http/media/jsonp/src/main/java/io/helidon/http/media/jsonp/JsonpMediaSupportProvider.java similarity index 89% rename from nima/http/media/jsonp/src/main/java/io/helidon/nima/http/media/jsonp/JsonpMediaSupportProvider.java rename to http/media/jsonp/src/main/java/io/helidon/http/media/jsonp/JsonpMediaSupportProvider.java index 076fe59adcb..3862cddbd24 100644 --- a/nima/http/media/jsonp/src/main/java/io/helidon/nima/http/media/jsonp/JsonpMediaSupportProvider.java +++ b/http/media/jsonp/src/main/java/io/helidon/http/media/jsonp/JsonpMediaSupportProvider.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.nima.http.media.jsonp; +package io.helidon.http.media.jsonp; import io.helidon.common.Weighted; import io.helidon.common.config.Config; -import io.helidon.nima.http.media.MediaSupport; -import io.helidon.nima.http.media.spi.MediaSupportProvider; +import io.helidon.http.media.MediaSupport; +import io.helidon.http.media.spi.MediaSupportProvider; /** * {@link java.util.ServiceLoader} provider implementation for JSON Processing media support. diff --git a/nima/http/media/jsonp/src/main/java/io/helidon/nima/http/media/jsonp/JsonpReader.java b/http/media/jsonp/src/main/java/io/helidon/http/media/jsonp/JsonpReader.java similarity index 92% rename from nima/http/media/jsonp/src/main/java/io/helidon/nima/http/media/jsonp/JsonpReader.java rename to http/media/jsonp/src/main/java/io/helidon/http/media/jsonp/JsonpReader.java index e0326bade8e..23ed7ae1bb1 100644 --- a/nima/http/media/jsonp/src/main/java/io/helidon/nima/http/media/jsonp/JsonpReader.java +++ b/http/media/jsonp/src/main/java/io/helidon/http/media/jsonp/JsonpReader.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.media.jsonp; +package io.helidon.http.media.jsonp; import java.io.IOException; import java.io.InputStream; @@ -25,9 +25,9 @@ import java.nio.charset.StandardCharsets; import io.helidon.common.GenericType; -import io.helidon.common.http.Headers; -import io.helidon.common.http.HttpMediaType; -import io.helidon.nima.http.media.EntityReader; +import io.helidon.http.Headers; +import io.helidon.http.HttpMediaType; +import io.helidon.http.media.EntityReader; import jakarta.json.JsonReaderFactory; import jakarta.json.JsonStructure; diff --git a/nima/http/media/jsonp/src/main/java/io/helidon/nima/http/media/jsonp/JsonpSupport.java b/http/media/jsonp/src/main/java/io/helidon/http/media/jsonp/JsonpSupport.java similarity index 94% rename from nima/http/media/jsonp/src/main/java/io/helidon/nima/http/media/jsonp/JsonpSupport.java rename to http/media/jsonp/src/main/java/io/helidon/http/media/jsonp/JsonpSupport.java index 57165e947cc..ae4da4c68f8 100644 --- a/nima/http/media/jsonp/src/main/java/io/helidon/nima/http/media/jsonp/JsonpSupport.java +++ b/http/media/jsonp/src/main/java/io/helidon/http/media/jsonp/JsonpSupport.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.media.jsonp; +package io.helidon.http.media.jsonp; import java.util.List; import java.util.Map; @@ -22,13 +22,13 @@ import io.helidon.common.GenericType; import io.helidon.common.config.Config; -import io.helidon.common.http.Headers; -import io.helidon.common.http.HttpMediaType; -import io.helidon.common.http.WritableHeaders; import io.helidon.common.media.type.MediaTypes; -import io.helidon.nima.http.media.EntityReader; -import io.helidon.nima.http.media.EntityWriter; -import io.helidon.nima.http.media.MediaSupport; +import io.helidon.http.Headers; +import io.helidon.http.HttpMediaType; +import io.helidon.http.WritableHeaders; +import io.helidon.http.media.EntityReader; +import io.helidon.http.media.EntityWriter; +import io.helidon.http.media.MediaSupport; import jakarta.json.Json; import jakarta.json.JsonArray; diff --git a/nima/http/media/jsonp/src/main/java/io/helidon/nima/http/media/jsonp/JsonpWriter.java b/http/media/jsonp/src/main/java/io/helidon/http/media/jsonp/JsonpWriter.java similarity index 91% rename from nima/http/media/jsonp/src/main/java/io/helidon/nima/http/media/jsonp/JsonpWriter.java rename to http/media/jsonp/src/main/java/io/helidon/http/media/jsonp/JsonpWriter.java index 1abe25f7266..ce9677b4741 100644 --- a/nima/http/media/jsonp/src/main/java/io/helidon/nima/http/media/jsonp/JsonpWriter.java +++ b/http/media/jsonp/src/main/java/io/helidon/http/media/jsonp/JsonpWriter.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.media.jsonp; +package io.helidon.http.media.jsonp; import java.io.IOException; import java.io.OutputStream; @@ -25,12 +25,12 @@ import java.util.Optional; import io.helidon.common.GenericType; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpMediaType; -import io.helidon.common.http.WritableHeaders; import io.helidon.common.media.type.MediaTypes; -import io.helidon.nima.http.media.EntityWriter; +import io.helidon.http.Headers; +import io.helidon.http.Http; +import io.helidon.http.HttpMediaType; +import io.helidon.http.WritableHeaders; +import io.helidon.http.media.EntityWriter; import jakarta.json.JsonStructure; import jakarta.json.JsonWriter; diff --git a/http/media/jsonp/src/main/java/io/helidon/http/media/jsonp/package-info.java b/http/media/jsonp/src/main/java/io/helidon/http/media/jsonp/package-info.java new file mode 100644 index 00000000000..d17a2119d02 --- /dev/null +++ b/http/media/jsonp/src/main/java/io/helidon/http/media/jsonp/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * JSON-Processing Entity Media handling support. + */ +package io.helidon.http.media.jsonp; diff --git a/http/media/jsonp/src/main/java/module-info.java b/http/media/jsonp/src/main/java/module-info.java new file mode 100644 index 00000000000..5c3dd927178 --- /dev/null +++ b/http/media/jsonp/src/main/java/module-info.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.common.features.api.Feature; +import io.helidon.common.features.api.HelidonFlavor; +import io.helidon.http.media.jsonp.JsonpMediaSupportProvider; +import io.helidon.http.media.spi.MediaSupportProvider; + +/** + * JSON-P media support. + */ +@Feature(value = "JSONP", + description = "JSON-P media support", + in = HelidonFlavor.SE, + path = {"Media", "JSON-P"} +) +module io.helidon.http.media.jsonp { + requires static io.helidon.common.features.api; + + requires io.helidon.http.media; + requires transitive jakarta.json; + + exports io.helidon.http.media.jsonp; + + provides MediaSupportProvider with JsonpMediaSupportProvider; +} \ No newline at end of file diff --git a/nima/http/media/jsonp/src/main/resources/META-INF/native-image/io.helidon.nima.http.media/helidon-nima-http-mediate-jsonp/native-image.properties b/http/media/jsonp/src/main/resources/META-INF/native-image/io.helidon.nima.http.media/helidon-nima-http-mediate-jsonp/native-image.properties similarity index 100% rename from nima/http/media/jsonp/src/main/resources/META-INF/native-image/io.helidon.nima.http.media/helidon-nima-http-mediate-jsonp/native-image.properties rename to http/media/jsonp/src/main/resources/META-INF/native-image/io.helidon.nima.http.media/helidon-nima-http-mediate-jsonp/native-image.properties diff --git a/nima/http/media/jsonp/src/test/java/io/helidon/nima/http/media/jsonp/JsonpMediaTest.java b/http/media/jsonp/src/test/java/io/helidon/http/media/jsonp/JsonpMediaTest.java similarity index 95% rename from nima/http/media/jsonp/src/test/java/io/helidon/nima/http/media/jsonp/JsonpMediaTest.java rename to http/media/jsonp/src/test/java/io/helidon/http/media/jsonp/JsonpMediaTest.java index ba161d82334..766f616ff33 100644 --- a/nima/http/media/jsonp/src/test/java/io/helidon/nima/http/media/jsonp/JsonpMediaTest.java +++ b/http/media/jsonp/src/test/java/io/helidon/http/media/jsonp/JsonpMediaTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.media.jsonp; +package io.helidon.http.media.jsonp; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -24,13 +24,13 @@ import java.util.Map; import io.helidon.common.config.Config; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpMediaType; -import io.helidon.common.http.WritableHeaders; +import io.helidon.http.Http; +import io.helidon.http.HttpMediaType; +import io.helidon.http.WritableHeaders; import io.helidon.common.media.type.MediaTypes; import io.helidon.common.testing.http.junit5.HttpHeaderMatcher; -import io.helidon.nima.http.media.MediaContext; -import io.helidon.nima.http.media.MediaSupport; +import io.helidon.http.media.MediaContext; +import io.helidon.http.media.MediaSupport; import jakarta.json.Json; import jakarta.json.JsonArray; @@ -39,8 +39,8 @@ import jakarta.json.JsonObject; import org.junit.jupiter.api.Test; -import static io.helidon.nima.http.media.jsonp.JsonpSupport.JSON_ARRAY_TYPE; -import static io.helidon.nima.http.media.jsonp.JsonpSupport.JSON_OBJECT_TYPE; +import static io.helidon.http.media.jsonp.JsonpSupport.JSON_ARRAY_TYPE; +import static io.helidon.http.media.jsonp.JsonpSupport.JSON_OBJECT_TYPE; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; diff --git a/http/media/media/pom.xml b/http/media/media/pom.xml new file mode 100644 index 00000000000..fdb2bfd3319 --- /dev/null +++ b/http/media/media/pom.xml @@ -0,0 +1,108 @@ + + + + 4.0.0 + + io.helidon.http.media + helidon-http-media-project + 4.0.0-SNAPSHOT + + + helidon-http-media + Helidon HTTP Media + + + + io.helidon.common + helidon-common + + + io.helidon.common + helidon-common-uri + + + io.helidon.http + helidon-http + + + io.helidon.common + helidon-common-buffers + + + io.helidon.config + helidon-config-metadata + true + + + io.helidon.common.features + helidon-common-features-api + true + + + io.helidon.builder + helidon-builder-api + true + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + io.helidon.builder + helidon-builder-processor + ${helidon.version} + + + + + + io.helidon.builder + helidon-builder-processor + ${helidon.version} + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + + + + diff --git a/nima/http/media/media/src/main/java/io/helidon/nima/http/media/EntityReader.java b/http/media/media/src/main/java/io/helidon/http/media/EntityReader.java similarity index 95% rename from nima/http/media/media/src/main/java/io/helidon/nima/http/media/EntityReader.java rename to http/media/media/src/main/java/io/helidon/http/media/EntityReader.java index ad0ea68ffcb..91a1db12f9e 100644 --- a/nima/http/media/media/src/main/java/io/helidon/nima/http/media/EntityReader.java +++ b/http/media/media/src/main/java/io/helidon/http/media/EntityReader.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.nima.http.media; +package io.helidon.http.media; import java.io.InputStream; import io.helidon.common.GenericType; -import io.helidon.common.http.Headers; +import io.helidon.http.Headers; /** * Reader of entity into a specific type. diff --git a/nima/http/media/media/src/main/java/io/helidon/nima/http/media/EntityWriter.java b/http/media/media/src/main/java/io/helidon/http/media/EntityWriter.java similarity index 93% rename from nima/http/media/media/src/main/java/io/helidon/nima/http/media/EntityWriter.java rename to http/media/media/src/main/java/io/helidon/http/media/EntityWriter.java index ef2fb618897..3a5054a3ead 100644 --- a/nima/http/media/media/src/main/java/io/helidon/nima/http/media/EntityWriter.java +++ b/http/media/media/src/main/java/io/helidon/http/media/EntityWriter.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.helidon.nima.http.media; +package io.helidon.http.media; import java.io.OutputStream; import io.helidon.common.GenericType; -import io.helidon.common.http.Headers; -import io.helidon.common.http.WritableHeaders; +import io.helidon.http.Headers; +import io.helidon.http.WritableHeaders; /** * Writer of entity into bytes. diff --git a/nima/http/media/media/src/main/java/io/helidon/nima/http/media/FormParamsSupport.java b/http/media/media/src/main/java/io/helidon/http/media/FormParamsSupport.java similarity index 98% rename from nima/http/media/media/src/main/java/io/helidon/nima/http/media/FormParamsSupport.java rename to http/media/media/src/main/java/io/helidon/http/media/FormParamsSupport.java index d39a8a8e042..33dd12e1286 100644 --- a/nima/http/media/media/src/main/java/io/helidon/nima/http/media/FormParamsSupport.java +++ b/http/media/media/src/main/java/io/helidon/http/media/FormParamsSupport.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.media; +package io.helidon.http.media; import java.io.IOException; import java.io.InputStream; @@ -32,14 +32,14 @@ import java.util.regex.Pattern; import io.helidon.common.GenericType; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.Header; -import io.helidon.common.http.HttpMediaType; -import io.helidon.common.http.WritableHeaders; import io.helidon.common.media.type.MediaTypes; import io.helidon.common.parameters.Parameters; import io.helidon.common.uri.UriEncoding; +import io.helidon.http.Headers; +import io.helidon.http.Http; +import io.helidon.http.Http.Header; +import io.helidon.http.HttpMediaType; +import io.helidon.http.WritableHeaders; /** * Media support for {@link io.helidon.common.media.type.MediaTypes#APPLICATION_FORM_URLENCODED} and its plaintext counterpart. diff --git a/nima/http/media/media/src/main/java/io/helidon/nima/http/media/MediaContext.java b/http/media/media/src/main/java/io/helidon/http/media/MediaContext.java similarity index 97% rename from nima/http/media/media/src/main/java/io/helidon/nima/http/media/MediaContext.java rename to http/media/media/src/main/java/io/helidon/http/media/MediaContext.java index 3a9ffd82bfd..978f6c4f8dc 100644 --- a/nima/http/media/media/src/main/java/io/helidon/nima/http/media/MediaContext.java +++ b/http/media/media/src/main/java/io/helidon/http/media/MediaContext.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package io.helidon.nima.http.media; +package io.helidon.http.media; import java.util.function.Consumer; import io.helidon.builder.api.RuntimeType; import io.helidon.common.GenericType; import io.helidon.common.config.Config; -import io.helidon.common.http.Headers; -import io.helidon.common.http.WritableHeaders; +import io.helidon.http.Headers; +import io.helidon.http.WritableHeaders; /** * Media context to obtain readers and writers of various supported content types. diff --git a/nima/http/media/media/src/main/java/io/helidon/nima/http/media/MediaContextBuilderDecorator.java b/http/media/media/src/main/java/io/helidon/http/media/MediaContextBuilderDecorator.java similarity index 96% rename from nima/http/media/media/src/main/java/io/helidon/nima/http/media/MediaContextBuilderDecorator.java rename to http/media/media/src/main/java/io/helidon/http/media/MediaContextBuilderDecorator.java index 758ea82a654..0f6e01a5a87 100644 --- a/nima/http/media/media/src/main/java/io/helidon/nima/http/media/MediaContextBuilderDecorator.java +++ b/http/media/media/src/main/java/io/helidon/http/media/MediaContextBuilderDecorator.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.media; +package io.helidon.http.media; import io.helidon.builder.api.Prototype; diff --git a/nima/http/media/media/src/main/java/io/helidon/nima/http/media/MediaContextConfigBlueprint.java b/http/media/media/src/main/java/io/helidon/http/media/MediaContextConfigBlueprint.java similarity index 95% rename from nima/http/media/media/src/main/java/io/helidon/nima/http/media/MediaContextConfigBlueprint.java rename to http/media/media/src/main/java/io/helidon/http/media/MediaContextConfigBlueprint.java index 2eb105d8bc2..8da9c2c5ad8 100644 --- a/nima/http/media/media/src/main/java/io/helidon/nima/http/media/MediaContextConfigBlueprint.java +++ b/http/media/media/src/main/java/io/helidon/http/media/MediaContextConfigBlueprint.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.media; +package io.helidon.http.media; import java.util.List; import java.util.Optional; @@ -22,7 +22,7 @@ import io.helidon.builder.api.Prototype; import io.helidon.config.metadata.Configured; import io.helidon.config.metadata.ConfiguredOption; -import io.helidon.nima.http.media.spi.MediaSupportProvider; +import io.helidon.http.media.spi.MediaSupportProvider; @Prototype.Blueprint(decorator = MediaContextBuilderDecorator.class) @Configured diff --git a/nima/http/media/media/src/main/java/io/helidon/nima/http/media/MediaContextImpl.java b/http/media/media/src/main/java/io/helidon/http/media/MediaContextImpl.java similarity index 96% rename from nima/http/media/media/src/main/java/io/helidon/nima/http/media/MediaContextImpl.java rename to http/media/media/src/main/java/io/helidon/http/media/MediaContextImpl.java index 7f479a32b3c..20325e8c142 100644 --- a/nima/http/media/media/src/main/java/io/helidon/nima/http/media/MediaContextImpl.java +++ b/http/media/media/src/main/java/io/helidon/http/media/MediaContextImpl.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.media; +package io.helidon.http.media; import java.io.IOException; import java.io.InputStream; @@ -25,13 +25,13 @@ import java.util.concurrent.atomic.AtomicBoolean; import io.helidon.common.GenericType; -import io.helidon.common.http.Headers; -import io.helidon.common.http.WritableHeaders; -import io.helidon.nima.http.media.MediaSupport.ReaderResponse; -import io.helidon.nima.http.media.MediaSupport.WriterResponse; +import io.helidon.http.Headers; +import io.helidon.http.WritableHeaders; +import io.helidon.http.media.MediaSupport.ReaderResponse; +import io.helidon.http.media.MediaSupport.WriterResponse; -import static io.helidon.nima.http.media.MediaSupport.SupportLevel.COMPATIBLE; -import static io.helidon.nima.http.media.MediaSupport.SupportLevel.SUPPORTED; +import static io.helidon.http.media.MediaSupport.SupportLevel.COMPATIBLE; +import static io.helidon.http.media.MediaSupport.SupportLevel.SUPPORTED; @SuppressWarnings("unchecked") class MediaContextImpl implements MediaContext { diff --git a/nima/http/media/media/src/main/java/io/helidon/nima/http/media/MediaSupport.java b/http/media/media/src/main/java/io/helidon/http/media/MediaSupport.java similarity index 94% rename from nima/http/media/media/src/main/java/io/helidon/nima/http/media/MediaSupport.java rename to http/media/media/src/main/java/io/helidon/http/media/MediaSupport.java index 6b769b30ab3..46d00dc0b9c 100644 --- a/nima/http/media/media/src/main/java/io/helidon/nima/http/media/MediaSupport.java +++ b/http/media/media/src/main/java/io/helidon/http/media/MediaSupport.java @@ -14,22 +14,22 @@ * limitations under the License. */ -package io.helidon.nima.http.media; +package io.helidon.http.media; import java.util.function.Supplier; import io.helidon.common.GenericType; import io.helidon.common.config.NamedService; -import io.helidon.common.http.Headers; -import io.helidon.common.http.WritableHeaders; +import io.helidon.http.Headers; +import io.helidon.http.WritableHeaders; /** - * Media support to be registered with {@link io.helidon.nima.http.media.MediaContext}. + * Media support to be registered with {@link MediaContext}. */ public interface MediaSupport extends NamedService { /** * Once all providers are discovered/configured and context is established, - * the {@link io.helidon.nima.http.media.MediaContext} calls this + * the {@link MediaContext} calls this * method on all providers to allow sub-resolution of readers and writers. * * @param context media context context diff --git a/nima/http/media/media/src/main/java/io/helidon/nima/http/media/PathSupport.java b/http/media/media/src/main/java/io/helidon/http/media/PathSupport.java similarity index 95% rename from nima/http/media/media/src/main/java/io/helidon/nima/http/media/PathSupport.java rename to http/media/media/src/main/java/io/helidon/http/media/PathSupport.java index 59f47092aaf..dcbbbdfed45 100644 --- a/nima/http/media/media/src/main/java/io/helidon/nima/http/media/PathSupport.java +++ b/http/media/media/src/main/java/io/helidon/http/media/PathSupport.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.media; +package io.helidon.http.media; import java.io.IOException; import java.io.InputStream; @@ -25,12 +25,12 @@ import java.util.Objects; import io.helidon.common.GenericType; -import io.helidon.common.http.ContentDisposition; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; -import io.helidon.common.http.WritableHeaders; import io.helidon.common.media.type.MediaType; import io.helidon.common.media.type.MediaTypes; +import io.helidon.http.ContentDisposition; +import io.helidon.http.Headers; +import io.helidon.http.Http; +import io.helidon.http.WritableHeaders; /** * Media support for Path. diff --git a/nima/http/media/media/src/main/java/io/helidon/nima/http/media/ReadableEntity.java b/http/media/media/src/main/java/io/helidon/http/media/ReadableEntity.java similarity index 91% rename from nima/http/media/media/src/main/java/io/helidon/nima/http/media/ReadableEntity.java rename to http/media/media/src/main/java/io/helidon/http/media/ReadableEntity.java index e498bc58f44..a5630e0fa23 100644 --- a/nima/http/media/media/src/main/java/io/helidon/nima/http/media/ReadableEntity.java +++ b/http/media/media/src/main/java/io/helidon/http/media/ReadableEntity.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.media; +package io.helidon.http.media; import java.io.IOException; import java.io.InputStream; @@ -37,7 +37,7 @@ public interface ReadableEntity { /** * Get the entity as a specific class. - * The entity will use {@link io.helidon.nima.http.media.MediaContext} to find correct media mapper. + * The entity will use {@link MediaContext} to find correct media mapper. * * @param type class of the entity * @param type of the entity @@ -51,7 +51,7 @@ default T as(Class type) { /** * Get the entity as a specific type. - * The entity will use {@link io.helidon.nima.http.media.MediaContext} to find correct media mapper. + * The entity will use {@link MediaContext} to find correct media mapper. * * @param type generic type of the entity * @param type of the entity diff --git a/nima/http/media/media/src/main/java/io/helidon/nima/http/media/ReadableEntityBase.java b/http/media/media/src/main/java/io/helidon/http/media/ReadableEntityBase.java similarity index 99% rename from nima/http/media/media/src/main/java/io/helidon/nima/http/media/ReadableEntityBase.java rename to http/media/media/src/main/java/io/helidon/http/media/ReadableEntityBase.java index 20204aee4f3..3876bb2abd9 100644 --- a/nima/http/media/media/src/main/java/io/helidon/nima/http/media/ReadableEntityBase.java +++ b/http/media/media/src/main/java/io/helidon/http/media/ReadableEntityBase.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.media; +package io.helidon.http.media; import java.io.ByteArrayInputStream; import java.io.IOException; diff --git a/nima/http/media/media/src/main/java/io/helidon/nima/http/media/StringSupport.java b/http/media/media/src/main/java/io/helidon/http/media/StringSupport.java similarity index 95% rename from nima/http/media/media/src/main/java/io/helidon/nima/http/media/StringSupport.java rename to http/media/media/src/main/java/io/helidon/http/media/StringSupport.java index cb5d6fe673f..4bdb583f1a9 100644 --- a/nima/http/media/media/src/main/java/io/helidon/nima/http/media/StringSupport.java +++ b/http/media/media/src/main/java/io/helidon/http/media/StringSupport.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.media; +package io.helidon.http.media; import java.io.IOException; import java.io.InputStream; @@ -26,12 +26,12 @@ import java.util.Optional; import io.helidon.common.GenericType; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.Header; -import io.helidon.common.http.HttpMediaType; -import io.helidon.common.http.HttpMediaTypes; -import io.helidon.common.http.WritableHeaders; +import io.helidon.http.Headers; +import io.helidon.http.Http; +import io.helidon.http.Http.Header; +import io.helidon.http.HttpMediaType; +import io.helidon.http.HttpMediaTypes; +import io.helidon.http.WritableHeaders; /** * Media support for strings. diff --git a/http/media/media/src/main/java/io/helidon/http/media/package-info.java b/http/media/media/src/main/java/io/helidon/http/media/package-info.java new file mode 100644 index 00000000000..eccb78033e4 --- /dev/null +++ b/http/media/media/src/main/java/io/helidon/http/media/package-info.java @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon Media Support. + * Provides a mechanism for reading/writing entity as a specific type. + */ +package io.helidon.http.media; diff --git a/nima/http/media/media/src/main/java/io/helidon/nima/http/media/spi/MediaSupportProvider.java b/http/media/media/src/main/java/io/helidon/http/media/spi/MediaSupportProvider.java similarity index 90% rename from nima/http/media/media/src/main/java/io/helidon/nima/http/media/spi/MediaSupportProvider.java rename to http/media/media/src/main/java/io/helidon/http/media/spi/MediaSupportProvider.java index d876b600f81..05879580553 100644 --- a/nima/http/media/media/src/main/java/io/helidon/nima/http/media/spi/MediaSupportProvider.java +++ b/http/media/media/src/main/java/io/helidon/http/media/spi/MediaSupportProvider.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.helidon.nima.http.media.spi; +package io.helidon.http.media.spi; import io.helidon.common.config.ConfiguredProvider; -import io.helidon.nima.http.media.MediaSupport; +import io.helidon.http.media.MediaSupport; /** * {@link java.util.ServiceLoader} service provider for media supports. diff --git a/http/media/media/src/main/java/io/helidon/http/media/spi/package-info.java b/http/media/media/src/main/java/io/helidon/http/media/spi/package-info.java new file mode 100644 index 00000000000..abe358382a1 --- /dev/null +++ b/http/media/media/src/main/java/io/helidon/http/media/spi/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon Media Support SPI. + */ +package io.helidon.http.media.spi; diff --git a/http/media/media/src/main/java/module-info.java b/http/media/media/src/main/java/module-info.java new file mode 100644 index 00000000000..740d71b82d9 --- /dev/null +++ b/http/media/media/src/main/java/module-info.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.common.features.api.Feature; +import io.helidon.common.features.api.HelidonFlavor; +import io.helidon.http.media.spi.MediaSupportProvider; + +/** + * Helidon Media Support. + * Provides a mechanism for reading/writing entity as a specific type. + */ +@Feature(value = "Media", + description = "Media Support", + in = HelidonFlavor.SE, + path = "Media" +) +module io.helidon.http.media { + requires static io.helidon.common.features.api; + requires static io.helidon.builder.api; + requires static io.helidon.config.metadata; + + requires transitive io.helidon.common; + requires transitive io.helidon.http; + requires transitive io.helidon.common.media.type; + requires io.helidon.common.buffers; + requires io.helidon.common.uri; + + exports io.helidon.http.media; + exports io.helidon.http.media.spi; + + uses MediaSupportProvider; +} diff --git a/nima/http/media/media/src/test/java/io/helidon/nima/http/media/FormParamPatternTest.java b/http/media/media/src/test/java/io/helidon/http/media/FormParamPatternTest.java similarity index 98% rename from nima/http/media/media/src/test/java/io/helidon/nima/http/media/FormParamPatternTest.java rename to http/media/media/src/test/java/io/helidon/http/media/FormParamPatternTest.java index d97424e00ef..cc3fbaca227 100644 --- a/nima/http/media/media/src/test/java/io/helidon/nima/http/media/FormParamPatternTest.java +++ b/http/media/media/src/test/java/io/helidon/http/media/FormParamPatternTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.media; +package io.helidon.http.media; import java.util.ArrayList; import java.util.List; diff --git a/http/media/multipart/pom.xml b/http/media/multipart/pom.xml new file mode 100644 index 00000000000..3a2d4014368 --- /dev/null +++ b/http/media/multipart/pom.xml @@ -0,0 +1,69 @@ + + + + 4.0.0 + + io.helidon.http.media + helidon-http-media-project + 4.0.0-SNAPSHOT + + + helidon-http-media-multipart + Helidon HTTP Media Multipart + + + + io.helidon.http.media + helidon-http-media + + + io.helidon.common.features + helidon-common-features-api + true + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + + + + + diff --git a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/MultiPart.java b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/MultiPart.java similarity index 91% rename from nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/MultiPart.java rename to http/media/multipart/src/main/java/io/helidon/http/media/multipart/MultiPart.java index 371c4361ef9..fa54ec137f0 100644 --- a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/MultiPart.java +++ b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/MultiPart.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.media.multipart; +package io.helidon.http.media.multipart; import java.util.Iterator; diff --git a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/MultiPartImpl.java b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/MultiPartImpl.java similarity index 93% rename from nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/MultiPartImpl.java rename to http/media/multipart/src/main/java/io/helidon/http/media/multipart/MultiPartImpl.java index 116aea76e81..cf9b92e61db 100644 --- a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/MultiPartImpl.java +++ b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/MultiPartImpl.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.media.multipart; +package io.helidon.http.media.multipart; import java.io.IOException; import java.io.InputStream; @@ -23,10 +23,10 @@ import java.util.NoSuchElementException; import io.helidon.common.buffers.DataReader; -import io.helidon.common.http.Http.HeaderNames; -import io.helidon.common.http.Http1HeadersParser; -import io.helidon.common.http.WritableHeaders; -import io.helidon.nima.http.media.MediaContext; +import io.helidon.http.Http.HeaderNames; +import io.helidon.http.Http1HeadersParser; +import io.helidon.http.WritableHeaders; +import io.helidon.http.media.MediaContext; class MultiPartImpl extends MultiPart { private final String boundary; diff --git a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/MultiPartReader.java b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/MultiPartReader.java similarity index 88% rename from nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/MultiPartReader.java rename to http/media/multipart/src/main/java/io/helidon/http/media/multipart/MultiPartReader.java index 179ab9109b2..c80fbda5b4a 100644 --- a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/MultiPartReader.java +++ b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/MultiPartReader.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.nima.http.media.multipart; +package io.helidon.http.media.multipart; import java.io.InputStream; import io.helidon.common.GenericType; -import io.helidon.common.http.Headers; -import io.helidon.nima.http.media.EntityReader; -import io.helidon.nima.http.media.MediaContext; +import io.helidon.http.Headers; +import io.helidon.http.media.EntityReader; +import io.helidon.http.media.MediaContext; class MultiPartReader implements EntityReader { private final MediaContext context; diff --git a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/MultiPartSupport.java b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/MultiPartSupport.java similarity index 96% rename from nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/MultiPartSupport.java rename to http/media/multipart/src/main/java/io/helidon/http/media/multipart/MultiPartSupport.java index b189c7f813c..95db0b96ac5 100644 --- a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/MultiPartSupport.java +++ b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/MultiPartSupport.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.media.multipart; +package io.helidon.http.media.multipart; import java.lang.System.Logger.Level; import java.util.Objects; @@ -22,14 +22,14 @@ import io.helidon.common.GenericType; import io.helidon.common.config.Config; -import io.helidon.common.http.Headers; -import io.helidon.common.http.HttpMediaType; -import io.helidon.common.http.WritableHeaders; import io.helidon.common.media.type.MediaTypes; -import io.helidon.nima.http.media.EntityReader; -import io.helidon.nima.http.media.EntityWriter; -import io.helidon.nima.http.media.MediaContext; -import io.helidon.nima.http.media.MediaSupport; +import io.helidon.http.Headers; +import io.helidon.http.HttpMediaType; +import io.helidon.http.WritableHeaders; +import io.helidon.http.media.EntityReader; +import io.helidon.http.media.EntityWriter; +import io.helidon.http.media.MediaContext; +import io.helidon.http.media.MediaSupport; /** * Media support implementation for support of multipart. diff --git a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/MultiPartSupportProvider.java b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/MultiPartSupportProvider.java similarity index 88% rename from nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/MultiPartSupportProvider.java rename to http/media/multipart/src/main/java/io/helidon/http/media/multipart/MultiPartSupportProvider.java index bd535c8ff7f..e53df807d0e 100644 --- a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/MultiPartSupportProvider.java +++ b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/MultiPartSupportProvider.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.helidon.nima.http.media.multipart; +package io.helidon.http.media.multipart; import io.helidon.common.config.Config; -import io.helidon.nima.http.media.MediaSupport; -import io.helidon.nima.http.media.spi.MediaSupportProvider; +import io.helidon.http.media.MediaSupport; +import io.helidon.http.media.spi.MediaSupportProvider; /** * {@link java.util.ServiceLoader} provider implementation for support of multipart. diff --git a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/MultiPartWriter.java b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/MultiPartWriter.java similarity index 93% rename from nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/MultiPartWriter.java rename to http/media/multipart/src/main/java/io/helidon/http/media/multipart/MultiPartWriter.java index e2e6b23db9f..b95ac836a26 100644 --- a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/MultiPartWriter.java +++ b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/MultiPartWriter.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.media.multipart; +package io.helidon.http.media.multipart; import java.io.BufferedOutputStream; import java.io.IOException; @@ -23,12 +23,12 @@ import java.nio.charset.StandardCharsets; import io.helidon.common.GenericType; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpMediaType; -import io.helidon.common.http.WritableHeaders; -import io.helidon.nima.http.media.EntityWriter; -import io.helidon.nima.http.media.MediaContext; +import io.helidon.http.Headers; +import io.helidon.http.Http; +import io.helidon.http.HttpMediaType; +import io.helidon.http.WritableHeaders; +import io.helidon.http.media.EntityWriter; +import io.helidon.http.media.MediaContext; class MultiPartWriter implements EntityWriter { private final MediaContext context; diff --git a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/ReadablePart.java b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/ReadablePart.java similarity index 83% rename from nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/ReadablePart.java rename to http/media/multipart/src/main/java/io/helidon/http/media/multipart/ReadablePart.java index 5b9ebcfdc03..e09a4a1414a 100644 --- a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/ReadablePart.java +++ b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/ReadablePart.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.helidon.nima.http.media.multipart; +package io.helidon.http.media.multipart; import java.util.Optional; -import io.helidon.common.http.Headers; -import io.helidon.common.http.HttpMediaType; -import io.helidon.nima.http.media.ReadableEntity; +import io.helidon.http.Headers; +import io.helidon.http.HttpMediaType; +import io.helidon.http.media.ReadableEntity; /** * A single part of a multipart message. diff --git a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/ReadablePartAbstract.java b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/ReadablePartAbstract.java similarity index 88% rename from nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/ReadablePartAbstract.java rename to http/media/multipart/src/main/java/io/helidon/http/media/multipart/ReadablePartAbstract.java index e9f2b829cb4..2361a91b8a1 100644 --- a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/ReadablePartAbstract.java +++ b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/ReadablePartAbstract.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package io.helidon.nima.http.media.multipart; +package io.helidon.http.media.multipart; import java.util.Optional; -import io.helidon.common.http.ContentDisposition; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpMediaType; -import io.helidon.common.http.HttpMediaTypes; -import io.helidon.nima.http.media.ReadableEntity; +import io.helidon.http.ContentDisposition; +import io.helidon.http.Headers; +import io.helidon.http.Http; +import io.helidon.http.HttpMediaType; +import io.helidon.http.HttpMediaTypes; +import io.helidon.http.media.ReadableEntity; abstract class ReadablePartAbstract implements ReadablePart { private final Headers headers; diff --git a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/ReadablePartLength.java b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/ReadablePartLength.java similarity index 95% rename from nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/ReadablePartLength.java rename to http/media/multipart/src/main/java/io/helidon/http/media/multipart/ReadablePartLength.java index e04f183ebdd..8d0340e3591 100644 --- a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/ReadablePartLength.java +++ b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/ReadablePartLength.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,15 +14,15 @@ * limitations under the License. */ -package io.helidon.nima.http.media.multipart; +package io.helidon.http.media.multipart; import java.io.InputStream; import io.helidon.common.GenericType; import io.helidon.common.buffers.BufferData; import io.helidon.common.buffers.DataReader; -import io.helidon.common.http.WritableHeaders; -import io.helidon.nima.http.media.MediaContext; +import io.helidon.http.WritableHeaders; +import io.helidon.http.media.MediaContext; class ReadablePartLength extends ReadablePartAbstract { private final MediaContext context; diff --git a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/ReadablePartNoLength.java b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/ReadablePartNoLength.java similarity index 96% rename from nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/ReadablePartNoLength.java rename to http/media/multipart/src/main/java/io/helidon/http/media/multipart/ReadablePartNoLength.java index 46647dac8b2..7cf3a8d6ef1 100644 --- a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/ReadablePartNoLength.java +++ b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/ReadablePartNoLength.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.media.multipart; +package io.helidon.http.media.multipart; import java.io.InputStream; import java.nio.charset.StandardCharsets; @@ -22,8 +22,8 @@ import io.helidon.common.GenericType; import io.helidon.common.buffers.BufferData; import io.helidon.common.buffers.DataReader; -import io.helidon.common.http.WritableHeaders; -import io.helidon.nima.http.media.MediaContext; +import io.helidon.http.WritableHeaders; +import io.helidon.http.media.MediaContext; class ReadablePartNoLength extends ReadablePartAbstract { private final MediaContext context; diff --git a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/WriteableMultiPart.java b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/WriteableMultiPart.java similarity index 96% rename from nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/WriteableMultiPart.java rename to http/media/multipart/src/main/java/io/helidon/http/media/multipart/WriteableMultiPart.java index 713adf7c6bd..832246c92d3 100644 --- a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/WriteableMultiPart.java +++ b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/WriteableMultiPart.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.media.multipart; +package io.helidon.http.media.multipart; import java.util.ArrayList; import java.util.Iterator; diff --git a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/WriteableMultiPartImpl.java b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/WriteableMultiPartImpl.java similarity index 90% rename from nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/WriteableMultiPartImpl.java rename to http/media/multipart/src/main/java/io/helidon/http/media/multipart/WriteableMultiPartImpl.java index 1e60b6ba8e6..82066ed43a3 100644 --- a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/WriteableMultiPartImpl.java +++ b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/WriteableMultiPartImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.media.multipart; +package io.helidon.http.media.multipart; import java.util.Iterator; diff --git a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/WriteablePart.java b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/WriteablePart.java similarity index 94% rename from nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/WriteablePart.java rename to http/media/multipart/src/main/java/io/helidon/http/media/multipart/WriteablePart.java index adf7c9960ae..f1d5f443f74 100644 --- a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/WriteablePart.java +++ b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/WriteablePart.java @@ -14,19 +14,19 @@ * limitations under the License. */ -package io.helidon.nima.http.media.multipart; +package io.helidon.http.media.multipart; import java.io.InputStream; import java.io.OutputStream; import java.util.Optional; import java.util.function.Supplier; -import io.helidon.common.http.Headers; -import io.helidon.common.http.HttpMediaType; -import io.helidon.common.http.HttpMediaTypes; -import io.helidon.common.http.WritableHeaders; import io.helidon.common.media.type.MediaType; -import io.helidon.nima.http.media.MediaContext; +import io.helidon.http.Headers; +import io.helidon.http.HttpMediaType; +import io.helidon.http.HttpMediaTypes; +import io.helidon.http.WritableHeaders; +import io.helidon.http.media.MediaContext; /** * A single part of a {@link WriteableMultiPart} message. @@ -155,7 +155,7 @@ public Builder contentType(MediaType mediaType) { } /** - * Configure content to be serialized using {@link io.helidon.nima.http.media.MediaContext}. + * Configure content to be serialized using {@link io.helidon.http.media.MediaContext}. * * @param content content to use * @return updated builder @@ -172,7 +172,7 @@ public Builder content(Object content) { } /** - * Configure content to be serialized using {@link io.helidon.nima.http.media.MediaContext}. + * Configure content to be serialized using {@link io.helidon.http.media.MediaContext}. * * @param contentSupplier content supplier to use, will be called when serializing the message * @return updated builder diff --git a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/WriteablePartAbstract.java b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/WriteablePartAbstract.java similarity index 93% rename from nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/WriteablePartAbstract.java rename to http/media/multipart/src/main/java/io/helidon/http/media/multipart/WriteablePartAbstract.java index 02f357039a1..c7e7166a64f 100644 --- a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/WriteablePartAbstract.java +++ b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/WriteablePartAbstract.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.media.multipart; +package io.helidon.http.media.multipart; import java.io.IOException; import java.io.OutputStream; @@ -25,12 +25,12 @@ import java.util.Optional; import io.helidon.common.buffers.BufferData; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderNames; -import io.helidon.common.http.HttpMediaType; -import io.helidon.common.http.WritableHeaders; import io.helidon.common.media.type.MediaTypes; +import io.helidon.http.Headers; +import io.helidon.http.Http; +import io.helidon.http.Http.HeaderNames; +import io.helidon.http.HttpMediaType; +import io.helidon.http.WritableHeaders; import static java.nio.charset.StandardCharsets.UTF_8; diff --git a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/WriteablePartBytes.java b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/WriteablePartBytes.java similarity index 86% rename from nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/WriteablePartBytes.java rename to http/media/multipart/src/main/java/io/helidon/http/media/multipart/WriteablePartBytes.java index 243f37a4f1d..788162e04ac 100644 --- a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/WriteablePartBytes.java +++ b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/WriteablePartBytes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.helidon.nima.http.media.multipart; +package io.helidon.http.media.multipart; import java.io.OutputStream; -import io.helidon.common.http.Headers; -import io.helidon.common.http.WritableHeaders; -import io.helidon.nima.http.media.MediaContext; +import io.helidon.http.Headers; +import io.helidon.http.WritableHeaders; +import io.helidon.http.media.MediaContext; class WriteablePartBytes extends WriteablePartAbstract { private final byte[] bytes; diff --git a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/WriteablePartObject.java b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/WriteablePartObject.java similarity index 90% rename from nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/WriteablePartObject.java rename to http/media/multipart/src/main/java/io/helidon/http/media/multipart/WriteablePartObject.java index 651f043a2fe..e459e4fb185 100644 --- a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/WriteablePartObject.java +++ b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/WriteablePartObject.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,17 +14,17 @@ * limitations under the License. */ -package io.helidon.nima.http.media.multipart; +package io.helidon.http.media.multipart; import java.io.ByteArrayOutputStream; import java.io.OutputStream; import java.util.function.Supplier; import io.helidon.common.GenericType; -import io.helidon.common.http.Headers; -import io.helidon.common.http.WritableHeaders; -import io.helidon.nima.http.media.EntityWriter; -import io.helidon.nima.http.media.MediaContext; +import io.helidon.http.Headers; +import io.helidon.http.WritableHeaders; +import io.helidon.http.media.EntityWriter; +import io.helidon.http.media.MediaContext; class WriteablePartObject extends WriteablePartAbstract { private final Supplier objectContent; diff --git a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/WriteablePartStream.java b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/WriteablePartStream.java similarity index 88% rename from nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/WriteablePartStream.java rename to http/media/multipart/src/main/java/io/helidon/http/media/multipart/WriteablePartStream.java index 093ae4771c5..52e7431ed33 100644 --- a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/WriteablePartStream.java +++ b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/WriteablePartStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.media.multipart; +package io.helidon.http.media.multipart; import java.io.IOException; import java.io.InputStream; @@ -22,9 +22,9 @@ import java.io.UncheckedIOException; import java.util.function.Supplier; -import io.helidon.common.http.Headers; -import io.helidon.common.http.WritableHeaders; -import io.helidon.nima.http.media.MediaContext; +import io.helidon.http.Headers; +import io.helidon.http.WritableHeaders; +import io.helidon.http.media.MediaContext; class WriteablePartStream extends WriteablePartAbstract { private final Supplier stream; diff --git a/http/media/multipart/src/main/java/io/helidon/http/media/multipart/package-info.java b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/package-info.java new file mode 100644 index 00000000000..4ac243d8c47 --- /dev/null +++ b/http/media/multipart/src/main/java/io/helidon/http/media/multipart/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Multipart Entity Media handling support. + */ +package io.helidon.http.media.multipart; diff --git a/http/media/multipart/src/main/java/module-info.java b/http/media/multipart/src/main/java/module-info.java new file mode 100644 index 00000000000..7b10b4af40b --- /dev/null +++ b/http/media/multipart/src/main/java/module-info.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.common.features.api.Feature; +import io.helidon.common.features.api.HelidonFlavor; +import io.helidon.http.media.multipart.MultiPartSupportProvider; +import io.helidon.http.media.spi.MediaSupportProvider; + +/** + * Multipart media support. + */ +@Feature(value = "Multipart", + description = "Multipart media support", + in = HelidonFlavor.SE, + path = {"Media", "Multipart"} +) +module io.helidon.http.media.multipart { + requires static io.helidon.common.features.api; + + requires io.helidon.http; + requires io.helidon.http.media; + requires io.helidon.common.buffers; + + exports io.helidon.http.media.multipart; + + provides MediaSupportProvider with MultiPartSupportProvider; +} \ No newline at end of file diff --git a/http/media/pom.xml b/http/media/pom.xml new file mode 100644 index 00000000000..bac47928ed8 --- /dev/null +++ b/http/media/pom.xml @@ -0,0 +1,39 @@ + + + + 4.0.0 + + io.helidon.http + helidon-http-project + 4.0.0-SNAPSHOT + + + io.helidon.http.media + helidon-http-media-project + Helidon HTTP Media Project + pom + + + media + jsonb + jsonp + jackson + multipart + + diff --git a/http/pom.xml b/http/pom.xml new file mode 100644 index 00000000000..7fbf92fde3b --- /dev/null +++ b/http/pom.xml @@ -0,0 +1,53 @@ + + + + + 4.0.0 + + io.helidon + helidon-project + 4.0.0-SNAPSHOT + + + io.helidon.http + helidon-http-project + Helidon HTTP Project + + pom + + + encoding + http + http2 + media + processor + sse + + + + + tests + + tests + + + + diff --git a/http/processor/pom.xml b/http/processor/pom.xml new file mode 100644 index 00000000000..134148fd26c --- /dev/null +++ b/http/processor/pom.xml @@ -0,0 +1,54 @@ + + + + 4.0.0 + + io.helidon.http + helidon-http-project + 4.0.0-SNAPSHOT + + + helidon-http-processor + Helidon HTTP Annotation Processor + + + true + + + + + io.helidon.inject + helidon-inject-api + + + io.helidon.inject + helidon-inject-processor + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + diff --git a/nima/http/processor/src/main/java/io/helidon/nima/http/processor/HttpCreatorBase.java b/http/processor/src/main/java/io/helidon/http/processor/HttpCreatorBase.java similarity index 97% rename from nima/http/processor/src/main/java/io/helidon/nima/http/processor/HttpCreatorBase.java rename to http/processor/src/main/java/io/helidon/http/processor/HttpCreatorBase.java index d2d1061f03e..b7281fe6d38 100644 --- a/nima/http/processor/src/main/java/io/helidon/nima/http/processor/HttpCreatorBase.java +++ b/http/processor/src/main/java/io/helidon/http/processor/HttpCreatorBase.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.processor; +package io.helidon.http.processor; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; diff --git a/nima/http/processor/src/main/java/io/helidon/nima/http/processor/HttpEndpointCreator.java b/http/processor/src/main/java/io/helidon/http/processor/HttpEndpointCreator.java similarity index 94% rename from nima/http/processor/src/main/java/io/helidon/nima/http/processor/HttpEndpointCreator.java rename to http/processor/src/main/java/io/helidon/http/processor/HttpEndpointCreator.java index c3f16fc10f3..99a51902419 100644 --- a/nima/http/processor/src/main/java/io/helidon/nima/http/processor/HttpEndpointCreator.java +++ b/http/processor/src/main/java/io/helidon/http/processor/HttpEndpointCreator.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.processor; +package io.helidon.http.processor; import java.util.HashMap; import java.util.Map; @@ -35,8 +35,8 @@ */ public class HttpEndpointCreator extends HttpCreatorBase implements CustomAnnotationTemplateCreator { private static final System.Logger LOGGER = System.getLogger(HttpEndpointCreator.class.getName()); - private static final String PATH_ANNOTATION = "io.helidon.common.http.Endpoint.Path"; - private static final String LISTENER_ANNOTATION = "io.helidon.common.http.Endpoint.Listener"; + private static final String PATH_ANNOTATION = "io.helidon.http.Endpoint.Path"; + private static final String LISTENER_ANNOTATION = "io.helidon.http.Endpoint.Listener"; /** * Default constructor used by the {@link java.util.ServiceLoader}. @@ -63,7 +63,7 @@ public Optional create(CustomAnnotationTemplat .className(classname) .build(); - String template = Templates.loadTemplate("nima", "http-endpoint.java.hbs"); + String template = Templates.loadTemplate("helidon", "http-endpoint.java.hbs"); GenericTemplateCreatorRequest genericCreatorRequest = GenericTemplateCreatorRequest.builder() .customAnnotationTemplateRequest(request) .template(template) diff --git a/nima/http/processor/src/main/java/io/helidon/nima/http/processor/HttpMethodCreator.java b/http/processor/src/main/java/io/helidon/http/processor/HttpMethodCreator.java similarity index 94% rename from nima/http/processor/src/main/java/io/helidon/nima/http/processor/HttpMethodCreator.java rename to http/processor/src/main/java/io/helidon/http/processor/HttpMethodCreator.java index 19d0eb7f2dc..0eebb944882 100644 --- a/nima/http/processor/src/main/java/io/helidon/nima/http/processor/HttpMethodCreator.java +++ b/http/processor/src/main/java/io/helidon/http/processor/HttpMethodCreator.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http.processor; +package io.helidon.http.processor; import java.util.HashMap; import java.util.LinkedList; @@ -40,16 +40,16 @@ * Service provider implementation of a {@link CustomAnnotationTemplateCreator}. */ public class HttpMethodCreator extends HttpCreatorBase implements CustomAnnotationTemplateCreator { - private static final String PATH_ANNOTATION = "io.helidon.common.http.Endpoint.Path"; + private static final String PATH_ANNOTATION = "io.helidon.http.Endpoint.Path"; private static final TypeName PATH_ANNOTATION_TYPE = TypeName.create(PATH_ANNOTATION); - private static final String GET_ANNOTATION = "io.helidon.common.http.Endpoint.GET"; - private static final String HTTP_METHOD_ANNOTATION = "io.helidon.common.http.Endpoint.HttpMethod"; + private static final String GET_ANNOTATION = "io.helidon.http.Endpoint.GET"; + private static final String HTTP_METHOD_ANNOTATION = "io.helidon.http.Endpoint.HttpMethod"; private static final TypeName HTTP_METHOD_ANNOTATION_TYPE = TypeName.create(HTTP_METHOD_ANNOTATION); - private static final String POST_ANNOTATION = "io.helidon.common.http.Endpoint.POST"; - private static final String PATH_PARAM_ANNOTATION = "io.helidon.common.http.Endpoint.PathParam"; - private static final String HEADER_PARAM_ANNOTATION = "io.helidon.common.http.Endpoint.HeaderParam"; - private static final String QUERY_PARAM_ANNOTATION = "io.helidon.common.http.Endpoint.QueryParam"; - private static final String ENTITY_PARAM_ANNOTATION = "io.helidon.common.http.Endpoint.Entity"; + private static final String POST_ANNOTATION = "io.helidon.http.Endpoint.POST"; + private static final String PATH_PARAM_ANNOTATION = "io.helidon.http.Endpoint.PathParam"; + private static final String HEADER_PARAM_ANNOTATION = "io.helidon.http.Endpoint.HeaderParam"; + private static final String QUERY_PARAM_ANNOTATION = "io.helidon.http.Endpoint.QueryParam"; + private static final String ENTITY_PARAM_ANNOTATION = "io.helidon.http.Endpoint.Entity"; private static final String QUERY_NO_DEFAULT = "io.helidon.http.Endpoint.QueryParam_NO_DEFAULT_VALUE"; private static final Set PARAM_ANNOTATIONS = Set.of( @@ -95,7 +95,7 @@ public Optional create(CustomAnnotationTemplat GenericTemplateCreator genericTemplateCreator = request.genericTemplateCreator(); GenericTemplateCreatorRequest genericCreatorRequest = GenericTemplateCreatorRequest.builder() .customAnnotationTemplateRequest(request) - .template(Templates.loadTemplate("nima", "http-method.java.hbs")) + .template(Templates.loadTemplate("helidon", "http-method.java.hbs")) .generatedTypeName(generatedTypeName) .overrideProperties(addProperties(request)) .build(); @@ -131,8 +131,8 @@ private Map addProperties(CustomAnnotationTemplateRequest reques String type = elementArg.typeName().name(); switch (type) { - case "io.helidon.nima.webserver.http.ServerRequest" -> parameters.add("req,"); - case "io.helidon.nima.webserver.http.ServerResponse" -> parameters.add("res,"); + case "io.helidon.webserver.http.ServerRequest" -> parameters.add("req,"); + case "io.helidon.webserver.http.ServerResponse" -> parameters.add("res,"); default -> processParameter(http, parameters, headerList, type, elementArg); } } diff --git a/http/processor/src/main/java/io/helidon/http/processor/Templates.java b/http/processor/src/main/java/io/helidon/http/processor/Templates.java new file mode 100644 index 00000000000..71fb86b1dbf --- /dev/null +++ b/http/processor/src/main/java/io/helidon/http/processor/Templates.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.http.processor; + +import java.io.InputStream; +import java.nio.charset.StandardCharsets; + +final class Templates { + private Templates() { + } + + static String loadTemplate(String templateProfile, String name) { + String path = "templates/inject/" + templateProfile + "/" + name; + try { + InputStream in = Templates.class.getClassLoader().getResourceAsStream(path); + if (in == null) { + throw new RuntimeException("Could not find template " + path + " on classpath."); + } + try (in) { + return new String(in.readAllBytes(), StandardCharsets.UTF_8); + } + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} diff --git a/http/processor/src/main/java/io/helidon/http/processor/package-info.java b/http/processor/src/main/java/io/helidon/http/processor/package-info.java new file mode 100644 index 00000000000..c3fe8f70dbd --- /dev/null +++ b/http/processor/src/main/java/io/helidon/http/processor/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Annotation processor that generates HTTP Endpoints discoverable by Pico. + */ +package io.helidon.http.processor; diff --git a/http/processor/src/main/java/module-info.java b/http/processor/src/main/java/module-info.java new file mode 100644 index 00000000000..9270be3f76a --- /dev/null +++ b/http/processor/src/main/java/module-info.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.inject.tools.spi.CustomAnnotationTemplateCreator; +import io.helidon.http.processor.HttpEndpointCreator; +import io.helidon.http.processor.HttpMethodCreator; + +/** + * Annotation processor that generates HTTP Endpoints. + */ +module io.helidon.http.processor { + requires io.helidon.inject.api; + requires io.helidon.inject.tools; + requires io.helidon.inject.processor; + requires java.compiler; + + exports io.helidon.http.processor; + + provides CustomAnnotationTemplateCreator + with HttpEndpointCreator, HttpMethodCreator; +} diff --git a/nima/http/processor/src/main/resources/templates/inject/nima/http-endpoint.java.hbs b/http/processor/src/main/resources/templates/inject/helidon/http-endpoint.java.hbs similarity index 84% rename from nima/http/processor/src/main/resources/templates/inject/nima/http-endpoint.java.hbs rename to http/processor/src/main/resources/templates/inject/helidon/http-endpoint.java.hbs index 6e88b252eda..46ad4798493 100644 --- a/nima/http/processor/src/main/resources/templates/inject/nima/http-endpoint.java.hbs +++ b/http/processor/src/main/resources/templates/inject/helidon/http-endpoint.java.hbs @@ -18,12 +18,12 @@ package {{packageName}}; import java.util.List; import io.helidon.common.Weight; -import io.helidon.nima.webserver.http.GeneratedHandler; -import io.helidon.nima.webserver.http.Handler; -import io.helidon.nima.webserver.http.HttpFeature; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; +import io.helidon.webserver.http.GeneratedHandler; +import io.helidon.webserver.http.Handler; +import io.helidon.webserver.http.HttpFeature; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; import jakarta.inject.Inject; import jakarta.inject.Named; diff --git a/nima/http/processor/src/main/resources/templates/inject/nima/http-method.java.hbs b/http/processor/src/main/resources/templates/inject/helidon/http-method.java.hbs similarity index 90% rename from nima/http/processor/src/main/resources/templates/inject/nima/http-method.java.hbs rename to http/processor/src/main/resources/templates/inject/helidon/http-method.java.hbs index e35f9533ace..86263f11e3f 100644 --- a/nima/http/processor/src/main/resources/templates/inject/nima/http-method.java.hbs +++ b/http/processor/src/main/resources/templates/inject/helidon/http-method.java.hbs @@ -16,16 +16,16 @@ limitations under the License. package {{packageName}}; import io.helidon.common.Weight; -import io.helidon.common.http.Http; +import io.helidon.http.Http; -{{#if http.hasQueryParams}}import io.helidon.common.http.HttpException; +{{#if http.hasQueryParams}}import io.helidon.http.HttpException; import io.helidon.common.uri.UriQuery; {{/if}} -import io.helidon.nima.webserver.http.GeneratedHandler; -import io.helidon.nima.webserver.http.Handler; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.GeneratedHandler; +import io.helidon.webserver.http.Handler; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import jakarta.inject.Inject; import jakarta.inject.Named; diff --git a/http/sse/pom.xml b/http/sse/pom.xml new file mode 100644 index 00000000000..bd3500675b6 --- /dev/null +++ b/http/sse/pom.xml @@ -0,0 +1,67 @@ + + + + 4.0.0 + + io.helidon.http + helidon-http-project + 4.0.0-SNAPSHOT + + + helidon-http-sse + Helidon HTTP Server Sent Events + + + true + + + + + io.helidon.common + helidon-common + + + io.helidon.common + helidon-common-media-type + + + io.helidon.http + helidon-http + + + io.helidon.http.media + helidon-http-media + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + org.mockito + mockito-core + test + + + diff --git a/nima/sse/sse/src/main/java/io/helidon/nima/sse/SseEvent.java b/http/sse/src/main/java/io/helidon/http/sse/SseEvent.java similarity index 97% rename from nima/sse/sse/src/main/java/io/helidon/nima/sse/SseEvent.java rename to http/sse/src/main/java/io/helidon/http/sse/SseEvent.java index a9daa5745dd..d5f50e1a17f 100644 --- a/nima/sse/sse/src/main/java/io/helidon/nima/sse/SseEvent.java +++ b/http/sse/src/main/java/io/helidon/http/sse/SseEvent.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.sse; +package io.helidon.http.sse; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -26,12 +26,12 @@ import java.util.Optional; import io.helidon.common.GenericType; -import io.helidon.common.http.Http; -import io.helidon.common.http.WritableHeaders; import io.helidon.common.media.type.MediaType; import io.helidon.common.media.type.MediaTypes; -import io.helidon.nima.http.media.EntityReader; -import io.helidon.nima.http.media.MediaContext; +import io.helidon.http.Http; +import io.helidon.http.WritableHeaders; +import io.helidon.http.media.EntityReader; +import io.helidon.http.media.MediaContext; /** * An SSE event. diff --git a/http/sse/src/main/java/io/helidon/http/sse/package-info.java b/http/sse/src/main/java/io/helidon/http/sse/package-info.java new file mode 100644 index 00000000000..fbe703e19b1 --- /dev/null +++ b/http/sse/src/main/java/io/helidon/http/sse/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * HTTP SSE common package. Shares types between webclient and webserver modules. + */ +package io.helidon.http.sse; diff --git a/http/sse/src/main/java/module-info.java b/http/sse/src/main/java/module-info.java new file mode 100644 index 00000000000..408c8ad5257 --- /dev/null +++ b/http/sse/src/main/java/module-info.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * HTTP SSE common package. Shares types between webclient and webserver modules. + */ +module io.helidon.http.sse { + requires transitive io.helidon.common; + requires transitive io.helidon.common.media.type; + requires io.helidon.http.media; + requires io.helidon.http; + + exports io.helidon.http.sse; +} diff --git a/http/tests/encoding/deflate/pom.xml b/http/tests/encoding/deflate/pom.xml new file mode 100644 index 00000000000..39335cc3e55 --- /dev/null +++ b/http/tests/encoding/deflate/pom.xml @@ -0,0 +1,64 @@ + + + + 4.0.0 + + io.helidon.http.tests.encoding + helidon-http-tests-encoding-project + 4.0.0-SNAPSHOT + + + helidon-http-tests-integration-encoding-deflate + Helidon HTTP Tests Encoding deflate + + + + io.helidon.webserver + helidon-webserver + + + io.helidon.webserver + helidon-webserver-http2 + + + io.helidon.http.encoding + helidon-http-encoding-deflate + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 + test + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5-http2 + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + diff --git a/nima/tests/integration/encoding/deflate/src/test/java/io/helidon/nima/tests/integration/encoding/deflate/DeflateEncodingTest.java b/http/tests/encoding/deflate/src/test/java/io/helidon/http/tests/integration/encoding/deflate/DeflateEncodingTest.java similarity index 91% rename from nima/tests/integration/encoding/deflate/src/test/java/io/helidon/nima/tests/integration/encoding/deflate/DeflateEncodingTest.java rename to http/tests/encoding/deflate/src/test/java/io/helidon/http/tests/integration/encoding/deflate/DeflateEncodingTest.java index 60d23bd48de..d6ed5512152 100644 --- a/nima/tests/integration/encoding/deflate/src/test/java/io/helidon/nima/tests/integration/encoding/deflate/DeflateEncodingTest.java +++ b/http/tests/encoding/deflate/src/test/java/io/helidon/http/tests/integration/encoding/deflate/DeflateEncodingTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.tests.integration.encoding.deflate; +package io.helidon.http.tests.integration.encoding.deflate; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -31,15 +31,15 @@ import java.util.zip.DeflaterOutputStream; import java.util.zip.InflaterInputStream; -import io.helidon.common.http.Http; -import io.helidon.nima.http2.webclient.Http2Client; -import io.helidon.nima.http2.webserver.Http2Route; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.api.ClientResponseTyped; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.http1.Http1Route; +import io.helidon.http.Http; +import io.helidon.webclient.http2.Http2Client; +import io.helidon.webserver.http2.Http2Route; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webclient.api.ClientResponseTyped; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.http1.Http1Route; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -137,7 +137,7 @@ void testDeflateMultipleAcceptedEncodingsHttp2Client() { testIt(http2Client, "/http2", "br;q=0.9, gzip, *;q=0.1"); } - void testIt(io.helidon.nima.webclient.api.HttpClient client, String path, String acceptEncodingValue) { + void testIt(io.helidon.webclient.api.HttpClient client, String path, String acceptEncodingValue) { ClientResponseTyped response = client.put(path) .header(Http.HeaderNames.ACCEPT_ENCODING, acceptEncodingValue) .header(CONTENT_ENCODING_DEFLATE) diff --git a/nima/tests/integration/encoding/deflate/src/test/resources/logging-test.properties b/http/tests/encoding/deflate/src/test/resources/logging-test.properties similarity index 100% rename from nima/tests/integration/encoding/deflate/src/test/resources/logging-test.properties rename to http/tests/encoding/deflate/src/test/resources/logging-test.properties diff --git a/http/tests/encoding/gzip/pom.xml b/http/tests/encoding/gzip/pom.xml new file mode 100644 index 00000000000..f9817ccba0e --- /dev/null +++ b/http/tests/encoding/gzip/pom.xml @@ -0,0 +1,64 @@ + + + + 4.0.0 + + io.helidon.http.tests.encoding + helidon-http-tests-encoding-project + 4.0.0-SNAPSHOT + + + helidon-http-tests-encoding-gzip + Helidon HTTP Tests Encoding GZIP + + + + io.helidon.webserver + helidon-webserver + + + io.helidon.webserver + helidon-webserver-http2 + + + io.helidon.http.encoding + helidon-http-encoding-gzip + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 + test + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5-http2 + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + diff --git a/nima/tests/integration/encoding/gzip/src/test/java/io/helidon/nima/tests/integration/encoding/gzip/GzipEncodingTest.java b/http/tests/encoding/gzip/src/test/java/io/helidon/http/tests/integration/encoding/gzip/GzipEncodingTest.java similarity index 91% rename from nima/tests/integration/encoding/gzip/src/test/java/io/helidon/nima/tests/integration/encoding/gzip/GzipEncodingTest.java rename to http/tests/encoding/gzip/src/test/java/io/helidon/http/tests/integration/encoding/gzip/GzipEncodingTest.java index 6a5883e9435..4b5d1a3957a 100644 --- a/nima/tests/integration/encoding/gzip/src/test/java/io/helidon/nima/tests/integration/encoding/gzip/GzipEncodingTest.java +++ b/http/tests/encoding/gzip/src/test/java/io/helidon/http/tests/integration/encoding/gzip/GzipEncodingTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.tests.integration.encoding.gzip; +package io.helidon.http.tests.integration.encoding.gzip; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -30,15 +30,15 @@ import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; -import io.helidon.common.http.Http; -import io.helidon.nima.http2.webclient.Http2Client; -import io.helidon.nima.http2.webserver.Http2Route; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.api.ClientResponseTyped; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.http1.Http1Route; +import io.helidon.http.Http; +import io.helidon.webclient.http2.Http2Client; +import io.helidon.webserver.http2.Http2Route; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webclient.api.ClientResponseTyped; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.http1.Http1Route; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -137,7 +137,7 @@ void testDeflateMultipleAcceptedEncodingsHttp2Client() { testIt(http2Client, "/http2", "br;q=0.9, gzip, *;q=0.1"); } - void testIt(io.helidon.nima.webclient.api.HttpClient client, String path, String acceptEncodingValue) { + void testIt(io.helidon.webclient.api.HttpClient client, String path, String acceptEncodingValue) { ClientResponseTyped response = client.put(path) .header(Http.HeaderNames.ACCEPT_ENCODING, acceptEncodingValue) .header(CONTENT_ENCODING_GZIP) diff --git a/nima/tests/integration/encoding/gzip/src/test/resources/logging-test.properties b/http/tests/encoding/gzip/src/test/resources/logging-test.properties similarity index 100% rename from nima/tests/integration/encoding/gzip/src/test/resources/logging-test.properties rename to http/tests/encoding/gzip/src/test/resources/logging-test.properties diff --git a/http/tests/encoding/pom.xml b/http/tests/encoding/pom.xml new file mode 100644 index 00000000000..3a4969dab92 --- /dev/null +++ b/http/tests/encoding/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + io.helidon.http.tests + helidon-http-tests-project + 4.0.0-SNAPSHOT + + + io.helidon.http.tests.encoding + helidon-http-tests-encoding-project + Helidon HTTP Tests Encoding Project + pom + + + gzip + deflate + + diff --git a/http/tests/media/jsonb/pom.xml b/http/tests/media/jsonb/pom.xml new file mode 100644 index 00000000000..ebd08ae9817 --- /dev/null +++ b/http/tests/media/jsonb/pom.xml @@ -0,0 +1,56 @@ + + + + 4.0.0 + + io.helidon.http.tests.media + helidon-http-tests-media-project + 4.0.0-SNAPSHOT + + + helidon-http-tests-tegration-media-jsonb + Helidon HTTP Tests Media JSON-B + + + + io.helidon.webserver + helidon-webserver + + + io.helidon.http.media + helidon-http-media-jsonb + runtime + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + diff --git a/nima/tests/integration/media/jsonb/src/test/java/io/helidon/nima/tests/integration/media/jsonb/JsonbTest.java b/http/tests/media/jsonb/src/test/java/io/helidon/http/tests/integration/media/jsonb/JsonbTest.java similarity index 88% rename from nima/tests/integration/media/jsonb/src/test/java/io/helidon/nima/tests/integration/media/jsonb/JsonbTest.java rename to http/tests/media/jsonb/src/test/java/io/helidon/http/tests/integration/media/jsonb/JsonbTest.java index 68eeaa60c50..f21c0674bfd 100644 --- a/nima/tests/integration/media/jsonb/src/test/java/io/helidon/nima/tests/integration/media/jsonb/JsonbTest.java +++ b/http/tests/media/jsonb/src/test/java/io/helidon/http/tests/integration/media/jsonb/JsonbTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,19 +14,19 @@ * limitations under the License. */ -package io.helidon.nima.tests.integration.media.jsonb; +package io.helidon.http.tests.integration.media.jsonb; import java.util.Objects; import java.util.Optional; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpMediaType; +import io.helidon.http.Http; +import io.helidon.http.HttpMediaType; import io.helidon.common.media.type.MediaTypes; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.http.HttpRouting; import org.junit.jupiter.api.Test; diff --git a/http/tests/media/jsonp/pom.xml b/http/tests/media/jsonp/pom.xml new file mode 100644 index 00000000000..8d4b0d71df1 --- /dev/null +++ b/http/tests/media/jsonp/pom.xml @@ -0,0 +1,55 @@ + + + + 4.0.0 + + io.helidon.http.tests.media + helidon-http-tests-media-project + 4.0.0-SNAPSHOT + + + helidon-http-tests-media-jsonp + Helidon HTTP Tests Media JSON-P + + + + io.helidon.webserver + helidon-webserver + + + io.helidon.http.media + helidon-http-media-jsonp + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + diff --git a/nima/tests/integration/media/jsonp/src/test/java/io/helidon/nima/tests/integration/media/jsonp/JsonpTest.java b/http/tests/media/jsonp/src/test/java/io/helidon/http/tests/integration/media/jsonp/JsonpTest.java similarity index 86% rename from nima/tests/integration/media/jsonp/src/test/java/io/helidon/nima/tests/integration/media/jsonp/JsonpTest.java rename to http/tests/media/jsonp/src/test/java/io/helidon/http/tests/integration/media/jsonp/JsonpTest.java index 2157cb65c36..31a6b66525a 100644 --- a/nima/tests/integration/media/jsonp/src/test/java/io/helidon/nima/tests/integration/media/jsonp/JsonpTest.java +++ b/http/tests/media/jsonp/src/test/java/io/helidon/http/tests/integration/media/jsonp/JsonpTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,19 +14,19 @@ * limitations under the License. */ -package io.helidon.nima.tests.integration.media.jsonp; +package io.helidon.http.tests.integration.media.jsonp; import java.util.Map; import java.util.Optional; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpMediaType; +import io.helidon.http.Http; +import io.helidon.http.HttpMediaType; import io.helidon.common.media.type.MediaTypes; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.http.HttpRouting; import jakarta.json.Json; import jakarta.json.JsonBuilderFactory; diff --git a/http/tests/media/multipart/pom.xml b/http/tests/media/multipart/pom.xml new file mode 100644 index 00000000000..2a5b543b834 --- /dev/null +++ b/http/tests/media/multipart/pom.xml @@ -0,0 +1,55 @@ + + + + 4.0.0 + + io.helidon.http.tests.media + helidon-http-tests-media-project + 4.0.0-SNAPSHOT + + + helidon-http-tests-media-multipart + Helidon HTTP Tests Media MultiPart + + + + io.helidon.webserver + helidon-webserver + + + io.helidon.http.media + helidon-http-media-multipart + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + diff --git a/nima/tests/integration/media/multipart/src/test/java/io/helidon/nima/tests/integration/multipart/MultipartTest.java b/http/tests/media/multipart/src/test/java/io/helidon/http/tests/integration/multipart/MultipartTest.java similarity index 87% rename from nima/tests/integration/media/multipart/src/test/java/io/helidon/nima/tests/integration/multipart/MultipartTest.java rename to http/tests/media/multipart/src/test/java/io/helidon/http/tests/integration/multipart/MultipartTest.java index 31c5dbcfd01..ebeacd71fab 100644 --- a/nima/tests/integration/media/multipart/src/test/java/io/helidon/nima/tests/integration/multipart/MultipartTest.java +++ b/http/tests/media/multipart/src/test/java/io/helidon/http/tests/integration/multipart/MultipartTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.tests.integration.multipart; +package io.helidon.http.tests.integration.multipart; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -24,18 +24,18 @@ import java.util.LinkedList; import java.util.List; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpMediaType; +import io.helidon.http.Http; +import io.helidon.http.HttpMediaType; import io.helidon.common.media.type.MediaTypes; -import io.helidon.nima.http.media.multipart.MultiPart; -import io.helidon.nima.http.media.multipart.ReadablePart; -import io.helidon.nima.http.media.multipart.WriteableMultiPart; -import io.helidon.nima.http.media.multipart.WriteablePart; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.http.HttpRules; +import io.helidon.http.media.multipart.MultiPart; +import io.helidon.http.media.multipart.ReadablePart; +import io.helidon.http.media.multipart.WriteableMultiPart; +import io.helidon.http.media.multipart.WriteablePart; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.http.HttpRules; import org.junit.jupiter.api.Test; diff --git a/http/tests/media/multipart/src/test/resources/logging-test.properties b/http/tests/media/multipart/src/test/resources/logging-test.properties new file mode 100644 index 00000000000..4cb5c0b4f2f --- /dev/null +++ b/http/tests/media/multipart/src/test/resources/logging-test.properties @@ -0,0 +1,22 @@ +# +# Copyright (c) 2022, 2023 Oracle and/or its affiliates. +# +# 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. +# +handlers=java.util.logging.ConsoleHandler +java.util.logging.ConsoleHandler.level=FINEST +java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter +java.util.logging.SimpleFormatter.format=%1$tH:%1$tM:%1$tS %4$s %3$s %5$s%6$s%n +# Global logging level. Can be overridden by specific loggers +.level=INFO +io.helidon.http.level=FINEST diff --git a/http/tests/media/pom.xml b/http/tests/media/pom.xml new file mode 100644 index 00000000000..2f1dae8882b --- /dev/null +++ b/http/tests/media/pom.xml @@ -0,0 +1,38 @@ + + + + 4.0.0 + + io.helidon.http.tests + helidon-http-tests-project + 4.0.0-SNAPSHOT + + + io.helidon.http.tests.media + helidon-http-tests-media-project + Helidon HTTP Tests Media Project + pom + + + string + jsonb + jsonp + multipart + + diff --git a/http/tests/media/string/pom.xml b/http/tests/media/string/pom.xml new file mode 100644 index 00000000000..c5d0d18c2a7 --- /dev/null +++ b/http/tests/media/string/pom.xml @@ -0,0 +1,55 @@ + + + + 4.0.0 + + io.helidon.http.tests.media + helidon-http-tests-media-project + 4.0.0-SNAPSHOT + + + helidon-http-tests-media-string + Helidon HTTP Tests Media String + + + + io.helidon.webserver + helidon-webserver + + + io.helidon.http.media + helidon-http-media + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + diff --git a/nima/tests/integration/media/string/src/test/java/io/helidon/nima/tests/integration/media/string/StringTest.java b/http/tests/media/string/src/test/java/io/helidon/http/tests/media/string/StringTest.java similarity index 87% rename from nima/tests/integration/media/string/src/test/java/io/helidon/nima/tests/integration/media/string/StringTest.java rename to http/tests/media/string/src/test/java/io/helidon/http/tests/media/string/StringTest.java index 583df436295..79f304c555d 100644 --- a/nima/tests/integration/media/string/src/test/java/io/helidon/nima/tests/integration/media/string/StringTest.java +++ b/http/tests/media/string/src/test/java/io/helidon/http/tests/media/string/StringTest.java @@ -14,20 +14,20 @@ * limitations under the License. */ -package io.helidon.nima.tests.integration.media.string; +package io.helidon.http.tests.media.string; import java.util.Optional; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.Header; -import io.helidon.common.http.HttpMediaType; -import io.helidon.common.http.HttpMediaTypes; +import io.helidon.http.Http; +import io.helidon.http.Http.Header; +import io.helidon.http.HttpMediaType; +import io.helidon.http.HttpMediaTypes; import io.helidon.common.media.type.MediaTypes; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.http.HttpRouting; import org.junit.jupiter.api.Test; diff --git a/http/tests/pom.xml b/http/tests/pom.xml new file mode 100644 index 00000000000..fe96147c0f9 --- /dev/null +++ b/http/tests/pom.xml @@ -0,0 +1,50 @@ + + + + + 4.0.0 + + io.helidon.http + helidon-http-project + 4.0.0-SNAPSHOT + + + io.helidon.http.tests + helidon-http-tests-project + Helidon HTTP Tests Project + + pom + + + encoding + media + + + + true + true + true + true + true + true + true + + diff --git a/inject/pom.xml b/inject/pom.xml index b10307a353e..473d5179613 100644 --- a/inject/pom.xml +++ b/inject/pom.xml @@ -21,12 +21,10 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - io.helidon helidon-project 4.0.0-SNAPSHOT - ../pom.xml io.helidon.inject diff --git a/inject/processor/src/test/java/io/helidon/inject/processor/ExtensibleGetTemplateProducer.java b/inject/processor/src/test/java/io/helidon/inject/processor/ExtensibleGetTemplateProducer.java index d20629eecb6..6feddbb3ccf 100644 --- a/inject/processor/src/test/java/io/helidon/inject/processor/ExtensibleGetTemplateProducer.java +++ b/inject/processor/src/test/java/io/helidon/inject/processor/ExtensibleGetTemplateProducer.java @@ -58,7 +58,7 @@ public Optional create(CustomAnnotationTemplat .className(classname) .build(); GenericTemplateCreatorDefault genericTemplateCreator = new GenericTemplateCreatorDefault(getClass()); - CharSequence template = genericTemplateCreator.supplyFromResources("nima", "extensible-get.hbs"); + CharSequence template = genericTemplateCreator.supplyFromResources("helidon", "extensible-get.hbs"); GenericTemplateCreatorRequest genericCreatorRequest = GenericTemplateCreatorRequest.builder() .customAnnotationTemplateRequest(request) .generatedTypeName(generatedTypeName) diff --git a/inject/processor/src/test/resources/templates/inject/nima/extensible-get.hbs b/inject/processor/src/test/resources/templates/inject/helidon/extensible-get.hbs similarity index 100% rename from inject/processor/src/test/resources/templates/inject/nima/extensible-get.hbs rename to inject/processor/src/test/resources/templates/inject/helidon/extensible-get.hbs diff --git a/inject/tools/src/main/java/io/helidon/inject/tools/ModuleInfoDescriptorBlueprint.java b/inject/tools/src/main/java/io/helidon/inject/tools/ModuleInfoDescriptorBlueprint.java index 7160e2ae0d3..b8eccf09a40 100644 --- a/inject/tools/src/main/java/io/helidon/inject/tools/ModuleInfoDescriptorBlueprint.java +++ b/inject/tools/src/main/java/io/helidon/inject/tools/ModuleInfoDescriptorBlueprint.java @@ -149,7 +149,7 @@ default ModuleInfoDescriptor mergeCreate(ModuleInfoDescriptor another) { ModuleInfoDescriptor.Builder newOne = ModuleInfoDescriptor.builder((ModuleInfoDescriptor) this); for (ModuleInfoItem itemThere : another.items()) { - Optional itemHere = first(itemThere.target()); + Optional itemHere = first(itemThere); if (itemHere.isPresent()) { int index = newOne.items().indexOf(itemHere.get()); newOne.items().remove(index); @@ -180,12 +180,17 @@ default void save(Path path) { /** * Retrieves the first item matching the target requested. * - * @param target the target name to find + * @param item the item to find * @return the item or empty if not found */ - default Optional first(String target) { + default Optional first(ModuleInfoItem item) { return items().stream() - .filter(it -> it.target().equals(target)) + .filter(it -> (item.uses() && it.uses()) + || (item.opens() && it.opens()) + || (item.exports() && it.exports()) + || (item.provides() && it.provides()) + || (item.requires() && it.requires())) + .filter(it -> it.target().equals(item.target())) .findFirst(); } diff --git a/inject/tools/src/main/java/io/helidon/inject/tools/ModuleUtils.java b/inject/tools/src/main/java/io/helidon/inject/tools/ModuleUtils.java index d8d33967837..82a6bad76a9 100644 --- a/inject/tools/src/main/java/io/helidon/inject/tools/ModuleUtils.java +++ b/inject/tools/src/main/java/io/helidon/inject/tools/ModuleUtils.java @@ -68,6 +68,14 @@ public class ModuleUtils { static final String SERVICE_PROVIDER_MODULE_INFO_HBS = "module-info.hbs"; static final String SRC_MAIN_JAVA_DIR = "/src/main/java"; static final String SRC_TEST_JAVA_DIR = "/src/test/java"; + static final ModuleInfoItem MODULE_COMPONENT_MODULE_INFO = ModuleInfoItem.builder() + .provides(true) + .target(ModuleComponent.class.getName()) + .build(); + static final ModuleInfoItem APPLICATION_MODULE_INFO = ModuleInfoItem.builder() + .provides(true) + .target(Application.class.getName()) + .build(); private ModuleUtils() { } @@ -75,7 +83,7 @@ private ModuleUtils() { /** * Returns the suggested package name to use. * - * @param typeNames the set of types that are being codegen'ed + * @param typeNames the set of types that are being code generated * @param defaultPackageName the default package name to use if all options are exhausted * @param descriptor the module-info descriptor * @return the suggested package name @@ -90,7 +98,7 @@ public static String toSuggestedGeneratedPackageName(Collection typeNa /** * Returns the suggested package name to use. * - * @param typeNames the set of types that are being codegen'ed + * @param typeNames the set of types that are being code generated * @param defaultPackageName the default package name to use if all options are exhausted * @return the suggested package name */ @@ -104,9 +112,9 @@ static String innerToSuggestedGeneratedPackageName(ModuleInfoDescriptor descript String defaultPackageName) { String export = null; if (descriptor != null) { - Optional provides = descriptor.first(Application.class.getName()); + Optional provides = descriptor.first(APPLICATION_MODULE_INFO); if (provides.isEmpty() || provides.get().withOrTo().isEmpty()) { - provides = descriptor.first(ModuleComponent.class.getName()); + provides = descriptor.first(MODULE_COMPONENT_MODULE_INFO); } if (provides.isEmpty() || provides.get().withOrTo().isEmpty()) { export = descriptor.firstUnqualifiedPackageExport().orElse(null); diff --git a/inject/tools/src/main/java/io/helidon/inject/tools/ServicesToProcess.java b/inject/tools/src/main/java/io/helidon/inject/tools/ServicesToProcess.java index 84dab151083..0a424a72e5c 100644 --- a/inject/tools/src/main/java/io/helidon/inject/tools/ServicesToProcess.java +++ b/inject/tools/src/main/java/io/helidon/inject/tools/ServicesToProcess.java @@ -43,6 +43,9 @@ import io.helidon.inject.api.Resettable; import io.helidon.inject.runtime.Dependencies; +import static io.helidon.inject.tools.ModuleUtils.APPLICATION_MODULE_INFO; +import static io.helidon.inject.tools.ModuleUtils.MODULE_COMPONENT_MODULE_INFO; + /** * Tracks the services to process, and ingests them to build the codegen model. *

@@ -944,7 +947,7 @@ private void performModuleUsageValidation(Messager processor) { String message = ". Use -A" + Options.TAG_IGNORE_MODULE_USAGE + "=true to ignore."; if (wasModuleDefined) { - Optional moduleInfoItem = lastKnownModuleInfoDescriptor.first(ModuleComponent.class.getName()); + Optional moduleInfoItem = lastKnownModuleInfoDescriptor.first(MODULE_COMPONENT_MODULE_INFO); if (moduleInfoItem.isEmpty() || !moduleInfoItem.get().provides()) { IllegalStateException te = new IllegalStateException("Expected to have a 'provides " + ModuleComponent.class.getName() @@ -959,7 +962,7 @@ private void performModuleUsageValidation(Messager processor) { } if (wasApplicationDefined) { - Optional moduleInfoItem = lastKnownModuleInfoDescriptor.first(Application.class.getName()); + Optional moduleInfoItem = lastKnownModuleInfoDescriptor.first(APPLICATION_MODULE_INFO); if (moduleInfoItem.isEmpty() || !moduleInfoItem.get().provides()) { ToolsException te = new ToolsException("Expected to have a 'provides " + Application.class.getName() + " with ... ' entry in " + lastKnownModuleInfoFilePath + message); diff --git a/inject/tools/src/test/java/io/helidon/inject/tools/ModuleInfoDescriptorTest.java b/inject/tools/src/test/java/io/helidon/inject/tools/ModuleInfoDescriptorTest.java index 9e5c159357b..2e7d1399ae7 100644 --- a/inject/tools/src/test/java/io/helidon/inject/tools/ModuleInfoDescriptorTest.java +++ b/inject/tools/src/test/java/io/helidon/inject/tools/ModuleInfoDescriptorTest.java @@ -108,7 +108,8 @@ void firstUnqualifiedExport() { assertThat(descriptor.firstUnqualifiedPackageExport().orElseThrow(), equalTo("export2")); - assertThat(descriptor.first("cn1").orElseThrow().provides(), + ModuleInfoItem moduleInfoItem = ModuleInfoItem.builder().provides(true).target("cn1").build(); + assertThat(descriptor.first(moduleInfoItem).orElseThrow().provides(), is(true)); } @@ -175,7 +176,7 @@ void annotationsNotSupported() { + " */\n" + "@Feature(value = \"Config\",\n" + " description = \"Configuration module\",\n" - + " in = {HelidonFlavor.NIMA, HelidonFlavor.SE}\n" + + " in = {HelidonFlavor.SE}\n" + ")\n" + "module io.helidon.config {\n}\n"; ToolsException te = assertThrows(ToolsException.class, @@ -183,17 +184,16 @@ void annotationsNotSupported() { .create(moduleInfo, ModuleInfoOrdering.NATURAL_PRESERVE_COMMENTS, true)); assertThat(te.getCause().getMessage(), equalTo("Failed to parse line: @Feature(value = \"Config\", description = \"Configuration module\", " - + "in = {HelidonFlavor.NIMA, HelidonFlavor.SE}")); + + "in = {HelidonFlavor.SE}")); ModuleInfoDescriptor descriptor = ModuleInfoDescriptor.create(moduleInfo); assertThat(descriptor.handled(), is(false)); assertThat(descriptor.unhandledLines(), - contains("@Feature(value = \"Config\", description = \"Configuration module\", in = {HelidonFlavor" - + ".NIMA, HelidonFlavor.SE}")); + contains("@Feature(value = \"Config\", description = \"Configuration module\", in = {HelidonFlavor.SE}")); assertThat(descriptor.error().orElseThrow().getCause().getMessage(), equalTo("Failed to parse line: @Feature(value = \"Config\", description = \"Configuration module\", " - + "in = {HelidonFlavor.NIMA, HelidonFlavor.SE}")); + + "in = {HelidonFlavor.SE}")); } @Test @@ -253,7 +253,8 @@ void mergeCreate() { + "\n" + " exports io.helidon.inject.spi.impl;\n" + "\n" - + " provides io.helidon.inject.api.InjectionServices with io.helidon.inject.spi.impl.DefaultInjectionServices;\n" + + " provides io.helidon.inject.api.InjectionServices with io.helidon.inject.spi.impl" + + ".DefaultInjectionServices;\n" + "\n" + " uses io.helidon.inject.api.ModuleComponent;\n" + " uses io.helidon.inject.api.Application;\n" diff --git a/integrations/common/rest/pom.xml b/integrations/common/rest/pom.xml index 6a3da3bc290..6be671bfd52 100644 --- a/integrations/common/rest/pom.xml +++ b/integrations/common/rest/pom.xml @@ -32,29 +32,34 @@ - io.helidon.common - helidon-common-http + io.helidon.http + helidon-http io.helidon.config helidon-config - io.helidon.nima.webclient - helidon-nima-webclient + io.helidon.webclient + helidon-webclient - io.helidon.nima.fault-tolerance - helidon-nima-fault-tolerance + io.helidon.fault-tolerance + helidon-fault-tolerance - io.helidon.nima.http.media - helidon-nima-http-media-jsonp + io.helidon.http.media + helidon-http-media-jsonp io.opentracing opentracing-api + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 + test + org.junit.jupiter junit-jupiter-api @@ -65,10 +70,5 @@ hamcrest-all test - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - \ No newline at end of file diff --git a/integrations/common/rest/src/main/java/io/helidon/integrations/common/rest/ApiResponse.java b/integrations/common/rest/src/main/java/io/helidon/integrations/common/rest/ApiResponse.java index 4238f49aeb7..1e95abb76bb 100644 --- a/integrations/common/rest/src/main/java/io/helidon/integrations/common/rest/ApiResponse.java +++ b/integrations/common/rest/src/main/java/io/helidon/integrations/common/rest/ApiResponse.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022 Oracle and/or its affiliates. + * Copyright (c) 2021, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,8 @@ package io.helidon.integrations.common.rest; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; +import io.helidon.http.Headers; +import io.helidon.http.Http; /** * A base for responses without an entity. diff --git a/integrations/common/rest/src/main/java/io/helidon/integrations/common/rest/ApiRestException.java b/integrations/common/rest/src/main/java/io/helidon/integrations/common/rest/ApiRestException.java index 5468719b494..7e582a306d5 100644 --- a/integrations/common/rest/src/main/java/io/helidon/integrations/common/rest/ApiRestException.java +++ b/integrations/common/rest/src/main/java/io/helidon/integrations/common/rest/ApiRestException.java @@ -19,8 +19,8 @@ import java.util.Formatter; import java.util.Optional; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; +import io.helidon.http.Headers; +import io.helidon.http.Http; /** * Exception when invoking remote REST API caused by wrong response from the API call. diff --git a/integrations/common/rest/src/main/java/io/helidon/integrations/common/rest/ResponseBuilder.java b/integrations/common/rest/src/main/java/io/helidon/integrations/common/rest/ResponseBuilder.java index b9fb247b637..194aee05baa 100644 --- a/integrations/common/rest/src/main/java/io/helidon/integrations/common/rest/ResponseBuilder.java +++ b/integrations/common/rest/src/main/java/io/helidon/integrations/common/rest/ResponseBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022 Oracle and/or its affiliates. + * Copyright (c) 2021, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,8 +17,8 @@ package io.helidon.integrations.common.rest; import io.helidon.common.Builder; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; +import io.helidon.http.Headers; +import io.helidon.http.Http; /** * Response builder extracted as an interface, to work around the restriction that we cannot diff --git a/integrations/common/rest/src/main/java/io/helidon/integrations/common/rest/RestApi.java b/integrations/common/rest/src/main/java/io/helidon/integrations/common/rest/RestApi.java index 976ca934559..9d31df90c17 100644 --- a/integrations/common/rest/src/main/java/io/helidon/integrations/common/rest/RestApi.java +++ b/integrations/common/rest/src/main/java/io/helidon/integrations/common/rest/RestApi.java @@ -20,17 +20,17 @@ import java.util.Map; import java.util.function.Consumer; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.Method; import io.helidon.common.socket.SocketOptions; import io.helidon.config.Config; +import io.helidon.faulttolerance.FaultTolerance; +import io.helidon.faulttolerance.FtHandler; +import io.helidon.http.Http; +import io.helidon.http.Http.Method; +import io.helidon.http.media.jsonp.JsonpSupport; import io.helidon.integrations.common.rest.ApiOptionalResponse.BuilderBase; -import io.helidon.nima.faulttolerance.FaultTolerance; -import io.helidon.nima.faulttolerance.FtHandler; -import io.helidon.nima.http.media.jsonp.JsonpSupport; -import io.helidon.nima.webclient.api.WebClient; -import io.helidon.nima.webclient.api.WebClientConfig; -import io.helidon.nima.webclient.http1.Http1Client; +import io.helidon.webclient.api.WebClient; +import io.helidon.webclient.api.WebClientConfig; +import io.helidon.webclient.http1.Http1Client; import jakarta.json.Json; import jakarta.json.JsonBuilderFactory; @@ -43,7 +43,7 @@ */ public interface RestApi { /** - * Get with an optional response. In case the call returns {@link io.helidon.common.http.Http.Status#NOT_FOUND_404} + * Get with an optional response. In case the call returns {@link io.helidon.http.Http.Status#NOT_FOUND_404} * this would return an empty optional entity, rather than fail. * This may also be the case for requests that use {@code If-Modified-Since} that return a * {@link Http.Status#NOT_MODIFIED_304} response code. @@ -218,7 +218,7 @@ > T invokeEntityResponse(Method method, * Invoke API call that is expected to return bytes. * This method collects all bytes in memory, so it cannot be used for large data. * See - * {@link #invokeEntityResponse(io.helidon.common.http.Http.Method, String, ApiRequest, BuilderBase)}. + * {@link #invokeEntityResponse(io.helidon.http.Http.Method, String, ApiRequest, BuilderBase)}. *

* The accepted media type must be provided in request, falls back to * {@link io.helidon.common.media.type.MediaTypes#APPLICATION_OCTET_STREAM}. diff --git a/integrations/common/rest/src/main/java/io/helidon/integrations/common/rest/RestApiBase.java b/integrations/common/rest/src/main/java/io/helidon/integrations/common/rest/RestApiBase.java index 04e7677f8c1..d256663f6b9 100644 --- a/integrations/common/rest/src/main/java/io/helidon/integrations/common/rest/RestApiBase.java +++ b/integrations/common/rest/src/main/java/io/helidon/integrations/common/rest/RestApiBase.java @@ -28,15 +28,15 @@ import java.util.logging.Logger; import io.helidon.common.context.Contexts; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.Method; import io.helidon.common.media.type.MediaType; import io.helidon.common.media.type.MediaTypes; +import io.helidon.faulttolerance.FtHandler; +import io.helidon.http.Http; +import io.helidon.http.Http.Method; import io.helidon.integrations.common.rest.ApiOptionalResponse.BuilderBase; -import io.helidon.nima.faulttolerance.FtHandler; -import io.helidon.nima.webclient.api.HttpClientRequest; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.api.WebClient; +import io.helidon.webclient.api.HttpClientRequest; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.api.WebClient; import io.opentracing.SpanContext; import jakarta.json.JsonBuilderFactory; diff --git a/integrations/common/rest/src/main/java/module-info.java b/integrations/common/rest/src/main/java/module-info.java index 6bcfa9c4b8e..92b612f6ba4 100644 --- a/integrations/common/rest/src/main/java/module-info.java +++ b/integrations/common/rest/src/main/java/module-info.java @@ -31,11 +31,11 @@ requires io.helidon.common; requires io.helidon.common.context; - requires io.helidon.common.http; + requires io.helidon.http; requires io.helidon.config; - requires io.helidon.nima.faulttolerance; - requires io.helidon.nima.webclient; - requires io.helidon.nima.http.media.jsonp; + requires io.helidon.faulttolerance; + requires io.helidon.webclient; + requires io.helidon.http.media.jsonp; exports io.helidon.integrations.common.rest; } \ No newline at end of file diff --git a/integrations/common/rest/src/test/java/io/helidon/integrations/common/rest/RestApiTest.java b/integrations/common/rest/src/test/java/io/helidon/integrations/common/rest/RestApiTest.java index 948385b8630..3d217dd0931 100644 --- a/integrations/common/rest/src/test/java/io/helidon/integrations/common/rest/RestApiTest.java +++ b/integrations/common/rest/src/test/java/io/helidon/integrations/common/rest/RestApiTest.java @@ -21,18 +21,18 @@ import java.util.Optional; import java.util.function.Function; -import io.helidon.common.http.Http; -import io.helidon.common.http.ServerRequestHeaders; -import io.helidon.nima.http.media.MediaContext; -import io.helidon.nima.http.media.jsonp.JsonpSupport; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.Http; +import io.helidon.http.ServerRequestHeaders; +import io.helidon.http.media.MediaContext; +import io.helidon.http.media.jsonp.JsonpSupport; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import jakarta.json.Json; import jakarta.json.JsonBuilderFactory; @@ -41,8 +41,8 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import static io.helidon.common.http.Http.Method.GET; -import static io.helidon.common.http.Http.Method.PUT; +import static io.helidon.http.Http.Method.GET; +import static io.helidon.http.Http.Method.PUT; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.hasEntry; diff --git a/integrations/micrometer/cdi/pom.xml b/integrations/micrometer/cdi/pom.xml index 8f7f2115671..305098fe648 100644 --- a/integrations/micrometer/cdi/pom.xml +++ b/integrations/micrometer/cdi/pom.xml @@ -62,8 +62,8 @@ helidon-config - io.helidon.common - helidon-common-http + io.helidon.http + helidon-http io.helidon.microprofile.service-common @@ -89,8 +89,8 @@ test - io.helidon.nima.webclient - helidon-nima-webclient + io.helidon.webclient + helidon-webclient test diff --git a/integrations/micrometer/cdi/src/main/java/io/helidon/integrations/micrometer/cdi/MicrometerCdiExtension.java b/integrations/micrometer/cdi/src/main/java/io/helidon/integrations/micrometer/cdi/MicrometerCdiExtension.java index 7a4781509bc..29896af2199 100644 --- a/integrations/micrometer/cdi/src/main/java/io/helidon/integrations/micrometer/cdi/MicrometerCdiExtension.java +++ b/integrations/micrometer/cdi/src/main/java/io/helidon/integrations/micrometer/cdi/MicrometerCdiExtension.java @@ -27,7 +27,7 @@ import io.helidon.integrations.micrometer.MicrometerFeature; import io.helidon.microprofile.server.ServerCdiExtension; import io.helidon.microprofile.servicecommon.HelidonRestCdiExtension; -import io.helidon.nima.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpRules; import io.micrometer.core.annotation.Counted; import io.micrometer.core.annotation.Timed; diff --git a/integrations/micrometer/cdi/src/main/java/module-info.java b/integrations/micrometer/cdi/src/main/java/module-info.java index b75c9d5b9f9..1fbe84c16a1 100644 --- a/integrations/micrometer/cdi/src/main/java/module-info.java +++ b/integrations/micrometer/cdi/src/main/java/module-info.java @@ -35,7 +35,7 @@ requires static jakarta.cdi; requires static jakarta.inject; - requires io.helidon.common.http; + requires io.helidon.http; requires io.helidon.microprofile.servicecommon; requires io.helidon.config; requires io.helidon.config.mp; diff --git a/integrations/micrometer/cdi/src/test/resources/logging.properties b/integrations/micrometer/cdi/src/test/resources/logging.properties index f04038cfe75..6316026f33f 100644 --- a/integrations/micrometer/cdi/src/test/resources/logging.properties +++ b/integrations/micrometer/cdi/src/test/resources/logging.properties @@ -27,7 +27,7 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ .level=INFO # Component specific log levels -#io.helidon.nima.webserver.level=INFO +#io.helidon.webserver.level=INFO #io.helidon.config.level=INFO #io.helidon.security.level=INFO #io.helidon.common.level=INFO diff --git a/integrations/micrometer/micrometer/pom.xml b/integrations/micrometer/micrometer/pom.xml index 0f74a60221a..362b714daf3 100644 --- a/integrations/micrometer/micrometer/pom.xml +++ b/integrations/micrometer/micrometer/pom.xml @@ -63,25 +63,25 @@ helidon-config - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver provided - io.helidon.nima.webserver - helidon-nima-webserver-cors + io.helidon.webserver + helidon-webserver-cors - io.helidon.nima.webclient - helidon-nima-webclient + io.helidon.webclient + helidon-webclient - io.helidon.nima.service-common - helidon-nima-service-common + io.helidon.webserver + helidon-webserver-service-common - io.helidon.common - helidon-common-http + io.helidon.http + helidon-http io.helidon.config diff --git a/integrations/micrometer/micrometer/src/main/java/io/helidon/integrations/micrometer/MeterRegistryFactory.java b/integrations/micrometer/micrometer/src/main/java/io/helidon/integrations/micrometer/MeterRegistryFactory.java index daa43ae9271..411573f0eb3 100644 --- a/integrations/micrometer/micrometer/src/main/java/io/helidon/integrations/micrometer/MeterRegistryFactory.java +++ b/integrations/micrometer/micrometer/src/main/java/io/helidon/integrations/micrometer/MeterRegistryFactory.java @@ -29,10 +29,10 @@ import java.util.logging.Logger; import io.helidon.common.config.Config; -import io.helidon.common.http.Http; -import io.helidon.nima.webserver.http.Handler; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.Http; +import io.helidon.webserver.http.Handler; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.composite.CompositeMeterRegistry; @@ -227,8 +227,8 @@ static BuiltInRegistryType valueByName(String name) throws UnrecognizedBuiltInRe } } - io.helidon.nima.webserver.http.Handler matchingHandler(io.helidon.nima.webserver.http.ServerRequest serverRequest, - io.helidon.nima.webserver.http.ServerResponse serverResponse) { + Handler matchingHandler(ServerRequest serverRequest, + ServerResponse serverResponse) { return registryEnrollments.stream() .map(e -> e.handlerFn().apply(serverRequest)) .flatMap(Optional::stream) @@ -400,12 +400,12 @@ Map enrolledBuiltInRegistries() { private static class Enrollment { private final MeterRegistry meterRegistry; - private final Function> handlerFn; + private final Function> handlerFn; private Enrollment(MeterRegistry meterRegistry, - Function> handlerFn) { + Function> handlerFn) { this.meterRegistry = meterRegistry; this.handlerFn = handlerFn; } @@ -414,8 +414,8 @@ private MeterRegistry meterRegistry() { return meterRegistry; } - private Function> handlerFn() { + private Function> handlerFn() { return handlerFn; } } diff --git a/integrations/micrometer/micrometer/src/main/java/io/helidon/integrations/micrometer/MicrometerBuiltInRegistrySupport.java b/integrations/micrometer/micrometer/src/main/java/io/helidon/integrations/micrometer/MicrometerBuiltInRegistrySupport.java index 0c18dec8424..27d5527930c 100644 --- a/integrations/micrometer/micrometer/src/main/java/io/helidon/integrations/micrometer/MicrometerBuiltInRegistrySupport.java +++ b/integrations/micrometer/micrometer/src/main/java/io/helidon/integrations/micrometer/MicrometerBuiltInRegistrySupport.java @@ -23,6 +23,8 @@ import io.helidon.common.config.Config; import io.helidon.common.config.ConfigValue; +import io.helidon.webserver.http.Handler; +import io.helidon.webserver.http.ServerRequest; import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.config.MeterRegistryConfig; @@ -91,8 +93,8 @@ static MicrometerBuiltInRegistrySupport create(MeterRegistryFactory.BuiltInRegis abstract MeterRegistry createRegistry(MeterRegistryConfig meterRegistryConfig); - abstract Function> requestToHandlerFn( + abstract Function> requestToHandlerFn( MeterRegistry meterRegistry); diff --git a/integrations/micrometer/micrometer/src/main/java/io/helidon/integrations/micrometer/MicrometerFeature.java b/integrations/micrometer/micrometer/src/main/java/io/helidon/integrations/micrometer/MicrometerFeature.java index ed7629a9703..741b6912ee6 100644 --- a/integrations/micrometer/micrometer/src/main/java/io/helidon/integrations/micrometer/MicrometerFeature.java +++ b/integrations/micrometer/micrometer/src/main/java/io/helidon/integrations/micrometer/MicrometerFeature.java @@ -21,10 +21,10 @@ import io.helidon.common.config.Config; import io.helidon.common.context.Contexts; import io.helidon.config.metadata.Configured; -import io.helidon.nima.servicecommon.HelidonFeatureSupport; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; +import io.helidon.webserver.servicecommon.HelidonFeatureSupport; import io.micrometer.core.instrument.MeterRegistry; diff --git a/integrations/micrometer/micrometer/src/main/java/io/helidon/integrations/micrometer/MicrometerPrometheusRegistrySupport.java b/integrations/micrometer/micrometer/src/main/java/io/helidon/integrations/micrometer/MicrometerPrometheusRegistrySupport.java index 644f4fa32b7..48218f740c5 100644 --- a/integrations/micrometer/micrometer/src/main/java/io/helidon/integrations/micrometer/MicrometerPrometheusRegistrySupport.java +++ b/integrations/micrometer/micrometer/src/main/java/io/helidon/integrations/micrometer/MicrometerPrometheusRegistrySupport.java @@ -25,6 +25,8 @@ import io.helidon.common.config.Config; import io.helidon.common.config.ConfigValue; import io.helidon.common.media.type.MediaTypes; +import io.helidon.webserver.http.Handler; +import io.helidon.webserver.http.ServerRequest; import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.config.MeterRegistryConfig; @@ -65,12 +67,12 @@ PrometheusMeterRegistry createRegistry(MeterRegistryConfig meterRegistryConfig) } @Override - public Function> requestToHandlerFn(MeterRegistry registry) { + public Function> requestToHandlerFn(MeterRegistry registry) { /* * Deal with a request if the MediaType is text/plain or the query parameter "type" specifies "prometheus". */ - return (io.helidon.nima.webserver.http.ServerRequest req) -> { + return (ServerRequest req) -> { if (req.headers() .bestAccepted(MediaTypes.TEXT_PLAIN).isPresent() || req.query() diff --git a/integrations/micrometer/micrometer/src/main/java/io/helidon/integrations/micrometer/PrometheusHandler.java b/integrations/micrometer/micrometer/src/main/java/io/helidon/integrations/micrometer/PrometheusHandler.java index 8560c9dca1d..ba01710eed9 100644 --- a/integrations/micrometer/micrometer/src/main/java/io/helidon/integrations/micrometer/PrometheusHandler.java +++ b/integrations/micrometer/micrometer/src/main/java/io/helidon/integrations/micrometer/PrometheusHandler.java @@ -18,11 +18,11 @@ import java.io.StringWriter; -import io.helidon.common.http.Http; import io.helidon.common.media.type.MediaTypes; -import io.helidon.nima.webserver.http.Handler; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.Http; +import io.helidon.webserver.http.Handler; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.prometheus.PrometheusMeterRegistry; diff --git a/integrations/micrometer/micrometer/src/main/java/module-info.java b/integrations/micrometer/micrometer/src/main/java/module-info.java index f58ffff1f40..3241aa11f69 100644 --- a/integrations/micrometer/micrometer/src/main/java/module-info.java +++ b/integrations/micrometer/micrometer/src/main/java/module-info.java @@ -35,9 +35,9 @@ requires static jakarta.annotation; requires io.helidon.config; - requires io.helidon.common.http; - requires io.helidon.nima.servicecommon; - requires io.helidon.nima.webserver.cors; + requires io.helidon.http; + requires io.helidon.servicecommon; + requires io.helidon.webserver.cors; requires static io.helidon.config.metadata; diff --git a/integrations/micrometer/micrometer/src/test/java/io/helidon/integrations/micrometer/MicrometerEndpointTests.java b/integrations/micrometer/micrometer/src/test/java/io/helidon/integrations/micrometer/MicrometerEndpointTests.java index 82eca40542c..e4d83d25464 100644 --- a/integrations/micrometer/micrometer/src/test/java/io/helidon/integrations/micrometer/MicrometerEndpointTests.java +++ b/integrations/micrometer/micrometer/src/test/java/io/helidon/integrations/micrometer/MicrometerEndpointTests.java @@ -20,11 +20,11 @@ import java.util.concurrent.ExecutionException; import java.util.function.Supplier; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.config.Config; import io.helidon.config.ConfigSources; -import io.helidon.nima.webclient.api.WebClient; -import io.helidon.nima.webserver.WebServer; +import io.helidon.webclient.api.WebClient; +import io.helidon.webserver.WebServer; import org.hamcrest.MatcherAssert; import org.junit.jupiter.api.Test; diff --git a/integrations/micrometer/micrometer/src/test/java/io/helidon/integrations/micrometer/MicrometerSimplePrometheusTest.java b/integrations/micrometer/micrometer/src/test/java/io/helidon/integrations/micrometer/MicrometerSimplePrometheusTest.java index 18f2982ef0c..e2c7e760a47 100644 --- a/integrations/micrometer/micrometer/src/test/java/io/helidon/integrations/micrometer/MicrometerSimplePrometheusTest.java +++ b/integrations/micrometer/micrometer/src/test/java/io/helidon/integrations/micrometer/MicrometerSimplePrometheusTest.java @@ -20,12 +20,12 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.common.media.type.MediaTypes; -import io.helidon.nima.webclient.api.ClientResponseTyped; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webserver.WebServer; +import io.helidon.webclient.api.ClientResponseTyped; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webserver.WebServer; import io.micrometer.core.instrument.Counter; import io.micrometer.core.instrument.DistributionSummary; diff --git a/integrations/micrometer/micrometer/src/test/java/io/helidon/integrations/micrometer/MicrometerTestUtil.java b/integrations/micrometer/micrometer/src/test/java/io/helidon/integrations/micrometer/MicrometerTestUtil.java index f320368f210..d11742e0397 100644 --- a/integrations/micrometer/micrometer/src/test/java/io/helidon/integrations/micrometer/MicrometerTestUtil.java +++ b/integrations/micrometer/micrometer/src/test/java/io/helidon/integrations/micrometer/MicrometerTestUtil.java @@ -20,7 +20,7 @@ import java.util.logging.Level; import java.util.logging.Logger; -import io.helidon.nima.webserver.WebServer; +import io.helidon.webserver.WebServer; public class MicrometerTestUtil { diff --git a/integrations/microstream/health/pom.xml b/integrations/microstream/health/pom.xml index b8c888e3c6f..453c5c02145 100644 --- a/integrations/microstream/health/pom.xml +++ b/integrations/microstream/health/pom.xml @@ -20,7 +20,6 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - io.helidon.integrations.microstream helidon-integrations-microstream-project @@ -29,7 +28,6 @@ helidon-integrations-microstream-health Helidon Integrations Microstream Health - jar Health check for Microstream @@ -39,8 +37,8 @@ helidon-integrations-microstream - io.helidon.nima.observe - helidon-nima-observe-health + io.helidon.webserver.observe + helidon-webserver-observe-health org.junit.jupiter diff --git a/integrations/neo4j/neo4j/src/main/java/module-info.java b/integrations/neo4j/neo4j/src/main/java/module-info.java index 1c6621da556..5dec18ef879 100644 --- a/integrations/neo4j/neo4j/src/main/java/module-info.java +++ b/integrations/neo4j/neo4j/src/main/java/module-info.java @@ -24,8 +24,7 @@ @Preview @Feature(value = "Neo4j integration", description = "Integration with Neo4j driver", - in = {HelidonFlavor.MP, HelidonFlavor.SE}, - invalidIn = HelidonFlavor.SE, + in = HelidonFlavor.SE, path = "Neo4j" ) module io.helidon.integrations.neo4j { diff --git a/integrations/oci/metrics/metrics/pom.xml b/integrations/oci/metrics/metrics/pom.xml index 232e9475400..b66882c2287 100644 --- a/integrations/oci/metrics/metrics/pom.xml +++ b/integrations/oci/metrics/metrics/pom.xml @@ -38,8 +38,8 @@ helidon-metrics-api - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver com.oracle.oci.sdk diff --git a/integrations/oci/metrics/metrics/src/main/java/io/helidon/integrations/oci/metrics/OciMetricsSupport.java b/integrations/oci/metrics/metrics/src/main/java/io/helidon/integrations/oci/metrics/OciMetricsSupport.java index 03e320fb7bd..1dd9f733246 100644 --- a/integrations/oci/metrics/metrics/src/main/java/io/helidon/integrations/oci/metrics/OciMetricsSupport.java +++ b/integrations/oci/metrics/metrics/src/main/java/io/helidon/integrations/oci/metrics/OciMetricsSupport.java @@ -36,8 +36,8 @@ import io.helidon.config.metadata.ConfiguredOption; import io.helidon.metrics.api.Registry; import io.helidon.metrics.api.RegistryFactory; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; import com.oracle.bmc.monitoring.Monitoring; import com.oracle.bmc.monitoring.model.MetricDataDetails; @@ -55,11 +55,7 @@ import org.eclipse.microprofile.metrics.Timer; /** - * OCI Metrics Support - *

- * When used in a NIMA app, ensure that this HttpService implementation is registered on the default routing created via - * {@link io.helidon.nima.webserver.http.HttpRouting#builder()}. - *

+ * OCI Metrics Support. */ public class OciMetricsSupport implements HttpService { private static final Logger LOGGER = Logger.getLogger(OciMetricsSupport.class.getName()); diff --git a/integrations/oci/metrics/metrics/src/main/java/module-info.java b/integrations/oci/metrics/metrics/src/main/java/module-info.java index eb95c8f9dc3..84abd3d455a 100644 --- a/integrations/oci/metrics/metrics/src/main/java/module-info.java +++ b/integrations/oci/metrics/metrics/src/main/java/module-info.java @@ -22,8 +22,8 @@ requires transitive io.helidon.config; requires transitive io.helidon.common; - requires io.helidon.common.http; - requires io.helidon.nima.webserver; + requires io.helidon.http; + requires io.helidon.webserver; requires static io.helidon.config.metadata; requires io.helidon.metrics.api; diff --git a/integrations/oci/metrics/metrics/src/test/java/io/helidon/integrations/oci/metrics/OciMetricsSupportTest.java b/integrations/oci/metrics/metrics/src/test/java/io/helidon/integrations/oci/metrics/OciMetricsSupportTest.java index 743bfa64aed..2e922ee350e 100644 --- a/integrations/oci/metrics/metrics/src/test/java/io/helidon/integrations/oci/metrics/OciMetricsSupportTest.java +++ b/integrations/oci/metrics/metrics/src/test/java/io/helidon/integrations/oci/metrics/OciMetricsSupportTest.java @@ -26,8 +26,8 @@ import io.helidon.config.ConfigSources; import io.helidon.metrics.api.Registry; import io.helidon.metrics.api.RegistryFactory; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.WebServer; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.WebServer; import com.oracle.bmc.monitoring.Monitoring; import com.oracle.bmc.monitoring.model.MetricDataDetails; diff --git a/integrations/vault/auths/approle/src/main/java/io/helidon/integrations/vault/auths/approle/AppRoleAuthImpl.java b/integrations/vault/auths/approle/src/main/java/io/helidon/integrations/vault/auths/approle/AppRoleAuthImpl.java index 636b9b860f9..e0054e9f72d 100644 --- a/integrations/vault/auths/approle/src/main/java/io/helidon/integrations/vault/auths/approle/AppRoleAuthImpl.java +++ b/integrations/vault/auths/approle/src/main/java/io/helidon/integrations/vault/auths/approle/AppRoleAuthImpl.java @@ -16,7 +16,7 @@ package io.helidon.integrations.vault.auths.approle; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.integrations.common.rest.RestApi; import io.helidon.integrations.vault.VaultOptionalResponse; diff --git a/integrations/vault/auths/approle/src/main/java/io/helidon/integrations/vault/auths/approle/AppRoleRestApi.java b/integrations/vault/auths/approle/src/main/java/io/helidon/integrations/vault/auths/approle/AppRoleRestApi.java index 9da52707609..a26fa9a2be3 100644 --- a/integrations/vault/auths/approle/src/main/java/io/helidon/integrations/vault/auths/approle/AppRoleRestApi.java +++ b/integrations/vault/auths/approle/src/main/java/io/helidon/integrations/vault/auths/approle/AppRoleRestApi.java @@ -20,11 +20,11 @@ import java.time.Instant; import java.util.concurrent.atomic.AtomicReference; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.integrations.common.rest.ApiRequest; import io.helidon.integrations.vault.VaultTokenBase; import io.helidon.integrations.vault.auths.common.VaultRestApi; -import io.helidon.nima.webclient.api.HttpClientRequest; +import io.helidon.webclient.api.HttpClientRequest; class AppRoleRestApi extends VaultRestApi { private static final System.Logger LOGGER = System.getLogger(AppRoleRestApi.class.getName()); diff --git a/integrations/vault/auths/approle/src/main/java/io/helidon/integrations/vault/auths/approle/AppRoleVaultAuth.java b/integrations/vault/auths/approle/src/main/java/io/helidon/integrations/vault/auths/approle/AppRoleVaultAuth.java index 69c9408d2eb..8a8e724a68b 100644 --- a/integrations/vault/auths/approle/src/main/java/io/helidon/integrations/vault/auths/approle/AppRoleVaultAuth.java +++ b/integrations/vault/auths/approle/src/main/java/io/helidon/integrations/vault/auths/approle/AppRoleVaultAuth.java @@ -21,8 +21,8 @@ import io.helidon.common.Weight; import io.helidon.common.Weighted; -import io.helidon.common.http.Http; import io.helidon.config.Config; +import io.helidon.http.Http; import io.helidon.integrations.common.rest.RestApi; import io.helidon.integrations.vault.Vault; import io.helidon.integrations.vault.VaultApiException; diff --git a/integrations/vault/auths/approle/src/main/java/module-info.java b/integrations/vault/auths/approle/src/main/java/module-info.java index 1b0c8773e9f..b79ea9e4971 100644 --- a/integrations/vault/auths/approle/src/main/java/module-info.java +++ b/integrations/vault/auths/approle/src/main/java/module-info.java @@ -31,8 +31,8 @@ requires transitive io.helidon.integrations.vault; requires io.helidon.integrations.vault.auths.common; requires io.helidon.integrations.common.rest; - requires io.helidon.common.http; - requires io.helidon.nima.webclient; + requires io.helidon.http; + requires io.helidon.webclient; exports io.helidon.integrations.vault.auths.approle; diff --git a/integrations/vault/auths/common/src/main/java/io/helidon/integrations/vault/auths/common/NoVaultAuth.java b/integrations/vault/auths/common/src/main/java/io/helidon/integrations/vault/auths/common/NoVaultAuth.java index df9794a8c9c..74cbdd34508 100644 --- a/integrations/vault/auths/common/src/main/java/io/helidon/integrations/vault/auths/common/NoVaultAuth.java +++ b/integrations/vault/auths/common/src/main/java/io/helidon/integrations/vault/auths/common/NoVaultAuth.java @@ -19,8 +19,8 @@ import java.util.Optional; import io.helidon.common.Weight; -import io.helidon.common.http.Http; import io.helidon.config.Config; +import io.helidon.http.Http; import io.helidon.integrations.common.rest.RestApi; import io.helidon.integrations.vault.Vault; import io.helidon.integrations.vault.VaultApiException; diff --git a/integrations/vault/auths/common/src/main/java/io/helidon/integrations/vault/auths/common/VaultRestApi.java b/integrations/vault/auths/common/src/main/java/io/helidon/integrations/vault/auths/common/VaultRestApi.java index db190f982d9..2b855faab00 100644 --- a/integrations/vault/auths/common/src/main/java/io/helidon/integrations/vault/auths/common/VaultRestApi.java +++ b/integrations/vault/auths/common/src/main/java/io/helidon/integrations/vault/auths/common/VaultRestApi.java @@ -20,7 +20,7 @@ import java.util.LinkedList; import java.util.List; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.integrations.common.rest.ApiRequest; import io.helidon.integrations.common.rest.ApiRestException; import io.helidon.integrations.common.rest.ResponseBuilder; @@ -29,7 +29,7 @@ import io.helidon.integrations.vault.VaultOptionalResponse; import io.helidon.integrations.vault.VaultRestException; import io.helidon.integrations.vault.VaultUtil; -import io.helidon.nima.webclient.api.HttpClientResponse; +import io.helidon.webclient.api.HttpClientResponse; import jakarta.json.JsonObject; diff --git a/integrations/vault/auths/common/src/main/java/module-info.java b/integrations/vault/auths/common/src/main/java/module-info.java index 7d2ed2ea5a9..f593a2d6f00 100644 --- a/integrations/vault/auths/common/src/main/java/module-info.java +++ b/integrations/vault/auths/common/src/main/java/module-info.java @@ -18,11 +18,11 @@ * Common classes for Vault integration. */ module io.helidon.integrations.vault.auths.common { - requires io.helidon.common.http; + requires io.helidon.http; requires jakarta.json; requires io.helidon.integrations.common.rest; requires transitive io.helidon.integrations.vault; - requires io.helidon.nima.webclient; + requires io.helidon.webclient; exports io.helidon.integrations.vault.auths.common; diff --git a/integrations/vault/auths/k8s/src/main/java/io/helidon/integrations/vault/auths/k8s/K8sAuthImpl.java b/integrations/vault/auths/k8s/src/main/java/io/helidon/integrations/vault/auths/k8s/K8sAuthImpl.java index b81b033ab2f..d5534445b8f 100644 --- a/integrations/vault/auths/k8s/src/main/java/io/helidon/integrations/vault/auths/k8s/K8sAuthImpl.java +++ b/integrations/vault/auths/k8s/src/main/java/io/helidon/integrations/vault/auths/k8s/K8sAuthImpl.java @@ -16,7 +16,7 @@ package io.helidon.integrations.vault.auths.k8s; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.integrations.common.rest.RestApi; class K8sAuthImpl implements K8sAuth { diff --git a/integrations/vault/auths/k8s/src/main/java/io/helidon/integrations/vault/auths/k8s/K8sRestApi.java b/integrations/vault/auths/k8s/src/main/java/io/helidon/integrations/vault/auths/k8s/K8sRestApi.java index a1c74e25eba..8d060c0b890 100644 --- a/integrations/vault/auths/k8s/src/main/java/io/helidon/integrations/vault/auths/k8s/K8sRestApi.java +++ b/integrations/vault/auths/k8s/src/main/java/io/helidon/integrations/vault/auths/k8s/K8sRestApi.java @@ -19,11 +19,11 @@ import java.time.Instant; import java.util.concurrent.atomic.AtomicReference; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.integrations.common.rest.ApiRequest; import io.helidon.integrations.vault.VaultTokenBase; import io.helidon.integrations.vault.auths.common.VaultRestApi; -import io.helidon.nima.webclient.api.HttpClientRequest; +import io.helidon.webclient.api.HttpClientRequest; class K8sRestApi extends VaultRestApi { diff --git a/integrations/vault/auths/k8s/src/main/java/io/helidon/integrations/vault/auths/k8s/K8sVaultAuth.java b/integrations/vault/auths/k8s/src/main/java/io/helidon/integrations/vault/auths/k8s/K8sVaultAuth.java index 8c18d3d1b5e..e67a6eb7f75 100644 --- a/integrations/vault/auths/k8s/src/main/java/io/helidon/integrations/vault/auths/k8s/K8sVaultAuth.java +++ b/integrations/vault/auths/k8s/src/main/java/io/helidon/integrations/vault/auths/k8s/K8sVaultAuth.java @@ -25,8 +25,8 @@ import io.helidon.common.Weight; import io.helidon.common.Weighted; -import io.helidon.common.http.Http; import io.helidon.config.Config; +import io.helidon.http.Http; import io.helidon.integrations.common.rest.RestApi; import io.helidon.integrations.vault.Vault; import io.helidon.integrations.vault.VaultApiException; diff --git a/integrations/vault/auths/k8s/src/main/java/module-info.java b/integrations/vault/auths/k8s/src/main/java/module-info.java index bbaa5193d06..cb9732396d9 100644 --- a/integrations/vault/auths/k8s/src/main/java/module-info.java +++ b/integrations/vault/auths/k8s/src/main/java/module-info.java @@ -31,8 +31,8 @@ requires transitive io.helidon.integrations.vault; requires io.helidon.integrations.common.rest; requires io.helidon.integrations.vault.auths.common; - requires io.helidon.common.http; - requires io.helidon.nima.webclient; + requires io.helidon.http; + requires io.helidon.webclient; exports io.helidon.integrations.vault.auths.k8s; diff --git a/integrations/vault/auths/token/src/main/java/io/helidon/integrations/vault/auths/token/TokenAuthImpl.java b/integrations/vault/auths/token/src/main/java/io/helidon/integrations/vault/auths/token/TokenAuthImpl.java index 5f7a2b405f4..73825cf0d51 100644 --- a/integrations/vault/auths/token/src/main/java/io/helidon/integrations/vault/auths/token/TokenAuthImpl.java +++ b/integrations/vault/auths/token/src/main/java/io/helidon/integrations/vault/auths/token/TokenAuthImpl.java @@ -16,7 +16,7 @@ package io.helidon.integrations.vault.auths.token; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.integrations.common.rest.RestApi; class TokenAuthImpl implements TokenAuth { diff --git a/integrations/vault/auths/token/src/main/java/io/helidon/integrations/vault/auths/token/TokenVaultAuth.java b/integrations/vault/auths/token/src/main/java/io/helidon/integrations/vault/auths/token/TokenVaultAuth.java index c24a53a2ceb..f582fa7eb73 100644 --- a/integrations/vault/auths/token/src/main/java/io/helidon/integrations/vault/auths/token/TokenVaultAuth.java +++ b/integrations/vault/auths/token/src/main/java/io/helidon/integrations/vault/auths/token/TokenVaultAuth.java @@ -21,8 +21,8 @@ import io.helidon.common.Weight; import io.helidon.common.Weighted; -import io.helidon.common.http.Http; import io.helidon.config.Config; +import io.helidon.http.Http; import io.helidon.integrations.common.rest.RestApi; import io.helidon.integrations.vault.Vault; import io.helidon.integrations.vault.VaultApiException; diff --git a/integrations/vault/auths/token/src/main/java/module-info.java b/integrations/vault/auths/token/src/main/java/module-info.java index 0d139aac444..6911975bfcd 100644 --- a/integrations/vault/auths/token/src/main/java/module-info.java +++ b/integrations/vault/auths/token/src/main/java/module-info.java @@ -31,8 +31,8 @@ requires transitive io.helidon.integrations.vault; requires io.helidon.integrations.common.rest; requires io.helidon.integrations.vault.auths.common; - requires io.helidon.common.http; - requires io.helidon.nima.webclient; + requires io.helidon.http; + requires io.helidon.webclient; exports io.helidon.integrations.vault.auths.token; diff --git a/integrations/vault/secrets/kv2/src/main/java/io/helidon/integrations/vault/secrets/kv2/Kv2SecretsImpl.java b/integrations/vault/secrets/kv2/src/main/java/io/helidon/integrations/vault/secrets/kv2/Kv2SecretsImpl.java index 13489c71e58..99b87a26678 100644 --- a/integrations/vault/secrets/kv2/src/main/java/io/helidon/integrations/vault/secrets/kv2/Kv2SecretsImpl.java +++ b/integrations/vault/secrets/kv2/src/main/java/io/helidon/integrations/vault/secrets/kv2/Kv2SecretsImpl.java @@ -18,7 +18,7 @@ import java.util.Optional; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.integrations.common.rest.RestApi; import io.helidon.integrations.vault.ListSecrets; import io.helidon.integrations.vault.Vault; diff --git a/integrations/vault/secrets/kv2/src/main/java/module-info.java b/integrations/vault/secrets/kv2/src/main/java/module-info.java index 711810d46bc..59bb636a204 100644 --- a/integrations/vault/secrets/kv2/src/main/java/module-info.java +++ b/integrations/vault/secrets/kv2/src/main/java/module-info.java @@ -32,7 +32,7 @@ requires transitive io.helidon.integrations.vault; requires io.helidon.integrations.common.rest; - requires io.helidon.common.http; + requires io.helidon.http; requires transitive io.helidon.security; exports io.helidon.integrations.vault.secrets.kv2; diff --git a/integrations/vault/secrets/pki/src/main/java/io/helidon/integrations/vault/secrets/pki/PkiSecretsImpl.java b/integrations/vault/secrets/pki/src/main/java/io/helidon/integrations/vault/secrets/pki/PkiSecretsImpl.java index a67bee28b9a..5b31be84fc6 100644 --- a/integrations/vault/secrets/pki/src/main/java/io/helidon/integrations/vault/secrets/pki/PkiSecretsImpl.java +++ b/integrations/vault/secrets/pki/src/main/java/io/helidon/integrations/vault/secrets/pki/PkiSecretsImpl.java @@ -18,7 +18,7 @@ import java.util.function.Function; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.integrations.common.rest.RestApi; import io.helidon.integrations.vault.ListSecrets; import io.helidon.integrations.vault.Vault; diff --git a/integrations/vault/secrets/pki/src/main/java/module-info.java b/integrations/vault/secrets/pki/src/main/java/module-info.java index 59d56d868d7..ce9ad12197c 100644 --- a/integrations/vault/secrets/pki/src/main/java/module-info.java +++ b/integrations/vault/secrets/pki/src/main/java/module-info.java @@ -32,7 +32,7 @@ requires io.helidon.integrations.common.rest; requires transitive io.helidon.integrations.vault; - requires io.helidon.common.http; + requires io.helidon.http; exports io.helidon.integrations.vault.secrets.pki; diff --git a/integrations/vault/secrets/transit/src/main/java/io/helidon/integrations/vault/secrets/transit/TransitSecretsImpl.java b/integrations/vault/secrets/transit/src/main/java/io/helidon/integrations/vault/secrets/transit/TransitSecretsImpl.java index 35f3eba8538..30a59ba061f 100644 --- a/integrations/vault/secrets/transit/src/main/java/io/helidon/integrations/vault/secrets/transit/TransitSecretsImpl.java +++ b/integrations/vault/secrets/transit/src/main/java/io/helidon/integrations/vault/secrets/transit/TransitSecretsImpl.java @@ -16,7 +16,7 @@ package io.helidon.integrations.vault.secrets.transit; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.integrations.common.rest.RestApi; import io.helidon.integrations.vault.ListSecrets; import io.helidon.integrations.vault.Vault; diff --git a/integrations/vault/secrets/transit/src/main/java/module-info.java b/integrations/vault/secrets/transit/src/main/java/module-info.java index 98980040950..786d704f010 100644 --- a/integrations/vault/secrets/transit/src/main/java/module-info.java +++ b/integrations/vault/secrets/transit/src/main/java/module-info.java @@ -34,7 +34,7 @@ requires io.helidon.integrations.common.rest; requires transitive io.helidon.integrations.vault; - requires io.helidon.common.http; + requires io.helidon.http; requires transitive io.helidon.security; exports io.helidon.integrations.vault.secrets.transit; diff --git a/integrations/vault/vault/pom.xml b/integrations/vault/vault/pom.xml index 701237fc91e..887b0daf435 100644 --- a/integrations/vault/vault/pom.xml +++ b/integrations/vault/vault/pom.xml @@ -40,16 +40,16 @@ helidon-integrations-common-rest - io.helidon.nima.fault-tolerance - helidon-nima-fault-tolerance + io.helidon.fault-tolerance + helidon-fault-tolerance - io.helidon.nima.webclient - helidon-nima-webclient + io.helidon.webclient + helidon-webclient - io.helidon.nima.http.media - helidon-nima-http-media-jsonp + io.helidon.http.media + helidon-http-media-jsonp io.helidon.common.features diff --git a/integrations/vault/vault/src/main/java/io/helidon/integrations/vault/Vault.java b/integrations/vault/vault/src/main/java/io/helidon/integrations/vault/Vault.java index 2e37d810b3b..c62ea7cc9b8 100644 --- a/integrations/vault/vault/src/main/java/io/helidon/integrations/vault/Vault.java +++ b/integrations/vault/vault/src/main/java/io/helidon/integrations/vault/Vault.java @@ -22,13 +22,13 @@ import java.util.function.Consumer; import io.helidon.common.HelidonServiceLoader; -import io.helidon.common.http.Http; import io.helidon.config.Config; +import io.helidon.faulttolerance.FaultTolerance; +import io.helidon.faulttolerance.FtHandler; +import io.helidon.http.Http; import io.helidon.integrations.common.rest.RestApi; import io.helidon.integrations.vault.spi.VaultAuth; -import io.helidon.nima.faulttolerance.FaultTolerance; -import io.helidon.nima.faulttolerance.FtHandler; -import io.helidon.nima.webclient.api.WebClientConfig; +import io.helidon.webclient.api.WebClientConfig; /** * Main entry point to Vault operations. @@ -205,7 +205,7 @@ public Builder faultTolerance(FtHandler faultTolerance) { } /** - * A consumer that updates {@link io.helidon.nima.webclient.api.WebClientConfig.Builder}. + * A consumer that updates {@link io.helidon.webclient.api.WebClientConfig.Builder}. * The consumer may be invoked multiple times, for example when a Vault authentication * must use an un-authenticated Vault to authenticate. * diff --git a/integrations/vault/vault/src/main/java/io/helidon/integrations/vault/VaultOptionalResponse.java b/integrations/vault/vault/src/main/java/io/helidon/integrations/vault/VaultOptionalResponse.java index f4916e9276c..94c7f238791 100644 --- a/integrations/vault/vault/src/main/java/io/helidon/integrations/vault/VaultOptionalResponse.java +++ b/integrations/vault/vault/src/main/java/io/helidon/integrations/vault/VaultOptionalResponse.java @@ -24,8 +24,8 @@ /** * Response for Vault operations that may contain entity. - * The entity is present for successful requests (returning {@link io.helidon.common.http.Http.Status#OK_200}; - * entity is not present if the response was {@link io.helidon.common.http.Http.Status#NOT_FOUND_404}). + * The entity is present for successful requests (returning {@link io.helidon.http.Http.Status#OK_200}; + * entity is not present if the response was {@link io.helidon.http.Http.Status#NOT_FOUND_404}). * * @param type of the response - a subclass of this class */ @@ -57,7 +57,7 @@ public static Builder vaultResponseBuilder() { /** * List of errors (if any) as returned by Vault. - * This list may contain errors when we get a {@link io.helidon.common.http.Http.Status#NOT_FOUND_404}. + * This list may contain errors when we get a {@link io.helidon.http.Http.Status#NOT_FOUND_404}. * * @return list of errors from Vault */ diff --git a/integrations/vault/vault/src/main/java/module-info.java b/integrations/vault/vault/src/main/java/module-info.java index 3d55343c837..0c961c874af 100644 --- a/integrations/vault/vault/src/main/java/module-info.java +++ b/integrations/vault/vault/src/main/java/module-info.java @@ -33,8 +33,8 @@ requires io.helidon.common; requires transitive io.helidon.integrations.common.rest; - requires transitive io.helidon.nima.webclient; - requires transitive io.helidon.nima.faulttolerance; + requires transitive io.helidon.webclient; + requires transitive io.helidon.faulttolerance; exports io.helidon.integrations.vault; exports io.helidon.integrations.vault.spi; diff --git a/jersey/client/pom.xml b/jersey/client/pom.xml index 64e4ccc19b2..94dd26ea6ad 100644 --- a/jersey/client/pom.xml +++ b/jersey/client/pom.xml @@ -58,13 +58,13 @@ helidon-common-context - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver test - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test diff --git a/jersey/client/src/main/java/io/helidon/jersey/client/ClientBuilderListener.java b/jersey/client/src/main/java/io/helidon/jersey/client/ClientBuilderListener.java deleted file mode 100644 index 0718a542ca1..00000000000 --- a/jersey/client/src/main/java/io/helidon/jersey/client/ClientBuilderListener.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.jersey.client; - -import jakarta.annotation.Priority; -import jakarta.ws.rs.Priorities; -import jakarta.ws.rs.client.ClientBuilder; - -/** - * Listen to the Jersey's client builder being invoked and register Helidon executor provider. - */ -// Lowest priority gets invoked first and first registered provider wins, -// user's custom ClientBuilderListeners needs to be able to override this -@Priority(Priorities.USER + 100) -public class ClientBuilderListener implements org.glassfish.jersey.client.spi.ClientBuilderListener { - - private static final String USE_CONTEXT_AWARE_EXEC_PROVIDER = "io.helidon.jersey.client.useContextAwareExecutorProvider"; - private static Boolean useProvider; - - @Override - public void onNewBuilder(ClientBuilder builder) { - if (useContextAwareProvider()) { - builder.register(ExecutorProvider.class); - builder.register(ScheduledExecutorProvider.class); - } - } - - private boolean useContextAwareProvider() { - if (useProvider == null) { - useProvider = Boolean.parseBoolean(System.getProperty(USE_CONTEXT_AWARE_EXEC_PROVIDER, "true")); - } - return useProvider; - } -} diff --git a/jersey/client/src/main/java/io/helidon/jersey/client/JerseyClientBuilderListener.java b/jersey/client/src/main/java/io/helidon/jersey/client/JerseyClientBuilderListener.java new file mode 100644 index 00000000000..3590bb3dcd3 --- /dev/null +++ b/jersey/client/src/main/java/io/helidon/jersey/client/JerseyClientBuilderListener.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.jersey.client; + +import jakarta.annotation.Priority; +import jakarta.ws.rs.Priorities; +import jakarta.ws.rs.client.ClientBuilder; +import org.glassfish.jersey.client.spi.ClientBuilderListener; + +/** + * Listen to the Jersey's client builder being invoked and register Helidon executor provider. + */ +// Lowest priority gets invoked first and first registered provider wins, +// user's custom ClientBuilderListeners needs to be able to override this +@Priority(Priorities.USER + 100) +public class JerseyClientBuilderListener implements ClientBuilderListener { + + private static final String USE_CONTEXT_AWARE_EXEC_PROVIDER = "io.helidon.jersey.client.useContextAwareExecutorProvider"; + private static Boolean useProvider; + + @Override + public void onNewBuilder(ClientBuilder builder) { + if (useContextAwareProvider()) { + builder.register(ExecutorProvider.class); + builder.register(ScheduledExecutorProvider.class); + } + } + + private boolean useContextAwareProvider() { + if (useProvider == null) { + useProvider = Boolean.parseBoolean(System.getProperty(USE_CONTEXT_AWARE_EXEC_PROVIDER, "true")); + } + return useProvider; + } +} diff --git a/jersey/client/src/main/java/module-info.java b/jersey/client/src/main/java/module-info.java index 9b652b69632..680028cf0f4 100644 --- a/jersey/client/src/main/java/module-info.java +++ b/jersey/client/src/main/java/module-info.java @@ -14,6 +14,8 @@ * limitations under the License. */ +import io.helidon.jersey.client.JerseyClientBuilderListener; + /** * Jersey client. */ @@ -28,5 +30,5 @@ exports io.helidon.jersey.client; provides org.glassfish.jersey.client.spi.ClientBuilderListener - with io.helidon.jersey.client.ClientBuilderListener; + with JerseyClientBuilderListener; } diff --git a/jersey/client/src/test/java/io/helidon/jersey/client/ContextTest.java b/jersey/client/src/test/java/io/helidon/jersey/client/ContextTest.java index 5f9e8785fc7..2f65c9e9835 100644 --- a/jersey/client/src/test/java/io/helidon/jersey/client/ContextTest.java +++ b/jersey/client/src/test/java/io/helidon/jersey/client/ContextTest.java @@ -26,10 +26,10 @@ import io.helidon.common.context.Context; import io.helidon.common.context.Contexts; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.HttpRouting; import jakarta.ws.rs.client.ClientBuilder; import jakarta.ws.rs.client.Entity; diff --git a/jersey/connector/pom.xml b/jersey/connector/pom.xml index 26304b096a7..d56c2e689c3 100644 --- a/jersey/connector/pom.xml +++ b/jersey/connector/pom.xml @@ -42,8 +42,8 @@ jakarta.inject-api - io.helidon.nima.webclient - helidon-nima-webclient + io.helidon.webclient + helidon-webclient org.junit.jupiter diff --git a/jersey/connector/src/main/java/io/helidon/jersey/connector/HelidonConnector.java b/jersey/connector/src/main/java/io/helidon/jersey/connector/HelidonConnector.java index 57d066ddc5a..97efacc587a 100644 --- a/jersey/connector/src/main/java/io/helidon/jersey/connector/HelidonConnector.java +++ b/jersey/connector/src/main/java/io/helidon/jersey/connector/HelidonConnector.java @@ -29,15 +29,15 @@ import io.helidon.common.LazyValue; import io.helidon.common.Version; -import io.helidon.common.http.Http; +import io.helidon.common.tls.Tls; import io.helidon.common.uri.UriQueryWriteable; import io.helidon.config.Config; -import io.helidon.nima.common.tls.Tls; -import io.helidon.nima.http.media.ReadableEntity; -import io.helidon.nima.webclient.api.Proxy; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientRequest; -import io.helidon.nima.webclient.http1.Http1ClientResponse; +import io.helidon.http.Http; +import io.helidon.http.media.ReadableEntity; +import io.helidon.webclient.api.Proxy; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientRequest; +import io.helidon.webclient.http1.Http1ClientResponse; import jakarta.ws.rs.client.Client; import jakarta.ws.rs.core.Configuration; diff --git a/jersey/connector/src/main/java/io/helidon/jersey/connector/HelidonProperties.java b/jersey/connector/src/main/java/io/helidon/jersey/connector/HelidonProperties.java index e90d4505b9a..dd64eee86e9 100644 --- a/jersey/connector/src/main/java/io/helidon/jersey/connector/HelidonProperties.java +++ b/jersey/connector/src/main/java/io/helidon/jersey/connector/HelidonProperties.java @@ -27,7 +27,7 @@ private HelidonProperties() { } /** - * A Helidon {@link Config} instance used to create the corresponding {@link io.helidon.nima.webclient.api.WebClient}. + * A Helidon {@link Config} instance used to create the corresponding {@link io.helidon.webclient.api.WebClient}. * This property is settable on {@link jakarta.ws.rs.core.Configurable#property(String, Object)}. */ public static final String CONFIG = "jersey.connector.helidon.config"; diff --git a/jersey/connector/src/main/java/io/helidon/jersey/connector/ProxyBuilder.java b/jersey/connector/src/main/java/io/helidon/jersey/connector/ProxyBuilder.java index f03cb660810..88599d35b34 100644 --- a/jersey/connector/src/main/java/io/helidon/jersey/connector/ProxyBuilder.java +++ b/jersey/connector/src/main/java/io/helidon/jersey/connector/ProxyBuilder.java @@ -20,7 +20,7 @@ import java.util.Locale; import java.util.Optional; -import io.helidon.nima.webclient.api.Proxy; +import io.helidon.webclient.api.Proxy; import jakarta.ws.rs.ProcessingException; import jakarta.ws.rs.core.Configuration; diff --git a/jersey/connector/src/main/java/module-info.java b/jersey/connector/src/main/java/module-info.java index f773ece5c95..aecad4e5934 100644 --- a/jersey/connector/src/main/java/module-info.java +++ b/jersey/connector/src/main/java/module-info.java @@ -26,7 +26,7 @@ requires jakarta.ws.rs; requires jersey.client; requires jersey.common; - requires io.helidon.nima.webclient; + requires io.helidon.webclient; requires io.helidon.config; exports io.helidon.jersey.connector; diff --git a/jersey/connector/src/test/java/io/helidon/jersey/connector/ConfigTest.java b/jersey/connector/src/test/java/io/helidon/jersey/connector/ConfigTest.java index d3c3c90b76a..5f66080e26a 100644 --- a/jersey/connector/src/test/java/io/helidon/jersey/connector/ConfigTest.java +++ b/jersey/connector/src/test/java/io/helidon/jersey/connector/ConfigTest.java @@ -20,8 +20,8 @@ import io.helidon.config.Config; import io.helidon.config.ConfigSources; -import io.helidon.nima.webclient.api.Proxy; -import io.helidon.nima.webclient.http1.Http1ClientRequest; +import io.helidon.webclient.api.Proxy; +import io.helidon.webclient.http1.Http1ClientRequest; import jakarta.ws.rs.client.Client; import jakarta.ws.rs.client.ClientBuilder; diff --git a/jersey/jsonp/pom.xml b/jersey/jsonp/pom.xml index 27e8b057d3b..0e0b2548f1f 100644 --- a/jersey/jsonp/pom.xml +++ b/jersey/jsonp/pom.xml @@ -29,6 +29,7 @@ Helidon Jersey Media JSON-P + true true diff --git a/jersey/pom.xml b/jersey/pom.xml index cbbd5474041..adb516f119a 100644 --- a/jersey/pom.xml +++ b/jersey/pom.xml @@ -43,8 +43,12 @@ common - - - true - + + + tests + + tests + + + diff --git a/jersey/server/pom.xml b/jersey/server/pom.xml index 6a6c3bd9983..05d4a2ba648 100644 --- a/jersey/server/pom.xml +++ b/jersey/server/pom.xml @@ -29,6 +29,7 @@ Helidon Jersey Server + true true diff --git a/jersey/tests/connector/pom.xml b/jersey/tests/connector/pom.xml new file mode 100644 index 00000000000..926fca37b40 --- /dev/null +++ b/jersey/tests/connector/pom.xml @@ -0,0 +1,67 @@ + + + + 4.0.0 + + io.helidon.jersey.tests + helidon-jersey-tests-project + 4.0.0-SNAPSHOT + + + helidon-jersey-tests-connector + Helidon Jersey Tests Connector + + + + org.glassfish.jersey.core + jersey-client + test + + + io.helidon.jersey + helidon-jersey-connector + test + + + io.helidon.webserver + helidon-webserver + test + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 + test + + + io.helidon.common.testing + helidon-common-testing-http-junit5 + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + diff --git a/tests/integration/jersey-connector/src/test/java/io/helidon/jersey/connector/JerseyConnectorTest.java b/jersey/tests/connector/src/test/java/io/helidon/jersey/connector/JerseyConnectorTest.java similarity index 93% rename from tests/integration/jersey-connector/src/test/java/io/helidon/jersey/connector/JerseyConnectorTest.java rename to jersey/tests/connector/src/test/java/io/helidon/jersey/connector/JerseyConnectorTest.java index b8a4dbd514d..13c682d3302 100644 --- a/tests/integration/jersey-connector/src/test/java/io/helidon/jersey/connector/JerseyConnectorTest.java +++ b/jersey/tests/connector/src/test/java/io/helidon/jersey/connector/JerseyConnectorTest.java @@ -18,14 +18,14 @@ import java.util.Arrays; -import io.helidon.common.http.Http; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; - -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.Http; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; + +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import jakarta.ws.rs.client.Client; import jakarta.ws.rs.client.ClientBuilder; import jakarta.ws.rs.client.Entity; diff --git a/jersey/tests/connector/src/test/resources/logging-test.properties b/jersey/tests/connector/src/test/resources/logging-test.properties new file mode 100644 index 00000000000..fe804c3ed3a --- /dev/null +++ b/jersey/tests/connector/src/test/resources/logging-test.properties @@ -0,0 +1,25 @@ +# +# Copyright (c) 2023 Oracle and/or its affiliates. +# +# 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. +# +handlers=java.util.logging.ConsoleHandler +java.util.logging.ConsoleHandler.level=INFO +java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter +java.util.logging.SimpleFormatter.format=%1$tH:%1$tM:%1$tS %4$s %3$s %5$s%6$s%n +# Global logging level. Can be overridden by specific loggers +.level=INFO +io.helidon.webclient.level=INFO +io.helidon.webclient.http1.ClientRequestImpl.level=INFO +io.helidon.webclient.http1.Http1ClientConnection.level=INFO +io.helidon.common.testing.http.junit5.level=INFO diff --git a/jersey/tests/pom.xml b/jersey/tests/pom.xml new file mode 100644 index 00000000000..917e26c1374 --- /dev/null +++ b/jersey/tests/pom.xml @@ -0,0 +1,49 @@ + + + + + 4.0.0 + + io.helidon.jersey + helidon-jersey-project + 4.0.0-SNAPSHOT + + + io.helidon.jersey.tests + helidon-jersey-tests-project + Helidon Jersey Tests Project + + pom + + + connector + + + + true + true + true + true + true + true + true + + diff --git a/logging/pom.xml b/logging/pom.xml index 0e72f02b54e..44423e40a33 100644 --- a/logging/pom.xml +++ b/logging/pom.xml @@ -36,4 +36,12 @@ log4j + + + tests + + tests + + + diff --git a/logging/tests/log4j/pom.xml b/logging/tests/log4j/pom.xml new file mode 100644 index 00000000000..5f917fc6fce --- /dev/null +++ b/logging/tests/log4j/pom.xml @@ -0,0 +1,65 @@ + + + + 4.0.0 + + io.helidon.logging.tests + helidon-logging-tests-project + 4.0.0-SNAPSHOT + + + helidon-logging-tests-log4j + Helidon Logging Tests Log4j + + + + + io.helidon.webserver + helidon-webserver + + + + + io.helidon.logging + helidon-logging-log4j + + + + + org.apache.logging.log4j + log4j-core + + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + diff --git a/nima/tests/integration/logging/log4j/src/test/java/io/helidon/nima/tests/integration/logger/log4j/Log4jTest.java b/logging/tests/log4j/src/test/java/io/helidon/logging/tests/log4j/Log4jTest.java similarity index 82% rename from nima/tests/integration/logging/log4j/src/test/java/io/helidon/nima/tests/integration/logger/log4j/Log4jTest.java rename to logging/tests/log4j/src/test/java/io/helidon/logging/tests/log4j/Log4jTest.java index 01bdca16977..84713a94872 100644 --- a/nima/tests/integration/logging/log4j/src/test/java/io/helidon/nima/tests/integration/logger/log4j/Log4jTest.java +++ b/logging/tests/log4j/src/test/java/io/helidon/logging/tests/log4j/Log4jTest.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.helidon.nima.tests.integration.logger.log4j; +package io.helidon.logging.tests.log4j; -import io.helidon.common.http.Http; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webserver.http.HttpRules; +import io.helidon.http.Http; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webserver.http.HttpRules; import org.junit.jupiter.api.Test; diff --git a/nima/tests/integration/logging/log4j/src/test/resources/log4j2.xml b/logging/tests/log4j/src/test/resources/log4j2.xml similarity index 91% rename from nima/tests/integration/logging/log4j/src/test/resources/log4j2.xml rename to logging/tests/log4j/src/test/resources/log4j2.xml index 11bf7e61379..c6c40455047 100644 --- a/nima/tests/integration/logging/log4j/src/test/resources/log4j2.xml +++ b/logging/tests/log4j/src/test/resources/log4j2.xml @@ -1,5 +1,5 @@ + + + 4.0.0 + + io.helidon.logging + helidon-logging-project + 4.0.0-SNAPSHOT + + + io.helidon.logging.tests + helidon-logging-tests-project + Helidon Logging Tests Project + + pom + + + log4j + + + + true + true + true + true + true + true + true + + diff --git a/lra/coordinator/client/narayana-client/pom.xml b/lra/coordinator/client/narayana-client/pom.xml index 533610b310c..5dc14be88d3 100644 --- a/lra/coordinator/client/narayana-client/pom.xml +++ b/lra/coordinator/client/narayana-client/pom.xml @@ -37,12 +37,12 @@ compile - io.helidon.nima.webclient - helidon-nima-webclient + io.helidon.webclient + helidon-webclient - io.helidon.nima.fault-tolerance - helidon-nima-fault-tolerance + io.helidon.fault-tolerance + helidon-fault-tolerance io.helidon.microprofile.config diff --git a/lra/coordinator/client/narayana-client/src/main/java/io/helidon/lra/coordinator/client/narayana/LraStatusSupport.java b/lra/coordinator/client/narayana-client/src/main/java/io/helidon/lra/coordinator/client/narayana/LraStatusSupport.java index 7a768a81cbf..1b9bcb9e3b0 100644 --- a/lra/coordinator/client/narayana-client/src/main/java/io/helidon/lra/coordinator/client/narayana/LraStatusSupport.java +++ b/lra/coordinator/client/narayana-client/src/main/java/io/helidon/lra/coordinator/client/narayana/LraStatusSupport.java @@ -24,10 +24,10 @@ import java.util.Optional; import io.helidon.common.GenericType; -import io.helidon.common.http.Headers; -import io.helidon.common.http.HttpMediaType; -import io.helidon.nima.http.media.EntityReader; -import io.helidon.nima.http.media.MediaSupport; +import io.helidon.http.Headers; +import io.helidon.http.HttpMediaType; +import io.helidon.http.media.EntityReader; +import io.helidon.http.media.MediaSupport; import org.eclipse.microprofile.lra.annotation.LRAStatus; diff --git a/lra/coordinator/client/narayana-client/src/main/java/io/helidon/lra/coordinator/client/narayana/NarayanaClient.java b/lra/coordinator/client/narayana-client/src/main/java/io/helidon/lra/coordinator/client/narayana/NarayanaClient.java index fd1fe6df7f4..0afd1701fa2 100644 --- a/lra/coordinator/client/narayana-client/src/main/java/io/helidon/lra/coordinator/client/narayana/NarayanaClient.java +++ b/lra/coordinator/client/narayana-client/src/main/java/io/helidon/lra/coordinator/client/narayana/NarayanaClient.java @@ -27,18 +27,18 @@ import java.util.regex.Pattern; import java.util.stream.Collectors; -import io.helidon.common.http.ClientRequestHeaders; -import io.helidon.common.http.Http; import io.helidon.common.socket.SocketOptions; +import io.helidon.faulttolerance.Retry; +import io.helidon.http.ClientRequestHeaders; +import io.helidon.http.Http; +import io.helidon.http.media.MediaContext; import io.helidon.lra.coordinator.client.CoordinatorClient; import io.helidon.lra.coordinator.client.CoordinatorConnectionException; import io.helidon.lra.coordinator.client.Participant; import io.helidon.lra.coordinator.client.PropagatedHeaders; -import io.helidon.nima.faulttolerance.Retry; -import io.helidon.nima.http.media.MediaContext; -import io.helidon.nima.webclient.api.HttpClientRequest; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.api.WebClient; +import io.helidon.webclient.api.HttpClientRequest; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.api.WebClient; import org.eclipse.microprofile.lra.annotation.LRAStatus; import org.eclipse.microprofile.lra.annotation.ws.rs.LRA; diff --git a/lra/coordinator/client/narayana-client/src/main/java/module-info.java b/lra/coordinator/client/narayana-client/src/main/java/module-info.java index 108b8af5d4f..057c2f47c78 100644 --- a/lra/coordinator/client/narayana-client/src/main/java/module-info.java +++ b/lra/coordinator/client/narayana-client/src/main/java/module-info.java @@ -22,8 +22,8 @@ requires microprofile.lra.api; requires io.helidon.microprofile.config; requires io.helidon.lra.coordinator.client; - requires io.helidon.nima.webclient; - requires io.helidon.nima.faulttolerance; + requires io.helidon.webclient; + requires io.helidon.faulttolerance; provides io.helidon.lra.coordinator.client.CoordinatorClient with io.helidon.lra.coordinator.client.narayana.NarayanaClient; diff --git a/lra/coordinator/server/pom.xml b/lra/coordinator/server/pom.xml index 2311086b81c..67ad764168e 100644 --- a/lra/coordinator/server/pom.xml +++ b/lra/coordinator/server/pom.xml @@ -48,32 +48,32 @@ microprofile-lra-api - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.nima.http.media - helidon-nima-http-media-jsonp + io.helidon.http.media + helidon-http-media-jsonp io.helidon.config helidon-config-yaml - helidon-nima-observe-health - io.helidon.nima.observe + io.helidon.webserver.observe + helidon-webserver-observe-health - helidon-nima-observe-metrics - io.helidon.nima.observe + io.helidon.webserver.observe + helidon-webserver-observe-metrics io.helidon.health helidon-health-checks - io.helidon.nima.webclient - helidon-nima-webclient + io.helidon.webclient + helidon-webclient io.helidon.scheduling @@ -100,8 +100,8 @@ slf4j-jdk14 - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test diff --git a/lra/coordinator/server/src/main/java/io/helidon/lra/coordinator/CoordinatorService.java b/lra/coordinator/server/src/main/java/io/helidon/lra/coordinator/CoordinatorService.java index 4e4d2f7a3b7..4362dedffb3 100644 --- a/lra/coordinator/server/src/main/java/io/helidon/lra/coordinator/CoordinatorService.java +++ b/lra/coordinator/server/src/main/java/io/helidon/lra/coordinator/CoordinatorService.java @@ -31,15 +31,15 @@ import java.util.stream.Stream; import io.helidon.common.LazyValue; -import io.helidon.common.http.Http; import io.helidon.config.Config; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.Http; import io.helidon.scheduling.FixedRateInvocation; import io.helidon.scheduling.Scheduling; import io.helidon.scheduling.Task; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import jakarta.json.Json; import jakarta.json.JsonArray; @@ -50,11 +50,11 @@ import org.eclipse.microprofile.lra.annotation.LRAStatus; import org.eclipse.microprofile.lra.annotation.ws.rs.LRA; -import static io.helidon.common.http.Http.Status.CREATED_201; -import static io.helidon.common.http.Http.Status.GONE_410; -import static io.helidon.common.http.Http.Status.NOT_FOUND_404; -import static io.helidon.common.http.Http.Status.OK_200; -import static io.helidon.common.http.Http.Status.PRECONDITION_FAILED_412; +import static io.helidon.http.Http.Status.CREATED_201; +import static io.helidon.http.Http.Status.GONE_410; +import static io.helidon.http.Http.Status.NOT_FOUND_404; +import static io.helidon.http.Http.Status.OK_200; +import static io.helidon.http.Http.Status.PRECONDITION_FAILED_412; /** * LRA coordinator with Narayana like rest api. diff --git a/lra/coordinator/server/src/main/java/io/helidon/lra/coordinator/Lra.java b/lra/coordinator/server/src/main/java/io/helidon/lra/coordinator/Lra.java index 06f7f39fca7..6aa5a04070f 100644 --- a/lra/coordinator/server/src/main/java/io/helidon/lra/coordinator/Lra.java +++ b/lra/coordinator/server/src/main/java/io/helidon/lra/coordinator/Lra.java @@ -31,9 +31,9 @@ import java.util.stream.Collectors; import io.helidon.common.LazyValue; -import io.helidon.common.http.ClientRequestHeaders; -import io.helidon.common.http.Http; import io.helidon.config.Config; +import io.helidon.http.ClientRequestHeaders; +import io.helidon.http.Http; import io.helidon.metrics.api.Registry; import io.helidon.metrics.api.RegistryFactory; diff --git a/lra/coordinator/server/src/main/java/io/helidon/lra/coordinator/Main.java b/lra/coordinator/server/src/main/java/io/helidon/lra/coordinator/Main.java index 451e016172b..5afc96bcdd7 100644 --- a/lra/coordinator/server/src/main/java/io/helidon/lra/coordinator/Main.java +++ b/lra/coordinator/server/src/main/java/io/helidon/lra/coordinator/Main.java @@ -19,10 +19,10 @@ import io.helidon.config.Config; import io.helidon.health.checks.HealthChecks; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.observe.health.HealthFeature; -import io.helidon.nima.observe.metrics.MetricsFeature; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.observe.health.HealthFeature; +import io.helidon.webserver.observe.metrics.MetricsFeature; /** * In memory Lra coordinator. diff --git a/lra/coordinator/server/src/main/java/io/helidon/lra/coordinator/Participant.java b/lra/coordinator/server/src/main/java/io/helidon/lra/coordinator/Participant.java index 4d3bc117db6..8ce4f5a3309 100644 --- a/lra/coordinator/server/src/main/java/io/helidon/lra/coordinator/Participant.java +++ b/lra/coordinator/server/src/main/java/io/helidon/lra/coordinator/Participant.java @@ -29,8 +29,8 @@ import java.util.stream.Stream; import io.helidon.config.Config; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.api.WebClient; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.api.WebClient; import org.eclipse.microprofile.lra.annotation.LRAStatus; import org.eclipse.microprofile.lra.annotation.ParticipantStatus; diff --git a/lra/coordinator/server/src/main/java/module-info.java b/lra/coordinator/server/src/main/java/module-info.java index fea7a5a21df..61aa8258c3e 100644 --- a/lra/coordinator/server/src/main/java/module-info.java +++ b/lra/coordinator/server/src/main/java/module-info.java @@ -20,11 +20,11 @@ module io.helidon.lra.coordinator { requires jakarta.json; requires microprofile.lra.api; - requires io.helidon.nima.webclient; - requires io.helidon.nima.webserver; - requires io.helidon.nima.observe.metrics; - requires io.helidon.nima.observe.health; - requires io.helidon.nima.http.media.jsonp; + requires io.helidon.webclient; + requires io.helidon.webserver; + requires io.helidon.webserver.observe.metrics; + requires io.helidon.webserver.observe.health; + requires io.helidon.http.media.jsonp; requires io.helidon.scheduling; requires io.helidon.dbclient; requires io.helidon.dbclient.jdbc; diff --git a/lra/coordinator/server/src/test/java/io/helidon/lra/coordinator/CoordinatorTest.java b/lra/coordinator/server/src/test/java/io/helidon/lra/coordinator/CoordinatorTest.java index ab9bd129535..aeeaabd2a7a 100644 --- a/lra/coordinator/server/src/test/java/io/helidon/lra/coordinator/CoordinatorTest.java +++ b/lra/coordinator/server/src/test/java/io/helidon/lra/coordinator/CoordinatorTest.java @@ -21,13 +21,13 @@ import io.helidon.config.Config; import io.helidon.config.ConfigSources; -import io.helidon.nima.http.media.jsonp.JsonpSupport; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.testing.junit5.webserver.Socket; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; +import io.helidon.http.media.jsonp.JsonpSupport; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webserver.testing.junit5.Socket; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; import jakarta.json.JsonArray; import jakarta.json.JsonValue; diff --git a/metrics/api/pom.xml b/metrics/api/pom.xml index 5dd8c4bb8ae..af23d2cc263 100644 --- a/metrics/api/pom.xml +++ b/metrics/api/pom.xml @@ -18,12 +18,12 @@ + 4.0.0 io.helidon.metrics helidon-metrics-project 4.0.0-SNAPSHOT - 4.0.0 helidon-metrics-api Helidon Metrics API @@ -34,8 +34,8 @@ - io.helidon.common - helidon-common-http + io.helidon.http + helidon-http io.helidon.common diff --git a/metrics/api/src/main/java/module-info.java b/metrics/api/src/main/java/module-info.java index 0bfcf96d283..0f1e122e81b 100644 --- a/metrics/api/src/main/java/module-info.java +++ b/metrics/api/src/main/java/module-info.java @@ -22,7 +22,7 @@ */ module io.helidon.metrics.api { - requires io.helidon.common.http; + requires io.helidon.http; requires transitive io.helidon.common.config; requires transitive microprofile.metrics.api; diff --git a/metrics/prometheus/pom.xml b/metrics/prometheus/pom.xml index 0c68e98bd9b..c2bde260e2f 100644 --- a/metrics/prometheus/pom.xml +++ b/metrics/prometheus/pom.xml @@ -31,8 +31,8 @@ - io.helidon.nima.service-common - helidon-nima-service-common + io.helidon.webserver + helidon-webserver-service-common io.prometheus @@ -49,8 +49,8 @@ test - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test diff --git a/metrics/prometheus/src/main/java/io/helidon/metrics/prometheus/PrometheusSupport.java b/metrics/prometheus/src/main/java/io/helidon/metrics/prometheus/PrometheusSupport.java index 1838b504715..7948699fd6e 100644 --- a/metrics/prometheus/src/main/java/io/helidon/metrics/prometheus/PrometheusSupport.java +++ b/metrics/prometheus/src/main/java/io/helidon/metrics/prometheus/PrometheusSupport.java @@ -22,13 +22,13 @@ import java.util.Optional; import java.util.Set; -import io.helidon.common.http.HttpMediaType; -import io.helidon.nima.servicecommon.HelidonFeatureSupport; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.HttpMediaType; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; +import io.helidon.webserver.servicecommon.HelidonFeatureSupport; import io.prometheus.client.Collector; import io.prometheus.client.CollectorRegistry; diff --git a/metrics/prometheus/src/main/java/module-info.java b/metrics/prometheus/src/main/java/module-info.java index b764aea60a3..9ee3fbf0061 100644 --- a/metrics/prometheus/src/main/java/module-info.java +++ b/metrics/prometheus/src/main/java/module-info.java @@ -18,7 +18,7 @@ * Prometheus support. */ module io.helidon.metrics.prometheus { - requires io.helidon.nima.servicecommon; + requires io.helidon.servicecommon; // prometheus :( requires simpleclient; diff --git a/metrics/prometheus/src/test/java/io/helidon/metrics/prometheus/PrometheusSupportTest.java b/metrics/prometheus/src/test/java/io/helidon/metrics/prometheus/PrometheusSupportTest.java index 8c58d4bad49..f5097aef876 100644 --- a/metrics/prometheus/src/test/java/io/helidon/metrics/prometheus/PrometheusSupportTest.java +++ b/metrics/prometheus/src/test/java/io/helidon/metrics/prometheus/PrometheusSupportTest.java @@ -16,12 +16,12 @@ package io.helidon.metrics.prometheus; -import io.helidon.common.http.Http; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.http.Http; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.http.HttpRouting; import io.prometheus.client.CollectorRegistry; import io.prometheus.client.Counter; diff --git a/microprofile/access-log/pom.xml b/microprofile/access-log/pom.xml index 2918926e667..49b6673fcc2 100644 --- a/microprofile/access-log/pom.xml +++ b/microprofile/access-log/pom.xml @@ -37,8 +37,8 @@ provided - io.helidon.nima.webserver - helidon-nima-webserver-access-log + io.helidon.webserver + helidon-webserver-access-log jakarta.interceptor diff --git a/microprofile/access-log/src/main/java/io/helidon/microprofile/accesslog/AccessLogCdiExtension.java b/microprofile/access-log/src/main/java/io/helidon/microprofile/accesslog/AccessLogCdiExtension.java index 44f5b1be426..934dfb4d866 100644 --- a/microprofile/access-log/src/main/java/io/helidon/microprofile/accesslog/AccessLogCdiExtension.java +++ b/microprofile/access-log/src/main/java/io/helidon/microprofile/accesslog/AccessLogCdiExtension.java @@ -18,7 +18,7 @@ import io.helidon.config.Config; import io.helidon.microprofile.cdi.RuntimeStart; import io.helidon.microprofile.server.ServerCdiExtension; -import io.helidon.nima.webserver.accesslog.AccessLogFeature; +import io.helidon.webserver.accesslog.AccessLogFeature; import jakarta.annotation.Priority; import jakarta.enterprise.event.Observes; diff --git a/microprofile/access-log/src/main/java/module-info.java b/microprofile/access-log/src/main/java/module-info.java index a3727e11eed..7195af7ad8c 100644 --- a/microprofile/access-log/src/main/java/module-info.java +++ b/microprofile/access-log/src/main/java/module-info.java @@ -31,7 +31,7 @@ requires jakarta.annotation; requires io.helidon.microprofile.server; - requires io.helidon.nima.webserver.accesslog; + requires io.helidon.webserver.accesslog; exports io.helidon.microprofile.accesslog; diff --git a/microprofile/cors/pom.xml b/microprofile/cors/pom.xml index 661eb5d1fe7..47a5fd4da12 100644 --- a/microprofile/cors/pom.xml +++ b/microprofile/cors/pom.xml @@ -41,16 +41,16 @@ helidon-jersey-common - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver io.helidon.microprofile.config helidon-microprofile-config - io.helidon.nima.webserver - helidon-nima-webserver-cors + io.helidon.webserver + helidon-webserver-cors io.helidon.config diff --git a/microprofile/cors/src/main/java/io/helidon/microprofile/cors/CorsSupportMp.java b/microprofile/cors/src/main/java/io/helidon/microprofile/cors/CorsSupportMp.java index 82d43c13ce1..fd21c0e225f 100644 --- a/microprofile/cors/src/main/java/io/helidon/microprofile/cors/CorsSupportMp.java +++ b/microprofile/cors/src/main/java/io/helidon/microprofile/cors/CorsSupportMp.java @@ -20,11 +20,11 @@ import java.util.Optional; import java.util.function.Supplier; -import io.helidon.common.http.Http; import io.helidon.cors.CorsRequestAdapter; import io.helidon.cors.CorsResponseAdapter; import io.helidon.cors.CorsSupportBase; import io.helidon.cors.CrossOriginConfig; +import io.helidon.http.Http; import jakarta.ws.rs.container.ContainerRequestContext; import jakarta.ws.rs.container.ContainerResponseContext; @@ -110,7 +110,7 @@ static class RequestAdapterMp implements CorsRequestAdaptermicroprofile-fault-tolerance-api - io.helidon.nima.fault-tolerance - helidon-nima-fault-tolerance + io.helidon.fault-tolerance + helidon-fault-tolerance org.eclipse.microprofile.metrics diff --git a/microprofile/fault-tolerance/src/main/java/io/helidon/microprofile/faulttolerance/MethodInvoker.java b/microprofile/fault-tolerance/src/main/java/io/helidon/microprofile/faulttolerance/MethodInvoker.java index c9820fadfee..1c91b24f083 100644 --- a/microprofile/fault-tolerance/src/main/java/io/helidon/microprofile/faulttolerance/MethodInvoker.java +++ b/microprofile/fault-tolerance/src/main/java/io/helidon/microprofile/faulttolerance/MethodInvoker.java @@ -31,22 +31,24 @@ import io.helidon.common.context.Context; import io.helidon.common.context.Contexts; -import io.helidon.nima.faulttolerance.Async; -import io.helidon.nima.faulttolerance.Bulkhead; -import io.helidon.nima.faulttolerance.CircuitBreaker; -import io.helidon.nima.faulttolerance.CircuitBreaker.State; -import io.helidon.nima.faulttolerance.Fallback; -import io.helidon.nima.faulttolerance.FaultTolerance; -import io.helidon.nima.faulttolerance.FtHandlerTyped; -import io.helidon.nima.faulttolerance.Retry; -import io.helidon.nima.faulttolerance.RetryTimeoutException; -import io.helidon.nima.faulttolerance.Timeout; +import io.helidon.faulttolerance.Async; +import io.helidon.faulttolerance.Bulkhead; +import io.helidon.faulttolerance.CircuitBreaker; +import io.helidon.faulttolerance.CircuitBreaker.State; +import io.helidon.faulttolerance.Fallback; +import io.helidon.faulttolerance.FaultTolerance; +import io.helidon.faulttolerance.FtHandlerTyped; +import io.helidon.faulttolerance.Retry; +import io.helidon.faulttolerance.RetryTimeoutException; +import io.helidon.faulttolerance.Timeout; import jakarta.interceptor.InvocationContext; import org.eclipse.microprofile.faulttolerance.exceptions.BulkheadException; import org.eclipse.microprofile.faulttolerance.exceptions.CircuitBreakerOpenException; import org.eclipse.microprofile.metrics.Counter; +import static io.helidon.faulttolerance.SupplierHelper.toRuntimeException; +import static io.helidon.faulttolerance.SupplierHelper.unwrapThrowable; import static io.helidon.microprofile.faulttolerance.FaultToleranceExtension.isFaultToleranceMetricsEnabled; import static io.helidon.microprofile.faulttolerance.FaultToleranceMetrics.BulkheadCallsTotal; import static io.helidon.microprofile.faulttolerance.FaultToleranceMetrics.BulkheadExecutionsRunning; @@ -71,8 +73,6 @@ import static io.helidon.microprofile.faulttolerance.FaultToleranceMetrics.TimeoutTimedOut; import static io.helidon.microprofile.faulttolerance.ThrowableMapper.map; import static io.helidon.microprofile.faulttolerance.ThrowableMapper.mapTypes; -import static io.helidon.nima.faulttolerance.SupplierHelper.toRuntimeException; -import static io.helidon.nima.faulttolerance.SupplierHelper.unwrapThrowable; /** * Invokes a FT method applying semantics based on method annotations. An instance diff --git a/microprofile/fault-tolerance/src/main/java/io/helidon/microprofile/faulttolerance/ThrowableMapper.java b/microprofile/fault-tolerance/src/main/java/io/helidon/microprofile/faulttolerance/ThrowableMapper.java index 790f200b58f..1bd108b2886 100644 --- a/microprofile/fault-tolerance/src/main/java/io/helidon/microprofile/faulttolerance/ThrowableMapper.java +++ b/microprofile/fault-tolerance/src/main/java/io/helidon/microprofile/faulttolerance/ThrowableMapper.java @@ -20,7 +20,7 @@ import java.util.Set; import java.util.concurrent.ExecutionException; -import io.helidon.nima.faulttolerance.RetryTimeoutException; +import io.helidon.faulttolerance.RetryTimeoutException; import org.eclipse.microprofile.faulttolerance.exceptions.BulkheadException; import org.eclipse.microprofile.faulttolerance.exceptions.CircuitBreakerOpenException; @@ -45,16 +45,16 @@ static Throwable map(Throwable t) { if (t instanceof ExecutionException) { t = t.getCause(); } - if (t instanceof io.helidon.nima.faulttolerance.CircuitBreakerOpenException) { + if (t instanceof io.helidon.faulttolerance.CircuitBreakerOpenException) { return new CircuitBreakerOpenException(t.getMessage(), t.getCause()); } - if (t instanceof io.helidon.nima.faulttolerance.BulkheadException) { + if (t instanceof io.helidon.faulttolerance.BulkheadException) { return new BulkheadException(t.getMessage(), t.getCause()); } if (t instanceof RetryTimeoutException) { return t; // the cause is handled elsewhere } - if (t instanceof io.helidon.nima.faulttolerance.TimeoutException + if (t instanceof io.helidon.faulttolerance.TimeoutException || t instanceof java.lang.InterruptedException) { return new TimeoutException(t.getMessage(), t.getCause()); } @@ -76,11 +76,11 @@ static Set> mapTypes(Class[] typ for (int i = 0; i < types.length; i++) { Class t = types[i]; if (t == BulkheadException.class) { - result[i] = io.helidon.nima.faulttolerance.BulkheadException.class; + result[i] = io.helidon.faulttolerance.BulkheadException.class; } else if (t == CircuitBreakerOpenException.class) { - result[i] = io.helidon.nima.faulttolerance.CircuitBreakerOpenException.class; + result[i] = io.helidon.faulttolerance.CircuitBreakerOpenException.class; } else if (t == TimeoutException.class) { - result[i] = io.helidon.nima.faulttolerance.TimeoutException.class; + result[i] = io.helidon.faulttolerance.TimeoutException.class; } else { result[i] = t; } diff --git a/microprofile/fault-tolerance/src/main/java/module-info.java b/microprofile/fault-tolerance/src/main/java/module-info.java index 69762c6e63f..d80d294a1ef 100644 --- a/microprofile/fault-tolerance/src/main/java/module-info.java +++ b/microprofile/fault-tolerance/src/main/java/module-info.java @@ -35,7 +35,7 @@ requires io.helidon.common.context; requires io.helidon.common.configurable; - requires io.helidon.nima.faulttolerance; + requires io.helidon.faulttolerance; requires io.helidon.microprofile.config; requires io.helidon.microprofile.server; requires io.helidon.microprofile.metrics; diff --git a/microprofile/graphql/server/pom.xml b/microprofile/graphql/server/pom.xml index f1302469315..e2a1848151e 100644 --- a/microprofile/graphql/server/pom.xml +++ b/microprofile/graphql/server/pom.xml @@ -39,12 +39,8 @@ microprofile-graphql-api - io.helidon.graphql - helidon-graphql-server - - - io.helidon.nima.graphql - helidon-nima-graphql-server + io.helidon.webserver + helidon-webserver-graphql com.graphql-java diff --git a/microprofile/graphql/server/src/main/java/io/helidon/microprofile/graphql/server/GraphQlCdiExtension.java b/microprofile/graphql/server/src/main/java/io/helidon/microprofile/graphql/server/GraphQlCdiExtension.java index 11ec2ca2e26..4cc6c6e9994 100644 --- a/microprofile/graphql/server/src/main/java/io/helidon/microprofile/graphql/server/GraphQlCdiExtension.java +++ b/microprofile/graphql/server/src/main/java/io/helidon/microprofile/graphql/server/GraphQlCdiExtension.java @@ -24,7 +24,7 @@ import io.helidon.graphql.server.InvocationHandler; import io.helidon.microprofile.server.ServerCdiExtension; -import io.helidon.nima.graphql.server.GraphQlService; +import io.helidon.webserver.graphql.GraphQlService; import graphql.schema.GraphQLSchema; import jakarta.annotation.Priority; diff --git a/microprofile/graphql/server/src/main/java/module-info.java b/microprofile/graphql/server/src/main/java/module-info.java index ad82a249355..3abf5ee51fe 100644 --- a/microprofile/graphql/server/src/main/java/module-info.java +++ b/microprofile/graphql/server/src/main/java/module-info.java @@ -41,7 +41,7 @@ requires org.jboss.jandex; requires io.helidon.config; - requires io.helidon.nima.graphql.server; + requires io.helidon.webserver.graphql; requires io.helidon.graphql.server; requires io.helidon.microprofile.cdi; requires io.helidon.microprofile.server; diff --git a/microprofile/health/pom.xml b/microprofile/health/pom.xml index f96b2780dfd..db783071b93 100644 --- a/microprofile/health/pom.xml +++ b/microprofile/health/pom.xml @@ -45,8 +45,8 @@ microprofile-health-api - io.helidon.nima.observe - helidon-nima-observe-health + io.helidon.webserver.observe + helidon-webserver-observe-health io.helidon.health diff --git a/microprofile/health/src/main/java/io/helidon/microprofile/health/HealthCdiExtension.java b/microprofile/health/src/main/java/io/helidon/microprofile/health/HealthCdiExtension.java index 4e5e2b6f059..84b483795c2 100644 --- a/microprofile/health/src/main/java/io/helidon/microprofile/health/HealthCdiExtension.java +++ b/microprofile/health/src/main/java/io/helidon/microprofile/health/HealthCdiExtension.java @@ -28,8 +28,8 @@ import io.helidon.config.Config; import io.helidon.microprofile.server.ServerCdiExtension; import io.helidon.microprofile.servicecommon.HelidonRestCdiExtension; -import io.helidon.nima.observe.health.HealthFeature; -import io.helidon.nima.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.observe.health.HealthFeature; import jakarta.annotation.Priority; import jakarta.enterprise.context.ApplicationScoped; diff --git a/microprofile/health/src/main/java/module-info.java b/microprofile/health/src/main/java/module-info.java index 598084d5a80..3b364b30312 100644 --- a/microprofile/health/src/main/java/module-info.java +++ b/microprofile/health/src/main/java/module-info.java @@ -35,7 +35,7 @@ requires io.helidon.common; requires io.helidon.health; - requires io.helidon.nima.observe.health; + requires io.helidon.webserver.observe.health; requires io.helidon.microprofile.servicecommon; requires io.helidon.microprofile.server; diff --git a/microprofile/jwt-auth/src/main/java/io/helidon/microprofile/jwt/auth/JwtAuthProvider.java b/microprofile/jwt-auth/src/main/java/io/helidon/microprofile/jwt/auth/JwtAuthProvider.java index bf62babe4c4..810e637998f 100644 --- a/microprofile/jwt-auth/src/main/java/io/helidon/microprofile/jwt/auth/JwtAuthProvider.java +++ b/microprofile/jwt-auth/src/main/java/io/helidon/microprofile/jwt/auth/JwtAuthProvider.java @@ -53,9 +53,9 @@ import io.helidon.common.Errors; import io.helidon.common.LazyValue; import io.helidon.common.configurable.Resource; -import io.helidon.common.http.Http; import io.helidon.common.pki.Keys; import io.helidon.config.Config; +import io.helidon.http.Http; import io.helidon.security.AuthenticationResponse; import io.helidon.security.EndpointConfig; import io.helidon.security.Grant; @@ -119,13 +119,13 @@ public class JwtAuthProvider implements AuthenticationProvider, OutboundSecurity /** * Configuration of Cookie property name which contains JWT token. * - * This will be ignored unless {@link #CONFIG_JWT_HEADER} is set to {@link io.helidon.common.http.Http.HeaderNames#COOKIE}. + * This will be ignored unless {@link #CONFIG_JWT_HEADER} is set to {@link io.helidon.http.Http.HeaderNames#COOKIE}. */ private static final String CONFIG_COOKIE_PROPERTY_NAME = "mp.jwt.token.cookie"; /** * Configuration of the header where the JWT token is set. * - * Default value is {@link io.helidon.common.http.Http.HeaderNames#AUTHORIZATION}. + * Default value is {@link io.helidon.http.Http.HeaderNames#AUTHORIZATION}. */ private static final String CONFIG_JWT_HEADER = "mp.jwt.token.header"; private static final System.Logger LOGGER = System.getLogger(JwtAuthProvider.class.getName()); diff --git a/microprofile/lra/jax-rs/pom.xml b/microprofile/lra/jax-rs/pom.xml index f6d1542d45b..5b278c013ee 100644 --- a/microprofile/lra/jax-rs/pom.xml +++ b/microprofile/lra/jax-rs/pom.xml @@ -93,8 +93,8 @@ test - helidon-nima-webclient - io.helidon.nima.webclient + helidon-webclient + io.helidon.webclient test diff --git a/microprofile/lra/jax-rs/src/main/java/io/helidon/microprofile/lra/LraCdiExtension.java b/microprofile/lra/jax-rs/src/main/java/io/helidon/microprofile/lra/LraCdiExtension.java index 364d9f1cf4f..26f4e2d8ef8 100644 --- a/microprofile/lra/jax-rs/src/main/java/io/helidon/microprofile/lra/LraCdiExtension.java +++ b/microprofile/lra/jax-rs/src/main/java/io/helidon/microprofile/lra/LraCdiExtension.java @@ -35,7 +35,7 @@ import io.helidon.common.Reflected; import io.helidon.microprofile.server.ServerCdiExtension; -import io.helidon.nima.webserver.http.HttpService; +import io.helidon.webserver.http.HttpService; import jakarta.annotation.Priority; import jakarta.enterprise.context.ApplicationScoped; diff --git a/microprofile/lra/jax-rs/src/main/java/io/helidon/microprofile/lra/NonJaxRsResource.java b/microprofile/lra/jax-rs/src/main/java/io/helidon/microprofile/lra/NonJaxRsResource.java index 970a2337020..6f30e0c2cc3 100644 --- a/microprofile/lra/jax-rs/src/main/java/io/helidon/microprofile/lra/NonJaxRsResource.java +++ b/microprofile/lra/jax-rs/src/main/java/io/helidon/microprofile/lra/NonJaxRsResource.java @@ -22,17 +22,17 @@ import java.util.function.Supplier; import io.helidon.common.Reflected; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderName; -import io.helidon.common.http.Http.HeaderNames; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.ServerRequestHeaders; import io.helidon.common.parameters.Parameters; import io.helidon.config.Config; +import io.helidon.http.Http; +import io.helidon.http.Http.HeaderName; +import io.helidon.http.Http.HeaderNames; +import io.helidon.http.HttpPrologue; +import io.helidon.http.ServerRequestHeaders; import io.helidon.lra.coordinator.client.PropagatedHeaders; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import jakarta.inject.Inject; import jakarta.ws.rs.core.Response; diff --git a/microprofile/lra/jax-rs/src/test/java/io/helidon/microprofile/lra/CoordinatorClusterDeploymentService.java b/microprofile/lra/jax-rs/src/test/java/io/helidon/microprofile/lra/CoordinatorClusterDeploymentService.java index 774ef4c6296..5368de094aa 100644 --- a/microprofile/lra/jax-rs/src/test/java/io/helidon/microprofile/lra/CoordinatorClusterDeploymentService.java +++ b/microprofile/lra/jax-rs/src/test/java/io/helidon/microprofile/lra/CoordinatorClusterDeploymentService.java @@ -30,10 +30,10 @@ import io.helidon.microprofile.server.RoutingName; import io.helidon.microprofile.server.RoutingPath; import io.helidon.microprofile.server.ServerCdiExtension; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientRequest; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.http.HttpService; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientRequest; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.http.HttpService; import jakarta.annotation.Priority; import jakarta.enterprise.context.ApplicationScoped; diff --git a/microprofile/lra/jax-rs/src/test/java/io/helidon/microprofile/lra/CoordinatorHeaderPropagationTest.java b/microprofile/lra/jax-rs/src/test/java/io/helidon/microprofile/lra/CoordinatorHeaderPropagationTest.java index 94fdcdbd0e6..d90e6899a3d 100644 --- a/microprofile/lra/jax-rs/src/test/java/io/helidon/microprofile/lra/CoordinatorHeaderPropagationTest.java +++ b/microprofile/lra/jax-rs/src/test/java/io/helidon/microprofile/lra/CoordinatorHeaderPropagationTest.java @@ -30,7 +30,7 @@ import java.util.stream.Stream; import io.helidon.common.context.Contexts; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.lra.coordinator.client.CoordinatorClient; import io.helidon.lra.coordinator.client.PropagatedHeaders; import io.helidon.microprofile.config.ConfigCdiExtension; @@ -43,9 +43,9 @@ import io.helidon.microprofile.tests.junit5.AddExtension; import io.helidon.microprofile.tests.junit5.DisableDiscovery; import io.helidon.microprofile.tests.junit5.HelidonTest; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.http.HttpService; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.http.HttpService; import jakarta.annotation.Priority; import jakarta.enterprise.context.ApplicationScoped; diff --git a/microprofile/lra/jax-rs/src/test/java/io/helidon/microprofile/lra/LoadBalancedCoordinatorTest.java b/microprofile/lra/jax-rs/src/test/java/io/helidon/microprofile/lra/LoadBalancedCoordinatorTest.java index d2364c9285f..3b461f67b4f 100644 --- a/microprofile/lra/jax-rs/src/test/java/io/helidon/microprofile/lra/LoadBalancedCoordinatorTest.java +++ b/microprofile/lra/jax-rs/src/test/java/io/helidon/microprofile/lra/LoadBalancedCoordinatorTest.java @@ -54,8 +54,8 @@ import io.helidon.microprofile.tests.junit5.DisableDiscovery; import io.helidon.microprofile.tests.junit5.HelidonTest; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; import jakarta.enterprise.inject.spi.BeanManager; import jakarta.inject.Inject; import jakarta.ws.rs.NotFoundException; diff --git a/microprofile/lra/jax-rs/src/test/java/io/helidon/microprofile/lra/ParticipantTest.java b/microprofile/lra/jax-rs/src/test/java/io/helidon/microprofile/lra/ParticipantTest.java index 10d78e48364..cb167d6f6c7 100644 --- a/microprofile/lra/jax-rs/src/test/java/io/helidon/microprofile/lra/ParticipantTest.java +++ b/microprofile/lra/jax-rs/src/test/java/io/helidon/microprofile/lra/ParticipantTest.java @@ -24,7 +24,7 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.TimeUnit; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.lra.coordinator.client.CoordinatorClient; import io.helidon.microprofile.config.ConfigCdiExtension; import io.helidon.microprofile.lra.resources.DontEnd; @@ -37,7 +37,7 @@ import io.helidon.microprofile.tests.junit5.AddExtension; import io.helidon.microprofile.tests.junit5.DisableDiscovery; import io.helidon.microprofile.tests.junit5.HelidonTest; -import io.helidon.nima.webserver.http.HttpService; +import io.helidon.webserver.http.HttpService; import jakarta.annotation.Priority; import jakarta.enterprise.context.ApplicationScoped; diff --git a/microprofile/metrics/pom.xml b/microprofile/metrics/pom.xml index 908e58b9e27..f28be879019 100644 --- a/microprofile/metrics/pom.xml +++ b/microprofile/metrics/pom.xml @@ -57,8 +57,8 @@ helidon-microprofile-config - io.helidon.nima.observe - helidon-nima-observe-metrics + io.helidon.webserver.observe + helidon-webserver-observe-metrics diff --git a/microprofile/metrics/src/main/java/io/helidon/microprofile/metrics/InterceptorSyntheticRestRequest.java b/microprofile/metrics/src/main/java/io/helidon/microprofile/metrics/InterceptorSyntheticRestRequest.java index 0824cf31a7a..b253011f4d3 100644 --- a/microprofile/metrics/src/main/java/io/helidon/microprofile/metrics/InterceptorSyntheticRestRequest.java +++ b/microprofile/metrics/src/main/java/io/helidon/microprofile/metrics/InterceptorSyntheticRestRequest.java @@ -21,9 +21,9 @@ import java.time.Duration; import io.helidon.microprofile.servicecommon.HelidonInterceptor; -import io.helidon.nima.observe.metrics.PostRequestMetricsSupport; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; +import io.helidon.webserver.observe.metrics.PostRequestMetricsSupport; import jakarta.annotation.Priority; import jakarta.inject.Inject; diff --git a/microprofile/metrics/src/main/java/io/helidon/microprofile/metrics/MetricsCdiExtension.java b/microprofile/metrics/src/main/java/io/helidon/microprofile/metrics/MetricsCdiExtension.java index 9bf40651cf2..d2a43dfd7be 100644 --- a/microprofile/metrics/src/main/java/io/helidon/microprofile/metrics/MetricsCdiExtension.java +++ b/microprofile/metrics/src/main/java/io/helidon/microprofile/metrics/MetricsCdiExtension.java @@ -51,8 +51,8 @@ import io.helidon.microprofile.metrics.spi.MetricRegistrationObserver; import io.helidon.microprofile.server.ServerCdiExtension; import io.helidon.microprofile.servicecommon.HelidonRestCdiExtension; -import io.helidon.nima.observe.metrics.MetricsFeature; -import io.helidon.nima.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.observe.metrics.MetricsFeature; import jakarta.annotation.Priority; import jakarta.enterprise.context.ApplicationScoped; diff --git a/microprofile/metrics/src/main/java/module-info.java b/microprofile/metrics/src/main/java/module-info.java index a3647617035..164ab4411c1 100644 --- a/microprofile/metrics/src/main/java/module-info.java +++ b/microprofile/metrics/src/main/java/module-info.java @@ -41,12 +41,12 @@ requires transitive io.helidon.metrics.api; - requires io.helidon.nima.observe.metrics; + requires io.helidon.webserver.observe.metrics; requires transitive microprofile.config.api; requires microprofile.metrics.api; requires io.helidon.config.mp; - + requires micrometer.registry.prometheus; requires simpleclient.common; diff --git a/microprofile/metrics/src/test/java/io/helidon/microprofile/metrics/HelloWorldAsyncResponseTest.java b/microprofile/metrics/src/test/java/io/helidon/microprofile/metrics/HelloWorldAsyncResponseTest.java index 3ac964a6bca..1be6587b442 100644 --- a/microprofile/metrics/src/test/java/io/helidon/microprofile/metrics/HelloWorldAsyncResponseTest.java +++ b/microprofile/metrics/src/test/java/io/helidon/microprofile/metrics/HelloWorldAsyncResponseTest.java @@ -23,7 +23,7 @@ import io.helidon.microprofile.tests.junit5.AddConfig; import io.helidon.microprofile.tests.junit5.HelidonTest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.ServerResponse; import jakarta.inject.Inject; import jakarta.ws.rs.client.WebTarget; @@ -32,7 +32,6 @@ import org.eclipse.microprofile.metrics.MetricID; import org.eclipse.microprofile.metrics.MetricRegistry; import org.eclipse.microprofile.metrics.Timer; -import org.eclipse.microprofile.metrics.annotation.RegistryScope; import org.eclipse.microprofile.metrics.annotation.RegistryType; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; diff --git a/microprofile/metrics/src/test/java/io/helidon/microprofile/metrics/HelloWorldResource.java b/microprofile/metrics/src/test/java/io/helidon/microprofile/metrics/HelloWorldResource.java index 11a373b08f8..00ff75cfebe 100644 --- a/microprofile/metrics/src/test/java/io/helidon/microprofile/metrics/HelloWorldResource.java +++ b/microprofile/metrics/src/test/java/io/helidon/microprofile/metrics/HelloWorldResource.java @@ -23,7 +23,7 @@ import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.ServerResponse; import jakarta.enterprise.context.RequestScoped; import jakarta.inject.Inject; @@ -40,7 +40,6 @@ import org.eclipse.microprofile.metrics.Gauge; import org.eclipse.microprofile.metrics.MetricRegistry; import org.eclipse.microprofile.metrics.annotation.Counted; -import org.eclipse.microprofile.metrics.annotation.RegistryScope; import org.eclipse.microprofile.metrics.annotation.RegistryType; import org.eclipse.microprofile.metrics.annotation.Timed; diff --git a/microprofile/metrics/src/test/java/io/helidon/microprofile/metrics/TestBasicPerformanceIndicators.java b/microprofile/metrics/src/test/java/io/helidon/microprofile/metrics/TestBasicPerformanceIndicators.java index 388f511d374..0d5f6d178e1 100644 --- a/microprofile/metrics/src/test/java/io/helidon/microprofile/metrics/TestBasicPerformanceIndicators.java +++ b/microprofile/metrics/src/test/java/io/helidon/microprofile/metrics/TestBasicPerformanceIndicators.java @@ -15,7 +15,7 @@ */ package io.helidon.microprofile.metrics; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.microprofile.tests.junit5.HelidonTest; import jakarta.inject.Inject; diff --git a/microprofile/metrics/src/test/java/io/helidon/microprofile/metrics/TestMetricsOnOwnSocket.java b/microprofile/metrics/src/test/java/io/helidon/microprofile/metrics/TestMetricsOnOwnSocket.java index a0d65c2b466..edbb9546cf9 100644 --- a/microprofile/metrics/src/test/java/io/helidon/microprofile/metrics/TestMetricsOnOwnSocket.java +++ b/microprofile/metrics/src/test/java/io/helidon/microprofile/metrics/TestMetricsOnOwnSocket.java @@ -15,7 +15,7 @@ */ package io.helidon.microprofile.metrics; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.microprofile.server.ServerCdiExtension; import io.helidon.microprofile.tests.junit5.AddConfig; import io.helidon.microprofile.tests.junit5.HelidonTest; diff --git a/microprofile/metrics/src/test/resources/logging.properties b/microprofile/metrics/src/test/resources/logging.properties index 720ab4c2194..0f69ee2f8ca 100644 --- a/microprofile/metrics/src/test/resources/logging.properties +++ b/microprofile/metrics/src/test/resources/logging.properties @@ -27,7 +27,7 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ .level=INFO # Component specific log levels -#io.helidon.nima.webserver.level=INFO +#io.helidon.webserver.level=INFO #io.helidon.config.level=INFO #io.helidon.security.level=INFO #io.helidon.common.level=INFO diff --git a/microprofile/openapi/pom.xml b/microprofile/openapi/pom.xml index a039c092598..c73b242db41 100644 --- a/microprofile/openapi/pom.xml +++ b/microprofile/openapi/pom.xml @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. --> - 4.0.0 @@ -25,7 +25,7 @@ io.helidon.microprofile.openapi helidon-microprofile-openapi - + Helidon Microprofile OpenAPI @@ -33,7 +33,7 @@ jar - + etc/spotbugs/exclude.xml ${project.build.directory}/extracted-sources/openapi-interfaces @@ -54,8 +54,8 @@ helidon-microprofile-server - io.helidon.nima.service-common - helidon-nima-service-common + io.helidon.webserver + helidon-webserver-service-common io.helidon.microprofile.service-common @@ -267,5 +267,5 @@ - + diff --git a/microprofile/openapi/src/test/java/io/helidon/microprofile/openapi/BasicServerTest.java b/microprofile/openapi/src/test/java/io/helidon/microprofile/openapi/BasicServerTest.java index b70d186837b..85fee1eccd3 100644 --- a/microprofile/openapi/src/test/java/io/helidon/microprofile/openapi/BasicServerTest.java +++ b/microprofile/openapi/src/test/java/io/helidon/microprofile/openapi/BasicServerTest.java @@ -17,7 +17,7 @@ import java.util.Map; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.microprofile.tests.junit5.AddBean; import io.helidon.microprofile.tests.junit5.HelidonTest; import io.helidon.openapi.OpenApiFeature; diff --git a/microprofile/openapi/src/test/java/io/helidon/microprofile/openapi/TestServerWithConfig.java b/microprofile/openapi/src/test/java/io/helidon/microprofile/openapi/TestServerWithConfig.java index de0e3fa5302..be666aa1e16 100644 --- a/microprofile/openapi/src/test/java/io/helidon/microprofile/openapi/TestServerWithConfig.java +++ b/microprofile/openapi/src/test/java/io/helidon/microprofile/openapi/TestServerWithConfig.java @@ -18,7 +18,7 @@ import java.net.HttpURLConnection; import java.util.Map; -import io.helidon.common.http.HttpMediaType; +import io.helidon.http.HttpMediaType; import io.helidon.common.media.type.MediaTypes; import io.helidon.config.ClasspathConfigSource; import io.helidon.config.Config; diff --git a/microprofile/openapi/src/test/java/io/helidon/microprofile/openapi/TestUtil.java b/microprofile/openapi/src/test/java/io/helidon/microprofile/openapi/TestUtil.java index 514f03566ae..103dd4889e4 100644 --- a/microprofile/openapi/src/test/java/io/helidon/microprofile/openapi/TestUtil.java +++ b/microprofile/openapi/src/test/java/io/helidon/microprofile/openapi/TestUtil.java @@ -24,7 +24,7 @@ import java.nio.charset.Charset; import java.util.Map; -import io.helidon.common.http.HttpMediaType; +import io.helidon.http.HttpMediaType; import io.helidon.common.media.type.MediaTypes; import io.helidon.config.Config; import io.helidon.microprofile.server.Server; diff --git a/microprofile/security/pom.xml b/microprofile/security/pom.xml index 85b6a56b24f..4fbeed04ebc 100644 --- a/microprofile/security/pom.xml +++ b/microprofile/security/pom.xml @@ -52,8 +52,8 @@ helidon-bundles-security - io.helidon.security.integration - helidon-security-integration-nima + io.helidon.webserver + helidon-webserver-security io.helidon.jersey diff --git a/microprofile/security/src/main/java/io/helidon/microprofile/security/SecurityCdiExtension.java b/microprofile/security/src/main/java/io/helidon/microprofile/security/SecurityCdiExtension.java index 0e74fa697ea..5dbda4b11e1 100644 --- a/microprofile/security/src/main/java/io/helidon/microprofile/security/SecurityCdiExtension.java +++ b/microprofile/security/src/main/java/io/helidon/microprofile/security/SecurityCdiExtension.java @@ -27,10 +27,10 @@ import io.helidon.security.AuthenticationResponse; import io.helidon.security.ProviderRequest; import io.helidon.security.Security; -import io.helidon.security.integration.nima.SecurityFeature; import io.helidon.security.providers.abac.AbacProvider; import io.helidon.security.spi.AuthenticationProvider; import io.helidon.security.spi.AuthorizationProvider; +import io.helidon.webserver.security.SecurityFeature; import jakarta.annotation.Priority; import jakarta.enterprise.context.ApplicationScoped; diff --git a/microprofile/security/src/main/java/module-info.java b/microprofile/security/src/main/java/module-info.java index 9fe002ecd3a..8c70f3f083c 100644 --- a/microprofile/security/src/main/java/module-info.java +++ b/microprofile/security/src/main/java/module-info.java @@ -29,7 +29,7 @@ requires static io.helidon.common.features.api; requires transitive io.helidon.security; - requires transitive io.helidon.security.integration.nima; + requires transitive io.helidon.webserver.security; requires io.helidon.security.providers.abac; requires io.helidon.microprofile.server; requires io.helidon.microprofile.cdi; diff --git a/microprofile/server/pom.xml b/microprofile/server/pom.xml index afdcfc5d1d1..b656a948a31 100644 --- a/microprofile/server/pom.xml +++ b/microprofile/server/pom.xml @@ -47,12 +47,12 @@ helidon-microprofile-cdi - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.nima.webserver - helidon-nima-webserver-static-content + io.helidon.webserver + helidon-webserver-static-content jakarta.interceptor @@ -81,13 +81,13 @@ - io.helidon.nima.http.media - helidon-nima-http-media-jsonp + io.helidon.http.media + helidon-http-media-jsonp runtime - io.helidon.nima.webserver - helidon-nima-webserver-context + io.helidon.webserver + helidon-webserver-context io.helidon.config diff --git a/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsCdiExtension.java b/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsCdiExtension.java index 92085b6d37b..ee510ebd346 100644 --- a/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsCdiExtension.java +++ b/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsCdiExtension.java @@ -26,7 +26,7 @@ import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; -import io.helidon.nima.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerRequest; import jakarta.annotation.Priority; import jakarta.enterprise.context.ApplicationScoped; diff --git a/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsService.java b/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsService.java index d354433df4f..736fb8b6450 100644 --- a/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsService.java +++ b/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsService.java @@ -34,17 +34,17 @@ import io.helidon.common.context.Context; import io.helidon.common.context.Contexts; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.Header; -import io.helidon.common.http.Http.HeaderNames; -import io.helidon.common.http.InternalServerException; import io.helidon.common.uri.UriPath; +import io.helidon.http.Http; +import io.helidon.http.Http.Header; +import io.helidon.http.Http.HeaderNames; +import io.helidon.http.InternalServerException; import io.helidon.microprofile.server.HelidonHK2InjectionManagerFactory.InjectionManagerWrapper; -import io.helidon.nima.webserver.KeyPerformanceIndicatorSupport; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.KeyPerformanceIndicatorSupport; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import jakarta.ws.rs.NotFoundException; import jakarta.ws.rs.core.Application; @@ -250,7 +250,7 @@ private void doHandle(Context ctx, ServerRequest req, ServerResponse res) { writer.await(); } catch (UncheckedIOException e) { throw e; - } catch (io.helidon.common.http.NotFoundException | NotFoundException e) { + } catch (io.helidon.http.NotFoundException | NotFoundException e) { // continue execution, maybe there is a non-JAX-RS route (such as static content) res.next(); } catch (Exception e) { diff --git a/microprofile/server/src/main/java/io/helidon/microprofile/server/RoutingBuilders.java b/microprofile/server/src/main/java/io/helidon/microprofile/server/RoutingBuilders.java index 92d9bb1db28..6ba15c4723a 100644 --- a/microprofile/server/src/main/java/io/helidon/microprofile/server/RoutingBuilders.java +++ b/microprofile/server/src/main/java/io/helidon/microprofile/server/RoutingBuilders.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022 Oracle and/or its affiliates. + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ package io.helidon.microprofile.server; import io.helidon.config.Config; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.webserver.http.HttpRouting; import jakarta.enterprise.inject.spi.CDI; import org.eclipse.microprofile.config.ConfigProvider; diff --git a/microprofile/server/src/main/java/io/helidon/microprofile/server/RoutingBuildersImpl.java b/microprofile/server/src/main/java/io/helidon/microprofile/server/RoutingBuildersImpl.java index a7d8a723352..f5ffd49d39d 100644 --- a/microprofile/server/src/main/java/io/helidon/microprofile/server/RoutingBuildersImpl.java +++ b/microprofile/server/src/main/java/io/helidon/microprofile/server/RoutingBuildersImpl.java @@ -15,7 +15,7 @@ */ package io.helidon.microprofile.server; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.webserver.http.HttpRouting; /** * Package-private implementation of the {@code RoutingBuilders} interface. diff --git a/microprofile/server/src/main/java/io/helidon/microprofile/server/RoutingName.java b/microprofile/server/src/main/java/io/helidon/microprofile/server/RoutingName.java index a5663603056..97d23c7a274 100644 --- a/microprofile/server/src/main/java/io/helidon/microprofile/server/RoutingName.java +++ b/microprofile/server/src/main/java/io/helidon/microprofile/server/RoutingName.java @@ -25,8 +25,8 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; /** - * Binds an {@link jakarta.ws.rs.core.Application} or {@link io.helidon.nima.webserver.http.HttpService} to a specific (named) - * routing on {@link io.helidon.nima.webserver.WebServer}. The routing should have a corresponding named socket configured on the + * Binds an {@link jakarta.ws.rs.core.Application} or {@link io.helidon.webserver.http.HttpService} to a specific (named) + * routing on {@link io.helidon.webserver.WebServer}. The routing should have a corresponding named socket configured on the * WebServer to run the routing on. * * Configuration can be overridden using configuration: diff --git a/microprofile/server/src/main/java/io/helidon/microprofile/server/RoutingPath.java b/microprofile/server/src/main/java/io/helidon/microprofile/server/RoutingPath.java index 6b1759b4b17..3f9db4d5252 100644 --- a/microprofile/server/src/main/java/io/helidon/microprofile/server/RoutingPath.java +++ b/microprofile/server/src/main/java/io/helidon/microprofile/server/RoutingPath.java @@ -25,9 +25,9 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; /** - * Path of a {@link io.helidon.nima.webserver.http.HttpService} to register with routing. + * Path of a {@link io.helidon.webserver.http.HttpService} to register with routing. * If a service is not annotated with this annotation, it would be registered without a path using - * {@link io.helidon.nima.webserver.http.HttpRules#register(java.util.function.Supplier[])}. + * {@link io.helidon.webserver.http.HttpRules#register(java.util.function.Supplier[])}. * * Configuration can be overridden using configuration: *
    @@ -68,7 +68,7 @@ String CONFIG_KEY_PATH = "routing-path.path"; /** - * Path of this WebServer service. Use the same path as would be used with {@link io.helidon.nima.webserver.http.HttpRules}. + * Path of this WebServer service. Use the same path as would be used with {@link io.helidon.webserver.http.HttpRules}. * * @return path to register the service on. */ diff --git a/microprofile/server/src/main/java/io/helidon/microprofile/server/ServerCdiExtension.java b/microprofile/server/src/main/java/io/helidon/microprofile/server/ServerCdiExtension.java index 0bb96507483..eff1d827033 100644 --- a/microprofile/server/src/main/java/io/helidon/microprofile/server/ServerCdiExtension.java +++ b/microprofile/server/src/main/java/io/helidon/microprofile/server/ServerCdiExtension.java @@ -35,22 +35,22 @@ import io.helidon.common.context.Context; import io.helidon.common.context.Contexts; -import io.helidon.common.http.Http; import io.helidon.config.Config; import io.helidon.config.mp.Prioritized; +import io.helidon.http.Http; import io.helidon.microprofile.cdi.RuntimeStart; -import io.helidon.nima.webserver.KeyPerformanceIndicatorSupport; -import io.helidon.nima.webserver.ListenerConfig; -import io.helidon.nima.webserver.Router; -import io.helidon.nima.webserver.Routing; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.context.ContextFeature; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; -import io.helidon.nima.webserver.staticcontent.StaticContentService; +import io.helidon.webserver.KeyPerformanceIndicatorSupport; +import io.helidon.webserver.ListenerConfig; +import io.helidon.webserver.Router; +import io.helidon.webserver.Routing; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.context.ContextFeature; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; +import io.helidon.webserver.staticcontent.StaticContentService; import jakarta.annotation.Priority; import jakarta.enterprise.context.ApplicationScoped; @@ -421,7 +421,7 @@ private void startServer(@Observes @Priority(PLATFORM_AFTER + 100) @Initialized( } /** - * Make Nima's {@code ServerRequest} and {@code ServerResponse} available for injection + * Make WebServer's {@code ServerRequest} and {@code ServerResponse} available for injection * via CDI by registering them as beans. * * @param event after bean discovery event diff --git a/microprofile/server/src/main/java/io/helidon/microprofile/server/WebServerBinder.java b/microprofile/server/src/main/java/io/helidon/microprofile/server/WebServerBinder.java index 8f077082854..efab7d6db4f 100644 --- a/microprofile/server/src/main/java/io/helidon/microprofile/server/WebServerBinder.java +++ b/microprofile/server/src/main/java/io/helidon/microprofile/server/WebServerBinder.java @@ -16,8 +16,8 @@ package io.helidon.microprofile.server; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import jakarta.inject.Inject; import jakarta.inject.Provider; diff --git a/microprofile/server/src/main/java/module-info.java b/microprofile/server/src/main/java/module-info.java index c60859dddb5..bd06f74d075 100644 --- a/microprofile/server/src/main/java/module-info.java +++ b/microprofile/server/src/main/java/module-info.java @@ -30,7 +30,7 @@ module io.helidon.microprofile.server { requires static io.helidon.common.features.api; - requires transitive io.helidon.nima.webserver; + requires transitive io.helidon.webserver; requires transitive io.helidon.common.context; requires transitive io.helidon.jersey.server; requires transitive io.helidon.common.configurable; @@ -44,8 +44,8 @@ requires transitive jakarta.json; requires io.helidon.jersey.media.jsonp; - requires io.helidon.nima.webserver.staticcontent; - requires transitive io.helidon.nima.webserver.context; + requires io.helidon.webserver.staticcontent; + requires transitive io.helidon.webserver.context; // there is now a hardcoded dependency on Weld, to configure additional bean defining annotation requires java.management; diff --git a/microprofile/server/src/test/java/io/helidon/microprofile/server/ProducedRouteTest.java b/microprofile/server/src/test/java/io/helidon/microprofile/server/ProducedRouteTest.java index d0f559172b0..d0e29496b70 100644 --- a/microprofile/server/src/test/java/io/helidon/microprofile/server/ProducedRouteTest.java +++ b/microprofile/server/src/test/java/io/helidon/microprofile/server/ProducedRouteTest.java @@ -20,14 +20,14 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderName; +import io.helidon.http.Http; +import io.helidon.http.Http.HeaderName; import io.helidon.microprofile.tests.junit5.AddBean; import io.helidon.microprofile.tests.junit5.AddConfig; import io.helidon.microprofile.tests.junit5.AddExtension; import io.helidon.microprofile.tests.junit5.DisableDiscovery; import io.helidon.microprofile.tests.junit5.HelidonTest; -import io.helidon.nima.webserver.http.HttpService; +import io.helidon.webserver.http.HttpService; import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.inject.Produces; diff --git a/microprofile/service-common/pom.xml b/microprofile/service-common/pom.xml index 891bec778d6..048e3aff106 100644 --- a/microprofile/service-common/pom.xml +++ b/microprofile/service-common/pom.xml @@ -34,8 +34,8 @@ - io.helidon.nima.service-common - helidon-nima-service-common + io.helidon.webserver + helidon-webserver-service-common org.eclipse.microprofile.config @@ -61,8 +61,8 @@ test - io.helidon.nima.webclient - helidon-nima-webclient + io.helidon.webclient + helidon-webclient test diff --git a/microprofile/service-common/src/main/java/io/helidon/microprofile/servicecommon/HelidonRestCdiExtension.java b/microprofile/service-common/src/main/java/io/helidon/microprofile/servicecommon/HelidonRestCdiExtension.java index 30ea6031179..58e252abb0b 100644 --- a/microprofile/service-common/src/main/java/io/helidon/microprofile/servicecommon/HelidonRestCdiExtension.java +++ b/microprofile/service-common/src/main/java/io/helidon/microprofile/servicecommon/HelidonRestCdiExtension.java @@ -32,8 +32,8 @@ import io.helidon.config.mp.MpConfig; import io.helidon.microprofile.server.RoutingBuilders; import io.helidon.microprofile.server.ServerCdiExtension; -import io.helidon.nima.servicecommon.FeatureSupport; -import io.helidon.nima.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.servicecommon.FeatureSupport; import jakarta.annotation.Priority; import jakarta.enterprise.context.ApplicationScoped; @@ -63,7 +63,7 @@ *

    *

    * Each CDI extension is presumed to layer on an SE-style service support class which itself is a subclass of - * {@link io.helidon.nima.servicecommon.HelidonFeatureSupport} with an associated {@code Builder} class. + * {@link io.helidon.webserver.servicecommon.HelidonFeatureSupport} with an associated {@code Builder} class. * The service support base class and its builder are both type parameters to this class. *

    *

    diff --git a/microprofile/service-common/src/main/java/module-info.java b/microprofile/service-common/src/main/java/module-info.java index 0cd39139468..e41c16dcb60 100644 --- a/microprofile/service-common/src/main/java/module-info.java +++ b/microprofile/service-common/src/main/java/module-info.java @@ -22,7 +22,7 @@ module io.helidon.microprofile.servicecommon { requires jakarta.cdi; - requires io.helidon.nima.servicecommon; + requires io.helidon.servicecommon; requires microprofile.config.api; requires jakarta.inject; requires io.helidon.config.mp; diff --git a/microprofile/service-common/src/test/java/io/helidon/microprofile/servicecommon/ConfiguredTestSupport.java b/microprofile/service-common/src/test/java/io/helidon/microprofile/servicecommon/ConfiguredTestSupport.java index 736b811b142..b6c81211657 100644 --- a/microprofile/service-common/src/test/java/io/helidon/microprofile/servicecommon/ConfiguredTestSupport.java +++ b/microprofile/service-common/src/test/java/io/helidon/microprofile/servicecommon/ConfiguredTestSupport.java @@ -17,8 +17,8 @@ import java.util.Optional; -import io.helidon.nima.servicecommon.HelidonFeatureSupport; -import io.helidon.nima.webserver.http.HttpService; +import io.helidon.webserver.servicecommon.HelidonFeatureSupport; +import io.helidon.webserver.http.HttpService; /** * Test SE service which does not really expose its own endpoint but does use config to set an "importance" value. diff --git a/microprofile/tests/tck/tck-lra/src/test/resources/logging-test.properties b/microprofile/tests/tck/tck-lra/src/test/resources/logging-test.properties index 5c7a9241cfc..8ad260481ec 100644 --- a/microprofile/tests/tck/tck-lra/src/test/resources/logging-test.properties +++ b/microprofile/tests/tck/tck-lra/src/test/resources/logging-test.properties @@ -19,7 +19,7 @@ java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter java.util.logging.SimpleFormatter.format=%1$tH:%1$tM:%1$tS %4$s %3$s %5$s%6$s%n # Global logging level. Can be overridden by specific loggers .level=INFO -io.helidon.nima.level=INFO -io.helidon.nima.webserver.http.Http1Connection.level=INFO -io.helidon.nima.webserver.http.HttpRouting.level=INFO +io.helidon.webserver.level=INFO +io.helidon.webserver.http.Http1Connection.level=INFO +io.helidon.webserver.http.HttpRouting.level=INFO io.helidon.lra.coordinator.level=INFO diff --git a/microprofile/tracing/pom.xml b/microprofile/tracing/pom.xml index 135dc116950..ae1c2108200 100644 --- a/microprofile/tracing/pom.xml +++ b/microprofile/tracing/pom.xml @@ -41,8 +41,8 @@ provided - io.helidon.nima.webserver - helidon-nima-webserver-tracing + io.helidon.webserver + helidon-webserver-tracing io.helidon.tracing.providers diff --git a/microprofile/tracing/src/main/java/io/helidon/microprofile/tracing/MpTracingContextFilter.java b/microprofile/tracing/src/main/java/io/helidon/microprofile/tracing/MpTracingContextFilter.java index 1b72795703b..962e28b693e 100644 --- a/microprofile/tracing/src/main/java/io/helidon/microprofile/tracing/MpTracingContextFilter.java +++ b/microprofile/tracing/src/main/java/io/helidon/microprofile/tracing/MpTracingContextFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022 Oracle and/or its affiliates. + * Copyright (c) 2018, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,11 +18,11 @@ import java.util.Optional; import io.helidon.common.context.Contexts; -import io.helidon.nima.webserver.http.ServerRequest; import io.helidon.tracing.Span; import io.helidon.tracing.SpanContext; import io.helidon.tracing.Tracer; import io.helidon.tracing.jersey.client.internal.TracingContext; +import io.helidon.webserver.http.ServerRequest; import jakarta.annotation.Priority; import jakarta.enterprise.context.ApplicationScoped; diff --git a/microprofile/tracing/src/main/java/io/helidon/microprofile/tracing/TracingCdiExtension.java b/microprofile/tracing/src/main/java/io/helidon/microprofile/tracing/TracingCdiExtension.java index 9b20145ae36..09270e5913e 100644 --- a/microprofile/tracing/src/main/java/io/helidon/microprofile/tracing/TracingCdiExtension.java +++ b/microprofile/tracing/src/main/java/io/helidon/microprofile/tracing/TracingCdiExtension.java @@ -25,9 +25,9 @@ import io.helidon.microprofile.server.JaxRsApplication; import io.helidon.microprofile.server.JaxRsCdiExtension; import io.helidon.microprofile.server.ServerCdiExtension; -import io.helidon.nima.webserver.tracing.TracingFeature; import io.helidon.tracing.TracerBuilder; import io.helidon.tracing.config.TracingConfig; +import io.helidon.webserver.tracing.TracingFeature; import io.opentelemetry.opentracingshim.OpenTracingShim; import io.opentracing.Tracer; diff --git a/microprofile/tracing/src/main/java/module-info.java b/microprofile/tracing/src/main/java/module-info.java index 6976ed024eb..be0d2eae1a7 100644 --- a/microprofile/tracing/src/main/java/module-info.java +++ b/microprofile/tracing/src/main/java/module-info.java @@ -43,9 +43,9 @@ requires io.helidon.microprofile.server; requires transitive io.helidon.microprofile.config; requires io.helidon.common; - requires io.helidon.nima.webserver; + requires io.helidon.webserver; requires io.helidon.jersey.common; - requires io.helidon.nima.webserver.tracing; + requires io.helidon.webserver.tracing; requires transitive io.helidon.tracing; requires io.helidon.tracing.config; requires transitive io.helidon.tracing.jersey; diff --git a/microprofile/tracing/src/test/resources/logging-test.properties b/microprofile/tracing/src/test/resources/logging-test.properties index d9ec6c998d1..1118023f557 100644 --- a/microprofile/tracing/src/test/resources/logging-test.properties +++ b/microprofile/tracing/src/test/resources/logging-test.properties @@ -20,5 +20,5 @@ handlers=io.helidon.logging.jul.HelidonConsoleHandler java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$s %3$s !thread!: %5$s%6$s%n .level=INFO -#io.helidon.nima.webserver.level=FINE +#io.helidon.webserver.level=FINE #org.glassfish.jersey.internal.Errors.level=SEVERE diff --git a/microprofile/websocket/pom.xml b/microprofile/websocket/pom.xml index 88737252cbc..108a2a7adb3 100644 --- a/microprofile/websocket/pom.xml +++ b/microprofile/websocket/pom.xml @@ -45,12 +45,12 @@ helidon-microprofile-server - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.nima.websocket - helidon-nima-websocket-webserver + io.helidon.webserver + helidon-webserver-websocket org.glassfish.tyrus diff --git a/microprofile/websocket/src/main/java/io/helidon/microprofile/tyrus/TyrusCdiExtension.java b/microprofile/websocket/src/main/java/io/helidon/microprofile/tyrus/TyrusCdiExtension.java index e2c0e87b8fe..041b133dff3 100644 --- a/microprofile/websocket/src/main/java/io/helidon/microprofile/tyrus/TyrusCdiExtension.java +++ b/microprofile/websocket/src/main/java/io/helidon/microprofile/tyrus/TyrusCdiExtension.java @@ -25,7 +25,7 @@ import io.helidon.microprofile.server.RoutingName; import io.helidon.microprofile.server.RoutingPath; import io.helidon.microprofile.server.ServerCdiExtension; -import io.helidon.nima.webserver.WebServer; +import io.helidon.webserver.WebServer; import jakarta.annotation.Priority; import jakarta.enterprise.context.ApplicationScoped; diff --git a/microprofile/websocket/src/main/java/io/helidon/microprofile/tyrus/TyrusConnection.java b/microprofile/websocket/src/main/java/io/helidon/microprofile/tyrus/TyrusConnection.java index 8b5073b0846..f754ca29b4a 100644 --- a/microprofile/websocket/src/main/java/io/helidon/microprofile/tyrus/TyrusConnection.java +++ b/microprofile/websocket/src/main/java/io/helidon/microprofile/tyrus/TyrusConnection.java @@ -25,12 +25,12 @@ import io.helidon.common.buffers.BufferData; import io.helidon.common.buffers.DataReader; -import io.helidon.common.http.Http; -import io.helidon.nima.webserver.ConnectionContext; -import io.helidon.nima.webserver.spi.ServerConnection; -import io.helidon.nima.websocket.WsCloseCodes; -import io.helidon.nima.websocket.WsListener; -import io.helidon.nima.websocket.WsSession; +import io.helidon.http.Http; +import io.helidon.webserver.ConnectionContext; +import io.helidon.webserver.spi.ServerConnection; +import io.helidon.websocket.WsCloseCodes; +import io.helidon.websocket.WsListener; +import io.helidon.websocket.WsSession; import jakarta.websocket.CloseReason; import org.glassfish.tyrus.spi.CompletionHandler; diff --git a/microprofile/websocket/src/main/java/io/helidon/microprofile/tyrus/TyrusRoute.java b/microprofile/websocket/src/main/java/io/helidon/microprofile/tyrus/TyrusRoute.java index 40714c74495..8b8c05dcccf 100644 --- a/microprofile/websocket/src/main/java/io/helidon/microprofile/tyrus/TyrusRoute.java +++ b/microprofile/websocket/src/main/java/io/helidon/microprofile/tyrus/TyrusRoute.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,9 +16,9 @@ package io.helidon.microprofile.tyrus; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.PathMatcher; -import io.helidon.common.http.PathMatchers; +import io.helidon.http.HttpPrologue; +import io.helidon.http.PathMatcher; +import io.helidon.http.PathMatchers; import jakarta.websocket.server.ServerEndpointConfig; diff --git a/microprofile/websocket/src/main/java/io/helidon/microprofile/tyrus/TyrusRouting.java b/microprofile/websocket/src/main/java/io/helidon/microprofile/tyrus/TyrusRouting.java index 69ae4892255..de47d903881 100644 --- a/microprofile/websocket/src/main/java/io/helidon/microprofile/tyrus/TyrusRouting.java +++ b/microprofile/websocket/src/main/java/io/helidon/microprofile/tyrus/TyrusRouting.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,9 +20,9 @@ import java.util.List; import java.util.Set; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.PathMatchers; -import io.helidon.nima.webserver.Routing; +import io.helidon.http.HttpPrologue; +import io.helidon.http.PathMatchers; +import io.helidon.webserver.Routing; import jakarta.websocket.Extension; import jakarta.websocket.server.ServerEndpoint; diff --git a/microprofile/websocket/src/main/java/io/helidon/microprofile/tyrus/TyrusUpgradeProvider.java b/microprofile/websocket/src/main/java/io/helidon/microprofile/tyrus/TyrusUpgradeProvider.java index 464633829bc..3fce8e1bd0b 100644 --- a/microprofile/websocket/src/main/java/io/helidon/microprofile/tyrus/TyrusUpgradeProvider.java +++ b/microprofile/websocket/src/main/java/io/helidon/microprofile/tyrus/TyrusUpgradeProvider.java @@ -16,10 +16,10 @@ package io.helidon.microprofile.tyrus; -import io.helidon.nima.webserver.ProtocolConfigs; -import io.helidon.nima.webserver.http1.spi.Http1Upgrader; -import io.helidon.nima.websocket.webserver.WsConfig; -import io.helidon.nima.websocket.webserver.WsUpgradeProvider; +import io.helidon.webserver.ProtocolConfigs; +import io.helidon.webserver.http1.spi.Http1Upgrader; +import io.helidon.webserver.websocket.WsConfig; +import io.helidon.webserver.websocket.WsUpgradeProvider; /** * {@link java.util.ServiceLoader} provider implementation for upgrade from HTTP/1.1 to Tyrus connection. diff --git a/microprofile/websocket/src/main/java/io/helidon/microprofile/tyrus/TyrusUpgrader.java b/microprofile/websocket/src/main/java/io/helidon/microprofile/tyrus/TyrusUpgrader.java index b80dabf57ea..c053214ec16 100644 --- a/microprofile/websocket/src/main/java/io/helidon/microprofile/tyrus/TyrusUpgrader.java +++ b/microprofile/websocket/src/main/java/io/helidon/microprofile/tyrus/TyrusUpgrader.java @@ -31,16 +31,16 @@ import io.helidon.common.Weighted; import io.helidon.common.buffers.BufferData; import io.helidon.common.buffers.DataWriter; -import io.helidon.common.http.DirectHandler; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.RequestException; -import io.helidon.common.http.WritableHeaders; import io.helidon.common.uri.UriQuery; -import io.helidon.nima.webserver.ConnectionContext; -import io.helidon.nima.webserver.spi.ServerConnection; -import io.helidon.nima.websocket.webserver.WsConfig; -import io.helidon.nima.websocket.webserver.WsUpgrader; +import io.helidon.http.DirectHandler; +import io.helidon.http.Http; +import io.helidon.http.HttpPrologue; +import io.helidon.http.RequestException; +import io.helidon.http.WritableHeaders; +import io.helidon.webserver.ConnectionContext; +import io.helidon.webserver.spi.ServerConnection; +import io.helidon.webserver.websocket.WsConfig; +import io.helidon.webserver.websocket.WsUpgrader; import jakarta.enterprise.inject.spi.CDI; import jakarta.websocket.DeploymentException; @@ -226,7 +226,7 @@ WebSocketEngine.UpgradeInfo protocolHandshake(WritableHeaders headers, UriQue final TyrusUpgradeResponse upgradeResponse = new TyrusUpgradeResponse(); final WebSocketEngine.UpgradeInfo upgradeInfo = engine.upgrade(requestContext, upgradeResponse); - // Map Tyrus response headers back to Nima + // Map Tyrus response headers back to Helidon upgradeResponse.getHeaders() .forEach((key, value) -> headers.add( Http.Headers.create( diff --git a/microprofile/websocket/src/main/java/module-info.java b/microprofile/websocket/src/main/java/module-info.java index eaee841b4e6..2f0328fe633 100644 --- a/microprofile/websocket/src/main/java/module-info.java +++ b/microprofile/websocket/src/main/java/module-info.java @@ -17,6 +17,7 @@ import io.helidon.common.features.api.Aot; import io.helidon.common.features.api.Feature; import io.helidon.common.features.api.HelidonFlavor; +import io.helidon.webserver.http1.spi.Http1UpgradeProvider; /** * MP Tyrus Integration @@ -40,8 +41,8 @@ requires io.helidon.config; requires io.helidon.microprofile.cdi; requires io.helidon.microprofile.server; - requires io.helidon.nima.webserver; - requires io.helidon.nima.websocket.webserver; + requires io.helidon.webserver; + requires io.helidon.webserver.websocket; requires org.glassfish.tyrus.core; requires org.glassfish.tyrus.server; @@ -56,6 +57,6 @@ with io.helidon.microprofile.tyrus.TyrusCdiExtension; provides org.glassfish.tyrus.core.ComponentProvider with io.helidon.microprofile.tyrus.HelidonComponentProvider; - provides io.helidon.nima.webserver.http1.spi.Http1UpgradeProvider + provides Http1UpgradeProvider with io.helidon.microprofile.tyrus.TyrusUpgradeProvider; } diff --git a/nima/common/pom.xml b/nima/common/pom.xml deleted file mode 100644 index 16a7ed5a7ed..00000000000 --- a/nima/common/pom.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - 4.0.0 - - - io.helidon.nima - helidon-nima-project - 4.0.0-SNAPSHOT - ../pom.xml - - - io.helidon.nima.common - helidon-nima-common-project - Helidon Níma Common Project - Common modules shared by both Níma client and server - - pom - - - tls - - - diff --git a/nima/common/tls/etc/spotbugs/exclude.xml b/nima/common/tls/etc/spotbugs/exclude.xml deleted file mode 100644 index b30cd63acaf..00000000000 --- a/nima/common/tls/etc/spotbugs/exclude.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - diff --git a/nima/common/tls/pom.xml b/nima/common/tls/pom.xml deleted file mode 100644 index c34c4ce3d57..00000000000 --- a/nima/common/tls/pom.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - - - 4.0.0 - - - io.helidon.nima.common - helidon-nima-common-project - 4.0.0-SNAPSHOT - ../pom.xml - - - helidon-nima-common-tls - Helidon Níma Common TLS - - - etc/spotbugs/exclude.xml - - - - - io.helidon.common - helidon-common - - - io.helidon.config - helidon-config - - - io.helidon.common - helidon-common-key-util - - - io.helidon.common - helidon-common-config - - - io.helidon.config - helidon-config-metadata - true - - - io.helidon.builder - helidon-builder-api - true - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - io.helidon.builder - helidon-builder-processor - ${helidon.version} - - - io.helidon.common.processor - helidon-common-processor-helidon-copyright - ${helidon.version} - - - - - - io.helidon.builder - helidon-builder-processor - ${helidon.version} - - - io.helidon.common.processor - helidon-common-processor-helidon-copyright - ${helidon.version} - - - - - - diff --git a/nima/common/tls/src/main/java/io/helidon/nima/common/tls/package-info.java b/nima/common/tls/src/main/java/io/helidon/nima/common/tls/package-info.java deleted file mode 100644 index 6383bc30b9d..00000000000 --- a/nima/common/tls/src/main/java/io/helidon/nima/common/tls/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * TLS Configuration for client and server. - */ -package io.helidon.nima.common.tls; diff --git a/nima/common/tls/src/main/java/module-info.java b/nima/common/tls/src/main/java/module-info.java deleted file mode 100644 index ce4638ea4f5..00000000000 --- a/nima/common/tls/src/main/java/module-info.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * TLS configuration for client and server. - */ -module io.helidon.nima.common.tls { - requires io.helidon.common; - requires io.helidon.common.pki; - - requires io.helidon.common.config; - - requires static io.helidon.builder.api; - requires static io.helidon.config.metadata; - - exports io.helidon.nima.common.tls; -} \ No newline at end of file diff --git a/nima/fault-tolerance/fault-tolerance/etc/spotbugs/exclude.xml b/nima/fault-tolerance/fault-tolerance/etc/spotbugs/exclude.xml deleted file mode 100644 index 1228944833c..00000000000 --- a/nima/fault-tolerance/fault-tolerance/etc/spotbugs/exclude.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - diff --git a/nima/fault-tolerance/fault-tolerance/pom.xml b/nima/fault-tolerance/fault-tolerance/pom.xml deleted file mode 100644 index f65a1a7ca77..00000000000 --- a/nima/fault-tolerance/fault-tolerance/pom.xml +++ /dev/null @@ -1,189 +0,0 @@ - - - - - 4.0.0 - - - io.helidon.nima.fault-tolerance - helidon-nima-fault-tolerance-project - 4.0.0-SNAPSHOT - ../pom.xml - - - helidon-nima-fault-tolerance - Helidon Nima Fault Tolerance - - - etc/spotbugs/exclude.xml - - - - - io.helidon.config - helidon-config - - - io.helidon.common - helidon-common-configurable - - - - io.helidon.inject - helidon-inject-api - - - - io.helidon.inject - helidon-inject-runtime - true - - - - io.helidon.builder - helidon-builder-api - - - - io.helidon.common.features - helidon-common-features-api - true - - - - io.helidon.config - helidon-config-metadata - true - - - - io.helidon.inject.configdriven - helidon-inject-configdriven-api - true - - - - io.helidon.inject.configdriven - helidon-inject-configdriven-runtime - true - - - org.hamcrest - hamcrest-all - test - - - org.junit.jupiter - junit-jupiter-api - test - - - io.helidon.common.testing - helidon-common-testing-junit5 - test - - - io.helidon.logging - helidon-logging-jul - test - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - io.helidon.config - helidon-config-metadata-processor - ${helidon.version} - - - io.helidon.inject.configdriven - helidon-inject-configdriven-processor - ${helidon.version} - - - io.helidon.builder - helidon-builder-processor - ${helidon.version} - - - io.helidon.common.processor - helidon-common-processor-helidon-copyright - ${helidon.version} - - - - - - io.helidon.builder - helidon-builder-processor - ${helidon.version} - - - io.helidon.config - helidon-config-metadata-processor - ${helidon.version} - - - io.helidon.inject.configdriven - helidon-inject-configdriven-processor - ${helidon.version} - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - io.helidon.common.processor - helidon-common-processor-helidon-copyright - ${helidon.version} - - - - - - diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/package-info.java b/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/package-info.java deleted file mode 100644 index c07d9d52a84..00000000000 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/io/helidon/nima/faulttolerance/package-info.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Fault tolerance for Helidon Níma. - *

    - * All handlers are fully blocking and should be executed on virtual threads. - */ -package io.helidon.nima.faulttolerance; diff --git a/nima/fault-tolerance/fault-tolerance/src/main/java/module-info.java b/nima/fault-tolerance/fault-tolerance/src/main/java/module-info.java deleted file mode 100644 index 1429e4c902a..00000000000 --- a/nima/fault-tolerance/fault-tolerance/src/main/java/module-info.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.common.features.api.Feature; -import io.helidon.common.features.api.HelidonFlavor; - -/** - * Fault tolerance module for Helidon Níma. - */ -@Feature(value = "Fault Tolerance", - description = "Fault Tolerance support", - in = HelidonFlavor.SE, - path = "FT" -) -module io.helidon.nima.faulttolerance { - requires io.helidon.common; - requires io.helidon.common.types; - requires io.helidon.common.configurable; - requires io.helidon.config; - requires io.helidon.inject.api; - requires io.helidon.builder.api; - - requires static jakarta.inject; - requires static io.helidon.common.features.api; - requires static io.helidon.config.metadata; - requires static io.helidon.inject.configdriven.api; - // needed to compile generated types - requires static io.helidon.inject.configdriven.runtime; - requires static io.helidon.inject.runtime; - - - exports io.helidon.nima.faulttolerance; - - // inject module - provides io.helidon.inject.api.ModuleComponent with io.helidon.nima.faulttolerance.Injection$$Module; -} diff --git a/nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/FaultToleranceTest.java b/nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/FaultToleranceTest.java deleted file mode 100644 index 7b22d5131d3..00000000000 --- a/nima/fault-tolerance/fault-tolerance/src/test/java/io/helidon/nima/faulttolerance/FaultToleranceTest.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.faulttolerance; - -import java.time.Duration; -import java.util.concurrent.CompletableFuture; - -import org.junit.jupiter.api.Test; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; - -class FaultToleranceTest { - - @Test - void testCustomCombination() { - CircuitBreaker breaker = CircuitBreaker.create(CircuitBreakerConfig.create()); - - Bulkhead bulkhead = Bulkhead.builder() - .limit(1) - .queueLength(0) - .build(); - - FtHandlerTyped faultTolerance = FaultTolerance.builder() - .addBreaker(breaker) - .addBulkhead(bulkhead) - .addTimeout(TimeoutConfig.builder().timeout(Duration.ofMillis(1000)).build()) - .addFallback(Fallback.create(builder -> builder - .fallback(this::fallback))) - .build(); - - // First call should not open breaker and execute call back - String result = faultTolerance.invoke(this::primary); - assertThat(result, is(MyException.class.getName())); // callback called - - // Manually open breaker - breaker.state(CircuitBreaker.State.OPEN); - assertThat(breaker.state(), is(CircuitBreaker.State.OPEN)); - - // Next call should fail on breaker but still execute fallback - result = faultTolerance.invoke(this::primary); - assertThat(result, is(CircuitBreakerOpenException.class.getName())); - - // Manually close breaker - breaker.state(CircuitBreaker.State.CLOSED); - assertThat(breaker.state(), is(CircuitBreaker.State.CLOSED)); - - // Second call forces timeout by calling a supplier that blocks indefinitely - Manual m = new Manual(); - result = faultTolerance.invoke(m::call); - assertThat(result, is(TimeoutException.class.getName())); // callback called - } - - private String primary() { - throw new MyException(); - } - - private String fallback(Throwable throwable) { - if (throwable instanceof RuntimeException && throwable.getCause() != null) { - throwable = throwable.getCause(); - } - return throwable.getClass().getName(); - } - - private static class Manual { - private final CompletableFuture future = new CompletableFuture<>(); - - private String call() { - try { - return future.get(); // blocks indefinitely - } catch (Throwable e) { - throw new RuntimeException(e); - } - } - } - - private static class MyException extends RuntimeException { - } -} diff --git a/nima/fault-tolerance/fault-tolerance/src/test/resources/logging.properties b/nima/fault-tolerance/fault-tolerance/src/test/resources/logging.properties deleted file mode 100644 index 071e4716a49..00000000000 --- a/nima/fault-tolerance/fault-tolerance/src/test/resources/logging.properties +++ /dev/null @@ -1,28 +0,0 @@ -# -# Copyright (c) 2020, 2023 Oracle and/or its affiliates. -# -# 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. -# - -# Example Logging Configuration File -# For more information see $JAVA_HOME/jre/lib/logging.properties -# Send messages to the console -handlers=io.helidon.logging.jul.HelidonConsoleHandler -# HelidonConsoleHandler uses a SimpleFormatter subclass that replaces "!thread!" with the current thread -java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$s %3$s !thread!: %5$s%6$s%n -# Global logging level. Can be overridden by specific loggers -.level=WARNING -io.helidon.level=INFO -io.helidon.nima.faulttolerance.level=INFO - - diff --git a/nima/fault-tolerance/pom.xml b/nima/fault-tolerance/pom.xml deleted file mode 100644 index a8b2bc5fc11..00000000000 --- a/nima/fault-tolerance/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - 4.0.0 - - - io.helidon.nima - helidon-nima-project - 4.0.0-SNAPSHOT - ../pom.xml - - - io.helidon.nima.fault-tolerance - helidon-nima-fault-tolerance-project - Helidon Nima Fault Tolerance Project - pom - - - fault-tolerance - processor - - diff --git a/nima/fault-tolerance/processor/pom.xml b/nima/fault-tolerance/processor/pom.xml deleted file mode 100644 index 3ae658bde20..00000000000 --- a/nima/fault-tolerance/processor/pom.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - 4.0.0 - - - io.helidon.nima.fault-tolerance - helidon-nima-fault-tolerance-project - 4.0.0-SNAPSHOT - ../pom.xml - - - helidon-nima-fault-tolerance-processor - Helidon Nima Fault Tolerance Annotation Processor - - - - io.helidon.inject - helidon-inject-api - - - io.helidon.inject - helidon-inject-processor - - - diff --git a/nima/fault-tolerance/processor/src/main/java/io/helidon/nima/faulttolerance/processor/Templates.java b/nima/fault-tolerance/processor/src/main/java/io/helidon/nima/faulttolerance/processor/Templates.java deleted file mode 100644 index 77a4a0f52e1..00000000000 --- a/nima/fault-tolerance/processor/src/main/java/io/helidon/nima/faulttolerance/processor/Templates.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.faulttolerance.processor; - -import java.io.InputStream; -import java.nio.charset.StandardCharsets; - -final class Templates { - private Templates() { - } - - static String loadTemplate(String name) { - String path = "templates/inject/nima/" + name; - try { - InputStream in = Templates.class.getClassLoader().getResourceAsStream(path); - if (in == null) { - throw new RuntimeException("Could not find template " + path + " on classpath."); - } - try (in) { - return new String(in.readAllBytes(), StandardCharsets.UTF_8); - } - } catch (Exception e) { - throw new RuntimeException(e); - } - } -} diff --git a/nima/fault-tolerance/processor/src/main/java/io/helidon/nima/faulttolerance/processor/package-info.java b/nima/fault-tolerance/processor/src/main/java/io/helidon/nima/faulttolerance/processor/package-info.java deleted file mode 100644 index e26dc772cab..00000000000 --- a/nima/fault-tolerance/processor/src/main/java/io/helidon/nima/faulttolerance/processor/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Annotation processor that generates Fault tolerance services discoverable by Pico. - */ -package io.helidon.nima.faulttolerance.processor; diff --git a/nima/fault-tolerance/processor/src/main/java/module-info.java b/nima/fault-tolerance/processor/src/main/java/module-info.java deleted file mode 100644 index 16e0f21fa79..00000000000 --- a/nima/fault-tolerance/processor/src/main/java/module-info.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.inject.tools.spi.CustomAnnotationTemplateCreator; - -/** - * Annotation processor that generates HTTP Endpoints. - */ -module io.helidon.nima.faulttolerance.processor { - requires io.helidon.inject.api; - requires io.helidon.inject.tools; - requires io.helidon.inject.processor; - requires java.compiler; - - exports io.helidon.nima.faulttolerance.processor; - opens templates.inject.nima; - - provides CustomAnnotationTemplateCreator - with io.helidon.nima.faulttolerance.processor.FallbackMethodCreator, - io.helidon.nima.faulttolerance.processor.RetryMethodCreator, - io.helidon.nima.faulttolerance.processor.CircuitBreakerMethodCreator; -} diff --git a/nima/graphql/pom.xml b/nima/graphql/pom.xml deleted file mode 100644 index 87eca77abb8..00000000000 --- a/nima/graphql/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - io.helidon.nima - helidon-nima-project - 4.0.0-SNAPSHOT - ../pom.xml - - 4.0.0 - - io.helidon.nima.graphql - helidon-nima-graphql-project - Helidon Níma GraphQL Project - pom - - - server - - diff --git a/nima/graphql/server/pom.xml b/nima/graphql/server/pom.xml deleted file mode 100644 index bbb96fb592e..00000000000 --- a/nima/graphql/server/pom.xml +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - io.helidon.nima.graphql - helidon-nima-graphql-project - 4.0.0-SNAPSHOT - ../pom.xml - - 4.0.0 - - io.helidon.nima.graphql - helidon-nima-graphql-server - Helidon Níma GraphQL Server - - - - io.helidon.graphql - helidon-graphql-server - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.webserver - helidon-nima-webserver-cors - - - org.eclipse - yasson - - - io.helidon.common.features - helidon-common-features-api - true - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - org.junit.jupiter - junit-jupiter-params - test - - - io.helidon.config - helidon-config-yaml - test - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - io.helidon.nima.webclient - helidon-nima-webclient - test - - - io.helidon.nima.http.media - helidon-nima-http-media-jsonp - test - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - - - - - diff --git a/nima/graphql/server/src/main/java/io/helidon/nima/graphql/server/package-info.java b/nima/graphql/server/src/main/java/io/helidon/nima/graphql/server/package-info.java deleted file mode 100644 index 30a87724edf..00000000000 --- a/nima/graphql/server/src/main/java/io/helidon/nima/graphql/server/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * GraphQL server integration with Helidon Níma WebServer. - */ -package io.helidon.nima.graphql.server; diff --git a/nima/graphql/server/src/main/java/module-info.java b/nima/graphql/server/src/main/java/module-info.java deleted file mode 100644 index 6fc8a295224..00000000000 --- a/nima/graphql/server/src/main/java/module-info.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.common.features.api.Feature; -import io.helidon.common.features.api.HelidonFlavor; -import io.helidon.common.features.api.Preview; - - -/** - * GraphQL server integration with Helidon Níma WebServer. - */ -@Preview -@Feature(value = "GraphQL", - description = "GraphQL Support", - in = HelidonFlavor.SE, - invalidIn = HelidonFlavor.MP -) -module io.helidon.nima.graphql.server { - requires static io.helidon.common.features.api; - - requires java.logging; - requires io.helidon.common; - requires io.helidon.common.uri; - requires io.helidon.common.configurable; - requires io.helidon.config; - requires io.helidon.cors; - requires io.helidon.nima.webserver.cors; - requires io.helidon.graphql.server; - requires io.helidon.nima.webserver; - requires org.eclipse.yasson; - requires jakarta.json.bind; - - exports io.helidon.nima.graphql.server; -} \ No newline at end of file diff --git a/nima/grpc/pom.xml b/nima/grpc/pom.xml deleted file mode 100644 index a864091c0be..00000000000 --- a/nima/grpc/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima - helidon-nima-project - 4.0.0-SNAPSHOT - - - io.helidon.nima.grpc - helidon-nima-grpc-project - Helidon Níma gRPC Project - pom - - - webserver - - diff --git a/nima/grpc/webserver/pom.xml b/nima/grpc/webserver/pom.xml deleted file mode 100644 index 66e584ed035..00000000000 --- a/nima/grpc/webserver/pom.xml +++ /dev/null @@ -1,138 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.grpc - helidon-nima-grpc-project - 4.0.0-SNAPSHOT - - - helidon-nima-grpc-webserver - Helidon Níma gRPC Server - - - - - javax.annotation - javax.annotation-api - 1.3.2 - true - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.http2 - helidon-nima-http2-webserver - - - io.grpc - grpc-core - - - io.grpc - grpc-stub - - - io.grpc - grpc-protobuf - - - io.helidon.common.features - helidon-common-features-api - true - - - io.helidon.config - helidon-config-metadata - true - - - io.helidon.builder - helidon-builder-api - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - io.helidon.config - helidon-config-metadata-processor - ${helidon.version} - - - io.helidon.builder - helidon-builder-processor - ${helidon.version} - - - io.helidon.common.processor - helidon-common-processor-helidon-copyright - ${helidon.version} - - - - - - io.helidon.builder - helidon-builder-processor - ${helidon.version} - - - io.helidon.config - helidon-config-metadata-processor - ${helidon.version} - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - io.helidon.common.processor - helidon-common-processor-helidon-copyright - ${helidon.version} - - - - - - diff --git a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/package-info.java b/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/package-info.java deleted file mode 100644 index e464e549e7b..00000000000 --- a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * GRPC support for Helidon Níma WebServer. - */ -package io.helidon.nima.grpc.webserver; diff --git a/nima/grpc/webserver/src/main/java/module-info.java b/nima/grpc/webserver/src/main/java/module-info.java deleted file mode 100644 index 4c462ec6360..00000000000 --- a/nima/grpc/webserver/src/main/java/module-info.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.common.features.api.Feature; -import io.helidon.common.features.api.HelidonFlavor; -import io.helidon.common.features.api.Preview; - -/** - * Helidon Níma gRPC server. - */ -@Preview -@Feature(value = "GRPC", - description = "gRPC Support", - in = HelidonFlavor.SE, - path = {"GRPC", "WebServer"} -) -module io.helidon.nima.grpc.server { - requires static io.helidon.common.features.api; - requires static io.helidon.config.metadata; - - requires java.logging; - - requires io.helidon.builder.api; - requires io.helidon.nima.http2.webserver; - - requires transitive grpc.stub; - requires transitive com.google.protobuf; - requires transitive grpc.api; - requires grpc.protobuf.lite; - - exports io.helidon.nima.grpc.webserver; - - provides io.helidon.nima.http2.webserver.spi.Http2SubProtocolProvider - with io.helidon.nima.grpc.webserver.GrpcProtocolProvider; - provides io.helidon.nima.webserver.spi.ProtocolConfigProvider - with io.helidon.nima.grpc.webserver.GrpcProtocolConfigProvider; -} diff --git a/nima/http/encoding/deflate/pom.xml b/nima/http/encoding/deflate/pom.xml deleted file mode 100644 index 76ccdeef4a1..00000000000 --- a/nima/http/encoding/deflate/pom.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.http.encoding - helidon-nima-http-encoding-project - 4.0.0-SNAPSHOT - - - helidon-nima-http-encoding-deflate - Helidon Níma HTTP Encoding deflate - - - - io.helidon.nima.http.encoding - helidon-nima-http-encoding - - - io.helidon.common - helidon-common-http - - - io.helidon.common.features - helidon-common-features-api - true - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - - - - - diff --git a/nima/http/encoding/deflate/src/main/java/io/helidon/nima/http/encoding/deflate/package-info.java b/nima/http/encoding/deflate/src/main/java/io/helidon/nima/http/encoding/deflate/package-info.java deleted file mode 100644 index 75beb333b20..00000000000 --- a/nima/http/encoding/deflate/src/main/java/io/helidon/nima/http/encoding/deflate/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Deflate encoding support. - */ -package io.helidon.nima.http.encoding.deflate; diff --git a/nima/http/encoding/deflate/src/main/java/module-info.java b/nima/http/encoding/deflate/src/main/java/module-info.java deleted file mode 100644 index cba353b0376..00000000000 --- a/nima/http/encoding/deflate/src/main/java/module-info.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.common.features.api.Feature; -import io.helidon.common.features.api.HelidonFlavor; -import io.helidon.nima.http.encoding.deflate.DeflateEncodingProvider; - -/** - * Deflate content encoding support. - */ -@Feature(value = "Deflate", - description = "Deflate content encoding support", - in = HelidonFlavor.SE, - path = {"Encoding", "Deflate"} -) -module io.helidon.nima.http.encoding.deflate { - requires static io.helidon.common.features.api; - - requires io.helidon.common; - requires io.helidon.nima.http.encoding; - - exports io.helidon.nima.http.encoding.deflate; - - provides io.helidon.nima.http.encoding.spi.ContentEncodingProvider with DeflateEncodingProvider; -} \ No newline at end of file diff --git a/nima/http/encoding/encoding/pom.xml b/nima/http/encoding/encoding/pom.xml deleted file mode 100644 index 2c967432aca..00000000000 --- a/nima/http/encoding/encoding/pom.xml +++ /dev/null @@ -1,129 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.http.encoding - helidon-nima-http-encoding-project - 4.0.0-SNAPSHOT - - - helidon-nima-http-encoding - Helidon Níma HTTP Encoding - - - - io.helidon.common - helidon-common-config - - - io.helidon.common - helidon-common-http - - - io.helidon.common - helidon-common-uri - - - io.helidon.builder - helidon-builder-api - - - - jakarta.annotation - jakarta.annotation-api - true - - - io.helidon.config - helidon-config-metadata - true - - - io.helidon.common.features - helidon-common-features-api - true - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - io.helidon.builder - helidon-builder-processor - ${helidon.version} - - - io.helidon.config - helidon-config-metadata-processor - ${helidon.version} - - - io.helidon.common.processor - helidon-common-processor-helidon-copyright - ${helidon.version} - - - - - - io.helidon.builder - helidon-builder-processor - ${helidon.version} - - - io.helidon.config - helidon-config-metadata-processor - ${helidon.version} - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - io.helidon.common.processor - helidon-common-processor-helidon-copyright - ${helidon.version} - - - - - - diff --git a/nima/http/encoding/encoding/src/main/java/io/helidon/nima/http/encoding/package-info.java b/nima/http/encoding/encoding/src/main/java/io/helidon/nima/http/encoding/package-info.java deleted file mode 100644 index 34a43baa37c..00000000000 --- a/nima/http/encoding/encoding/src/main/java/io/helidon/nima/http/encoding/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * HTTP Content encoding support, usually used to compress entity, such as {@code gzip}. - */ -package io.helidon.nima.http.encoding; diff --git a/nima/http/encoding/encoding/src/main/java/io/helidon/nima/http/encoding/spi/package-info.java b/nima/http/encoding/encoding/src/main/java/io/helidon/nima/http/encoding/spi/package-info.java deleted file mode 100644 index fc914d384e7..00000000000 --- a/nima/http/encoding/encoding/src/main/java/io/helidon/nima/http/encoding/spi/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * SPI to create custom content encoding. - */ -package io.helidon.nima.http.encoding.spi; diff --git a/nima/http/encoding/encoding/src/main/java/module-info.java b/nima/http/encoding/encoding/src/main/java/module-info.java deleted file mode 100644 index bc07e599336..00000000000 --- a/nima/http/encoding/encoding/src/main/java/module-info.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.common.features.api.Feature; -import io.helidon.common.features.api.HelidonFlavor; - -/** - * Content encoding support. - */ -@Feature(value = "Encoding", - description = "Content encoding support", - in = HelidonFlavor.SE, - path = "Encoding" -) -module io.helidon.nima.http.encoding { - requires static io.helidon.common.features.api; - requires io.helidon.builder.api; - requires static io.helidon.config.metadata; - requires static jakarta.annotation; - - requires io.helidon.common; - - requires transitive io.helidon.common.config; - requires transitive io.helidon.common.http; - - exports io.helidon.nima.http.encoding; - exports io.helidon.nima.http.encoding.spi; - - uses io.helidon.nima.http.encoding.spi.ContentEncodingProvider; -} \ No newline at end of file diff --git a/nima/http/encoding/gzip/pom.xml b/nima/http/encoding/gzip/pom.xml deleted file mode 100644 index a4a0d323c8b..00000000000 --- a/nima/http/encoding/gzip/pom.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.http.encoding - helidon-nima-http-encoding-project - 4.0.0-SNAPSHOT - - - helidon-nima-http-encoding-gzip - Helidon Níma HTTP Encoding gzip - - - - io.helidon.nima.http.encoding - helidon-nima-http-encoding - - - io.helidon.common - helidon-common-http - - - io.helidon.common.features - helidon-common-features-api - true - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - - - - - diff --git a/nima/http/encoding/gzip/src/main/java/io/helidon/nima/http/encoding/gzip/package-info.java b/nima/http/encoding/gzip/src/main/java/io/helidon/nima/http/encoding/gzip/package-info.java deleted file mode 100644 index a2ef55e8b4d..00000000000 --- a/nima/http/encoding/gzip/src/main/java/io/helidon/nima/http/encoding/gzip/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Gzip encoding support. - */ -package io.helidon.nima.http.encoding.gzip; diff --git a/nima/http/encoding/gzip/src/main/java/module-info.java b/nima/http/encoding/gzip/src/main/java/module-info.java deleted file mode 100644 index 44c1b6f26d1..00000000000 --- a/nima/http/encoding/gzip/src/main/java/module-info.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.common.features.api.Feature; -import io.helidon.common.features.api.HelidonFlavor; -import io.helidon.nima.http.encoding.gzip.GzipEncodingProvider; - -/** - * GZip content encoding support. - */ -@Feature(value = "GZip", - description = "GZip content encoding support", - in = HelidonFlavor.SE, - path = {"Encoding", "GZip"} -) -module io.helidon.nima.http.encoding.gzip { - requires static io.helidon.common.features.api; - - requires io.helidon.common; - requires io.helidon.nima.http.encoding; - - exports io.helidon.nima.http.encoding.gzip; - - provides io.helidon.nima.http.encoding.spi.ContentEncodingProvider with GzipEncodingProvider; -} \ No newline at end of file diff --git a/nima/http/encoding/pom.xml b/nima/http/encoding/pom.xml deleted file mode 100644 index cb5f9fc8212..00000000000 --- a/nima/http/encoding/pom.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.http - helidon-nima-http-project - 4.0.0-SNAPSHOT - - - io.helidon.nima.http.encoding - helidon-nima-http-encoding-project - Helidon Níma Encoding Project - Content-Encoding schemes - pom - - - encoding - gzip - deflate - - diff --git a/nima/http/media/jackson/pom.xml b/nima/http/media/jackson/pom.xml deleted file mode 100644 index 4f873f55483..00000000000 --- a/nima/http/media/jackson/pom.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.http.media - helidon-nima-http-media-project - 4.0.0-SNAPSHOT - - - helidon-nima-http-media-jackson - Helidon Níma HTTP Media Jackson - - - - io.helidon.nima.http.media - helidon-nima-http-media - - - com.fasterxml.jackson.core - jackson-databind - - - com.fasterxml.jackson.module - jackson-module-parameter-names - - - com.fasterxml.jackson.datatype - jackson-datatype-jdk8 - - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - - - io.helidon.common.features - helidon-common-features-api - true - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - io.helidon.common.testing - helidon-common-testing-http-junit5 - test - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - - - - - diff --git a/nima/http/media/jackson/src/main/java/io/helidon/nima/http/media/jackson/package-info.java b/nima/http/media/jackson/src/main/java/io/helidon/nima/http/media/jackson/package-info.java deleted file mode 100644 index dd3923921cf..00000000000 --- a/nima/http/media/jackson/src/main/java/io/helidon/nima/http/media/jackson/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Jackson media type support. - */ -package io.helidon.nima.http.media.jackson; diff --git a/nima/http/media/jackson/src/main/java/module-info.java b/nima/http/media/jackson/src/main/java/module-info.java deleted file mode 100644 index c3f75d987ae..00000000000 --- a/nima/http/media/jackson/src/main/java/module-info.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.common.features.api.Feature; -import io.helidon.common.features.api.HelidonFlavor; - -/** - * Jackson media support. - */ -@Feature(value = "Jackson", - description = "Jackson media support", - in = HelidonFlavor.SE, - path = {"Media", "Jackson"} -) -module io.helidon.nima.http.media.jackson { - requires static io.helidon.common.features.api; - - requires io.helidon.nima.http.media; - - requires com.fasterxml.jackson.databind; - requires com.fasterxml.jackson.core; - requires com.fasterxml.jackson.datatype.jdk8; - requires com.fasterxml.jackson.datatype.jsr310; - requires com.fasterxml.jackson.module.paramnames; - - exports io.helidon.nima.http.media.jackson; - - provides io.helidon.nima.http.media.spi.MediaSupportProvider - with io.helidon.nima.http.media.jackson.JacksonMediaSupportProvider; -} \ No newline at end of file diff --git a/nima/http/media/jsonb/pom.xml b/nima/http/media/jsonb/pom.xml deleted file mode 100644 index 8d65a6b2169..00000000000 --- a/nima/http/media/jsonb/pom.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.http.media - helidon-nima-http-media-project - 4.0.0-SNAPSHOT - - - helidon-nima-http-media-jsonb - Helidon Níma HTTP Media JSON-B - - - - io.helidon.nima.http.media - helidon-nima-http-media - - - org.eclipse - yasson - runtime - - - jakarta.json - jakarta.json-api - - - jakarta.json.bind - jakarta.json.bind-api - - - io.helidon.common.features - helidon-common-features-api - true - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - io.helidon.common.testing - helidon-common-testing-http-junit5 - test - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - - - - - diff --git a/nima/http/media/jsonb/src/main/java/io/helidon/nima/http/media/jsonb/package-info.java b/nima/http/media/jsonb/src/main/java/io/helidon/nima/http/media/jsonb/package-info.java deleted file mode 100644 index 65e5747724d..00000000000 --- a/nima/http/media/jsonb/src/main/java/io/helidon/nima/http/media/jsonb/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * JSON-Binding Entity Media handling support. - */ -package io.helidon.nima.http.media.jsonb; diff --git a/nima/http/media/jsonb/src/main/java/module-info.java b/nima/http/media/jsonb/src/main/java/module-info.java deleted file mode 100644 index 8aaf8070a5f..00000000000 --- a/nima/http/media/jsonb/src/main/java/module-info.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.common.features.api.Feature; -import io.helidon.common.features.api.HelidonFlavor; -import io.helidon.nima.http.media.jsonb.JsonbMediaSupportProvider; -import io.helidon.nima.http.media.spi.MediaSupportProvider; - -/** - * JSON-B media support. - */ -@Feature(value = "JSONB", - description = "JSON-B media support", - in = HelidonFlavor.SE, - path = {"Media", "JSON-B"} -) -module io.helidon.nima.http.media.jsonb { - requires static io.helidon.common.features.api; - - requires io.helidon.nima.http.media; - requires jakarta.json; - requires jakarta.json.bind; - - exports io.helidon.nima.http.media.jsonb; - - provides MediaSupportProvider with JsonbMediaSupportProvider; -} \ No newline at end of file diff --git a/nima/http/media/jsonb/src/main/resources/META-INF/native-image/io.helidon.nima.http.media/helidon-nima-http-media-jsonb/native-image.properties b/nima/http/media/jsonb/src/main/resources/META-INF/native-image/io.helidon.nima.http.media/helidon-nima-http-media-jsonb/native-image.properties deleted file mode 100644 index d52683183e6..00000000000 --- a/nima/http/media/jsonb/src/main/resources/META-INF/native-image/io.helidon.nima.http.media/helidon-nima-http-media-jsonb/native-image.properties +++ /dev/null @@ -1,17 +0,0 @@ -# -# Copyright (c) 2022 Oracle and/or its affiliates. -# -# 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. -# - -Args=--initialize-at-build-time=org.eclipse.yasson diff --git a/nima/http/media/jsonp/pom.xml b/nima/http/media/jsonp/pom.xml deleted file mode 100644 index ea7432801c8..00000000000 --- a/nima/http/media/jsonp/pom.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.http.media - helidon-nima-http-media-project - 4.0.0-SNAPSHOT - - - helidon-nima-http-media-jsonp - Helidon Níma HTTP Media JSON-P - - - - io.helidon.nima.http.media - helidon-nima-http-media - - - org.eclipse.parsson - parsson - runtime - - - jakarta.json - jakarta.json-api - - - io.helidon.common.features - helidon-common-features-api - true - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - io.helidon.common.testing - helidon-common-testing-http-junit5 - test - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - - - - - diff --git a/nima/http/media/jsonp/src/main/java/io/helidon/nima/http/media/jsonp/package-info.java b/nima/http/media/jsonp/src/main/java/io/helidon/nima/http/media/jsonp/package-info.java deleted file mode 100644 index 504fe373f85..00000000000 --- a/nima/http/media/jsonp/src/main/java/io/helidon/nima/http/media/jsonp/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * JSON-Processing Entity Media handling support. - */ -package io.helidon.nima.http.media.jsonp; diff --git a/nima/http/media/jsonp/src/main/java/module-info.java b/nima/http/media/jsonp/src/main/java/module-info.java deleted file mode 100644 index 7ca965fc74c..00000000000 --- a/nima/http/media/jsonp/src/main/java/module-info.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.common.features.api.Feature; -import io.helidon.common.features.api.HelidonFlavor; -import io.helidon.nima.http.media.jsonp.JsonpMediaSupportProvider; -import io.helidon.nima.http.media.spi.MediaSupportProvider; - -/** - * JSON-P media support. - */ -@Feature(value = "JSONP", - description = "JSON-P media support", - in = HelidonFlavor.SE, - path = {"Media", "JSON-P"} -) -module io.helidon.nima.http.media.jsonp { - requires static io.helidon.common.features.api; - - requires io.helidon.nima.http.media; - requires transitive jakarta.json; - - exports io.helidon.nima.http.media.jsonp; - - provides MediaSupportProvider with JsonpMediaSupportProvider; -} \ No newline at end of file diff --git a/nima/http/media/media/pom.xml b/nima/http/media/media/pom.xml deleted file mode 100644 index 50e351eb8ca..00000000000 --- a/nima/http/media/media/pom.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.http.media - helidon-nima-http-media-project - 4.0.0-SNAPSHOT - - - helidon-nima-http-media - Helidon Níma HTTP Media - - - - io.helidon.common - helidon-common - - - io.helidon.common - helidon-common-uri - - - io.helidon.common - helidon-common-http - - - io.helidon.common - helidon-common-buffers - - - io.helidon.config - helidon-config-metadata - true - - - io.helidon.common.features - helidon-common-features-api - true - - - io.helidon.builder - helidon-builder-api - true - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - io.helidon.builder - helidon-builder-processor - ${helidon.version} - - - - - - io.helidon.builder - helidon-builder-processor - ${helidon.version} - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - - - - diff --git a/nima/http/media/media/src/main/java/io/helidon/nima/http/media/package-info.java b/nima/http/media/media/src/main/java/io/helidon/nima/http/media/package-info.java deleted file mode 100644 index 2a471dcba51..00000000000 --- a/nima/http/media/media/src/main/java/io/helidon/nima/http/media/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Entity Media handling support. - */ -package io.helidon.nima.http.media; diff --git a/nima/http/media/media/src/main/java/io/helidon/nima/http/media/spi/package-info.java b/nima/http/media/media/src/main/java/io/helidon/nima/http/media/spi/package-info.java deleted file mode 100644 index d44e9973cfc..00000000000 --- a/nima/http/media/media/src/main/java/io/helidon/nima/http/media/spi/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Service provider interface(s) for entity media handling support. - */ -package io.helidon.nima.http.media.spi; diff --git a/nima/http/media/media/src/main/java/module-info.java b/nima/http/media/media/src/main/java/module-info.java deleted file mode 100644 index 5e4f5211da2..00000000000 --- a/nima/http/media/media/src/main/java/module-info.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.common.features.api.Feature; -import io.helidon.common.features.api.HelidonFlavor; - -/** - * Common classes for Media Support (reading/writing entity as a specific type). - */ -@Feature(value = "Media", - description = "Media Support", - in = HelidonFlavor.SE, - path = "Media" -) -module io.helidon.nima.http.media { - requires static io.helidon.common.features.api; - requires static io.helidon.builder.api; - requires static io.helidon.config.metadata; - - requires transitive io.helidon.common; - requires transitive io.helidon.common.http; - requires transitive io.helidon.common.media.type; - requires io.helidon.common.buffers; - requires io.helidon.common.uri; - - exports io.helidon.nima.http.media; - exports io.helidon.nima.http.media.spi; - - uses io.helidon.nima.http.media.spi.MediaSupportProvider; -} diff --git a/nima/http/media/multipart/pom.xml b/nima/http/media/multipart/pom.xml deleted file mode 100644 index 41b710d28de..00000000000 --- a/nima/http/media/multipart/pom.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.http.media - helidon-nima-http-media-project - 4.0.0-SNAPSHOT - - - helidon-nima-http-media-multipart - Helidon Níma HTTP Media Multipart - - - - io.helidon.nima.http.media - helidon-nima-http-media - - - io.helidon.common.features - helidon-common-features-api - true - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - - - - - diff --git a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/package-info.java b/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/package-info.java deleted file mode 100644 index 39ec9bbd092..00000000000 --- a/nima/http/media/multipart/src/main/java/io/helidon/nima/http/media/multipart/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Multipart Entity Media handling support. - */ -package io.helidon.nima.http.media.multipart; diff --git a/nima/http/media/multipart/src/main/java/module-info.java b/nima/http/media/multipart/src/main/java/module-info.java deleted file mode 100644 index 5f91ac9bcf6..00000000000 --- a/nima/http/media/multipart/src/main/java/module-info.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.common.features.api.Feature; -import io.helidon.common.features.api.HelidonFlavor; -import io.helidon.nima.http.media.multipart.MultiPartSupportProvider; -import io.helidon.nima.http.media.spi.MediaSupportProvider; - -/** - * Multipart media support. - */ -@Feature(value = "Multipart", - description = "Multipart media support", - in = HelidonFlavor.SE, - path = {"Media", "Multipart"} -) -module io.helidon.nima.http.media.multipart { - requires static io.helidon.common.features.api; - - requires io.helidon.common.http; - requires io.helidon.nima.http.media; - requires io.helidon.common.buffers; - - exports io.helidon.nima.http.media.multipart; - - provides MediaSupportProvider with MultiPartSupportProvider; -} \ No newline at end of file diff --git a/nima/http/media/pom.xml b/nima/http/media/pom.xml deleted file mode 100644 index 8e62ceafc5e..00000000000 --- a/nima/http/media/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.http - helidon-nima-http-project - 4.0.0-SNAPSHOT - - - io.helidon.nima.http.media - helidon-nima-http-media-project - Helidon Níma HTTP Media Project - pom - - - media - jsonb - jsonp - jackson - multipart - - diff --git a/nima/http/pom.xml b/nima/http/pom.xml deleted file mode 100644 index 8af9da5003d..00000000000 --- a/nima/http/pom.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - 4.0.0 - - - io.helidon.nima - helidon-nima-project - 4.0.0-SNAPSHOT - ../pom.xml - - - io.helidon.nima.http - helidon-nima-http-project - Helidon Níma HTTP Project - - pom - - - encoding - media - processor - - - diff --git a/nima/http/processor/pom.xml b/nima/http/processor/pom.xml deleted file mode 100644 index 59a339145cc..00000000000 --- a/nima/http/processor/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.http - helidon-nima-http-project - 4.0.0-SNAPSHOT - - - helidon-nima-http-processor - Helidon Níma HTTP Annotation Processor - - - true - - - - - io.helidon.inject - helidon-inject-api - - - io.helidon.inject - helidon-inject-processor - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - diff --git a/nima/http/processor/src/main/java/io/helidon/nima/http/processor/Templates.java b/nima/http/processor/src/main/java/io/helidon/nima/http/processor/Templates.java deleted file mode 100644 index a71216e8c4c..00000000000 --- a/nima/http/processor/src/main/java/io/helidon/nima/http/processor/Templates.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.http.processor; - -import java.io.InputStream; -import java.nio.charset.StandardCharsets; - -final class Templates { - private Templates() { - } - - static String loadTemplate(String templateProfile, String name) { - String path = "templates/inject/" + templateProfile + "/" + name; - try { - InputStream in = Templates.class.getClassLoader().getResourceAsStream(path); - if (in == null) { - throw new RuntimeException("Could not find template " + path + " on classpath."); - } - try (in) { - return new String(in.readAllBytes(), StandardCharsets.UTF_8); - } - } catch (Exception e) { - throw new RuntimeException(e); - } - } -} diff --git a/nima/http/processor/src/main/java/io/helidon/nima/http/processor/package-info.java b/nima/http/processor/src/main/java/io/helidon/nima/http/processor/package-info.java deleted file mode 100644 index 44e9b669c09..00000000000 --- a/nima/http/processor/src/main/java/io/helidon/nima/http/processor/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Annotation processor that generates HTTP Endpoints discoverable by Pico. - */ -package io.helidon.nima.http.processor; diff --git a/nima/http/processor/src/main/java/module-info.java b/nima/http/processor/src/main/java/module-info.java deleted file mode 100644 index e11a8bcf537..00000000000 --- a/nima/http/processor/src/main/java/module-info.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.inject.tools.spi.CustomAnnotationTemplateCreator; -import io.helidon.nima.http.processor.HttpEndpointCreator; -import io.helidon.nima.http.processor.HttpMethodCreator; - -/** - * Annotation processor that generates HTTP Endpoints. - */ -module io.helidon.nima.http.processor { - requires io.helidon.inject.api; - requires io.helidon.inject.tools; - requires io.helidon.inject.processor; - requires java.compiler; - - exports io.helidon.nima.http.processor; - - provides CustomAnnotationTemplateCreator - with HttpEndpointCreator, HttpMethodCreator; -} diff --git a/nima/http2/http2/pom.xml b/nima/http2/http2/pom.xml deleted file mode 100644 index 36b5495c78c..00000000000 --- a/nima/http2/http2/pom.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.http2 - helidon-nima-http2-project - 4.0.0-SNAPSHOT - - - helidon-nima-http2 - Helidon Níma HTTP/2 - - - - io.helidon.common - helidon-common-http - - - io.helidon.common - helidon-common-socket - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - org.junit.jupiter - junit-jupiter-params - test - - - io.helidon.logging - helidon-logging-jul - test - - - org.mockito - mockito-core - test - - - - diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2FrameTypes.java b/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2FrameTypes.java deleted file mode 100644 index 5cc7c91d5b2..00000000000 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2FrameTypes.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.http2; - -import io.helidon.nima.http2.Http2Flag.ContinuationFlags; -import io.helidon.nima.http2.Http2Flag.DataFlags; -import io.helidon.nima.http2.Http2Flag.HeaderFlags; -import io.helidon.nima.http2.Http2Flag.NoFlags; -import io.helidon.nima.http2.Http2Flag.PingFlags; -import io.helidon.nima.http2.Http2Flag.PushPromiseFlags; -import io.helidon.nima.http2.Http2Flag.SettingsFlags; - -/** - * Frame types with types flags. - * - * @param type of flags - */ -public interface Http2FrameTypes { - /** - * Data frame types. - */ - Http2FrameTypes DATA = new Http2FrameTypeUtil.FrameTypeImpl<>(Http2FrameType.DATA, DataFlags::create); - /** - * Headers frame types. - */ - Http2FrameTypes HEADERS = new Http2FrameTypeUtil.FrameTypeImpl<>(Http2FrameType.HEADERS, HeaderFlags::create); - /** - * Priority frame types. - */ - Http2FrameTypes PRIORITY = new Http2FrameTypeUtil.FrameTypeImpl<>(Http2FrameType.PRIORITY, NoFlags::create); - /** - * RST stream frame types. - */ - Http2FrameTypes RST_STREAM = new Http2FrameTypeUtil.FrameTypeImpl<>(Http2FrameType.RST_STREAM, NoFlags::create); - /** - * Settings frame types. - */ - Http2FrameTypes SETTINGS = new Http2FrameTypeUtil.FrameTypeImpl<>(Http2FrameType.SETTINGS, - SettingsFlags::create); - /** - * Push promise frame types. - */ - Http2FrameTypes PUSH_PROMISE = new Http2FrameTypeUtil.FrameTypeImpl<>(Http2FrameType.PUSH_PROMISE, - PushPromiseFlags::create); - /** - * Ping frame types. - */ - Http2FrameTypes PING = new Http2FrameTypeUtil.FrameTypeImpl<>(Http2FrameType.PING, PingFlags::create); - /** - * Go away frame types. - */ - Http2FrameTypes GO_AWAY = new Http2FrameTypeUtil.FrameTypeImpl<>(Http2FrameType.GO_AWAY, NoFlags::create); - /** - * Window update frame types. - */ - Http2FrameTypes WINDOW_UPDATE = new Http2FrameTypeUtil.FrameTypeImpl<>(Http2FrameType.WINDOW_UPDATE, - NoFlags::create); - /** - * Continuation frame types. - */ - Http2FrameTypes CONTINUATION = new Http2FrameTypeUtil.FrameTypeImpl<>(Http2FrameType.CONTINUATION, - ContinuationFlags::create); - /** - * Unknown frame types. - */ - Http2FrameTypes UNKNOWN = new Http2FrameTypeUtil.FrameTypeImpl<>(Http2FrameType.UNKNOWN, NoFlags::create); - - /** - * Get frame types based on frame type enum. - * - * @param frameType frame type - * @return frame types - */ - static Http2FrameTypes get(Http2FrameType frameType) { - return Http2FrameTypeUtil.get(frameType); - } - - /** - * Frame type enum. - * - * @return frame type - */ - Http2FrameType type(); - - /** - * Typed flags. - * - * @param flags flags number - * @return typed flags instances - */ - T flags(int flags); -} diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Stream.java b/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Stream.java deleted file mode 100644 index 25ccf5df3dc..00000000000 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/Http2Stream.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.http2; - -import io.helidon.common.buffers.BufferData; - -/** - * HTTP/2 stream. - * A stream represents a single request/response exchange in HTTP/2. - */ -public interface Http2Stream { - /** - * Close the stream. - * - * @param rstStream rst stream frame - */ - void rstStream(Http2RstStream rstStream); - - /** - * Flow control window update. - * - * @param windowUpdate window update frame - */ - void windowUpdate(Http2WindowUpdate windowUpdate); - - /** - * Headers received. - * - * @param headers request headers - * @param endOfStream whether these headers are the last data that would be received - */ - void headers(Http2Headers headers, boolean endOfStream); - - /** - * Data frame. - * - * @param header frame header - * @param data frame data - */ - void data(Http2FrameHeader header, BufferData data); - - /** - * Priority. - * - * @param http2Priority priority frame - */ - void priority(Http2Priority http2Priority); - - /** - * Stream ID. - * - * @return id of this stream - */ - int streamId(); - - /** - * State of this stream. - * - * @return state - */ - Http2StreamState streamState(); - - /** - * Outbound flow control of this stream. - * - * @return flow control - */ - StreamFlowControl flowControl(); - -} diff --git a/nima/http2/http2/src/main/java/io/helidon/nima/http2/package-info.java b/nima/http2/http2/src/main/java/io/helidon/nima/http2/package-info.java deleted file mode 100644 index 26d1f24ea30..00000000000 --- a/nima/http2/http2/src/main/java/io/helidon/nima/http2/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * HTTP/2 types common for client and server. - */ -package io.helidon.nima.http2; diff --git a/nima/http2/http2/src/main/java/module-info.java b/nima/http2/http2/src/main/java/module-info.java deleted file mode 100644 index 831e6906847..00000000000 --- a/nima/http2/http2/src/main/java/module-info.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * HTTP2 common classes. - */ -module io.helidon.nima.http2 { - requires transitive io.helidon.common.socket; - requires transitive io.helidon.common.http; - requires io.helidon.common; - - exports io.helidon.nima.http2; -} diff --git a/nima/http2/http2/src/test/resources/logging-test.properties b/nima/http2/http2/src/test/resources/logging-test.properties deleted file mode 100644 index 12ca00d657e..00000000000 --- a/nima/http2/http2/src/test/resources/logging-test.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2023 Oracle and/or its affiliates. -# -# 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. -# -handlers=io.helidon.logging.jul.HelidonConsoleHandler -# HelidonConsoleHandler uses a SimpleFormatter subclass that replaces "!thread!" with the current thread -java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$s %3$s !thread!: %5$s%6$s%n -#java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS.%1$tL %5$s%6$s%n -# Global logging level. Can be overridden by specific loggers -.level=INFO -io.helidon.nima.level=INFO -#io.helidon.nima.http2.MaxFrameSizeSplitTest.level=ALL diff --git a/nima/http2/pom.xml b/nima/http2/pom.xml deleted file mode 100644 index b454601b915..00000000000 --- a/nima/http2/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - 4.0.0 - - - io.helidon.nima - helidon-nima-project - 4.0.0-SNAPSHOT - ../pom.xml - - - io.helidon.nima.http2 - helidon-nima-http2-project - Helidon Níma HTTP/2 Project - - pom - - - - true - - - - http2 - webclient - webserver - - - diff --git a/nima/http2/webclient/etc/spotbugs/exclude.xml b/nima/http2/webclient/etc/spotbugs/exclude.xml deleted file mode 100644 index cc99fdbb99b..00000000000 --- a/nima/http2/webclient/etc/spotbugs/exclude.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - diff --git a/nima/http2/webclient/pom.xml b/nima/http2/webclient/pom.xml deleted file mode 100644 index 4d7fcb33752..00000000000 --- a/nima/http2/webclient/pom.xml +++ /dev/null @@ -1,140 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.http2 - helidon-nima-http2-project - 4.0.0-SNAPSHOT - - - helidon-nima-http2-webclient - Helidon Níma HTTP/2 WebClient - - - etc/spotbugs/exclude.xml - - - - - io.helidon.nima.http2 - helidon-nima-http2 - - - io.helidon.nima.http.encoding - helidon-nima-http-encoding - - - io.helidon.nima.webclient - helidon-nima-webclient - - - io.helidon.common.features - helidon-common-features-api - true - - - io.helidon.config - helidon-config-metadata - true - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - io.helidon.nima.http2 - helidon-nima-http2-webserver - test - - - io.helidon.nima.testing.junit5 - - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-params - test - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - io.helidon.config - helidon-config-metadata-processor - ${helidon.version} - - - io.helidon.builder - helidon-builder-processor - ${helidon.version} - - - io.helidon.common.processor - helidon-common-processor-helidon-copyright - ${helidon.version} - - - - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - io.helidon.config - helidon-config-metadata-processor - ${helidon.version} - - - io.helidon.builder - helidon-builder-processor - ${helidon.version} - - - io.helidon.common.processor - helidon-common-processor-helidon-copyright - ${helidon.version} - - - - - - - diff --git a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/ConnectionContext.java b/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/ConnectionContext.java deleted file mode 100644 index cd607ef7e80..00000000000 --- a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/ConnectionContext.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.http2.webclient; - -import java.time.Duration; - -record ConnectionContext(int initialWindowSize, - int maxFrameSize, - long maxHeaderListSize, - int connectionPrefetch, - int requestPrefetch, - Duration flowControlTimeout, - Duration timeout) { -} diff --git a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/package-info.java b/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/package-info.java deleted file mode 100644 index 23808f6d593..00000000000 --- a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * HTTP/2 WebClient. - */ -package io.helidon.nima.http2.webclient; diff --git a/nima/http2/webclient/src/main/java/module-info.java b/nima/http2/webclient/src/main/java/module-info.java deleted file mode 100644 index bea9833ef5c..00000000000 --- a/nima/http2/webclient/src/main/java/module-info.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.common.features.api.Feature; -import io.helidon.common.features.api.HelidonFlavor; - -/** - * HTTP/2 WebClient. - */ -@Feature(value = "HTTP/2", - description = "HTTP/2 WebClient", - in = HelidonFlavor.SE, - path = {"WebClient", "HTTP/2"} -) -module io.helidon.nima.http2.webclient { - requires static io.helidon.common.features.api; - requires static io.helidon.config.metadata; - - requires transitive io.helidon.builder.api; - requires transitive io.helidon.nima.http2; - requires transitive io.helidon.nima.webclient; - requires transitive io.helidon.common.pki; - - exports io.helidon.nima.http2.webclient; -} diff --git a/nima/http2/webclient/src/test/resources/logging-test.properties b/nima/http2/webclient/src/test/resources/logging-test.properties deleted file mode 100644 index 27029468ef0..00000000000 --- a/nima/http2/webclient/src/test/resources/logging-test.properties +++ /dev/null @@ -1,27 +0,0 @@ -# -# Copyright (c) 2022, 2023 Oracle and/or its affiliates. -# -# 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. -# - -# Send messages to the console -handlers=java.util.logging.ConsoleHandler -java.util.logging.ConsoleHandler.level=FINEST -java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter -# java.util.logging.SimpleFormatter.format = [%1$tc] %5$s %6$s%n -java.util.logging.SimpleFormatter.format=%1$tH:%1$tM:%1$tS %4$s %3$s %5$s%6$s%n -#java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$s %3$s %5$s%6$s%n - -io.helidon.nima.level=INFO -# Global logging level. Can be overridden by specific loggers -.level=INFO diff --git a/nima/http2/webserver/pom.xml b/nima/http2/webserver/pom.xml deleted file mode 100644 index 3b2f9ff0f8f..00000000000 --- a/nima/http2/webserver/pom.xml +++ /dev/null @@ -1,129 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.http2 - helidon-nima-http2-project - 4.0.0-SNAPSHOT - - - helidon-nima-http2-webserver - Helidon Níma HTTP/2 WebServer - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.http2 - helidon-nima-http2 - - - io.helidon.builder - helidon-builder-api - - - io.helidon.common.features - helidon-common-features-api - true - - - io.helidon.config - helidon-config-metadata - true - - - io.helidon.config - helidon-config-yaml - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - org.mockito - mockito-core - test - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - io.helidon.builder - helidon-builder-processor - ${helidon.version} - - - io.helidon.config - helidon-config-metadata-processor - ${helidon.version} - - - io.helidon.common.processor - helidon-common-processor-helidon-copyright - ${helidon.version} - - - - - - io.helidon.builder - helidon-builder-processor - ${helidon.version} - - - io.helidon.config - helidon-config-metadata-processor - ${helidon.version} - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - io.helidon.common.processor - helidon-common-processor-helidon-copyright - ${helidon.version} - - - - - - diff --git a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2Stream.java b/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2Stream.java deleted file mode 100644 index ca76b4df054..00000000000 --- a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2Stream.java +++ /dev/null @@ -1,441 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.http2.webserver; - -import java.io.UncheckedIOException; -import java.util.List; -import java.util.concurrent.ArrayBlockingQueue; -import java.util.concurrent.Semaphore; - -import io.helidon.common.buffers.BufferData; -import io.helidon.common.http.DirectHandler; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderNames; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.RequestException; -import io.helidon.common.http.ServerResponseHeaders; -import io.helidon.common.socket.SocketWriterException; -import io.helidon.nima.http.encoding.ContentDecoder; -import io.helidon.nima.http.encoding.ContentEncodingContext; -import io.helidon.nima.http2.ConnectionFlowControl; -import io.helidon.nima.http2.Http2ErrorCode; -import io.helidon.nima.http2.Http2Exception; -import io.helidon.nima.http2.Http2Flag; -import io.helidon.nima.http2.Http2FrameData; -import io.helidon.nima.http2.Http2FrameHeader; -import io.helidon.nima.http2.Http2FrameTypes; -import io.helidon.nima.http2.Http2Headers; -import io.helidon.nima.http2.Http2Priority; -import io.helidon.nima.http2.Http2RstStream; -import io.helidon.nima.http2.Http2Settings; -import io.helidon.nima.http2.Http2StreamState; -import io.helidon.nima.http2.Http2StreamWriter; -import io.helidon.nima.http2.Http2WindowUpdate; -import io.helidon.nima.http2.StreamFlowControl; -import io.helidon.nima.http2.WindowSize; -import io.helidon.nima.http2.webserver.spi.Http2SubProtocolSelector; -import io.helidon.nima.http2.webserver.spi.SubProtocolResult; -import io.helidon.nima.webserver.CloseConnectionException; -import io.helidon.nima.webserver.ConnectionContext; -import io.helidon.nima.webserver.Router; -import io.helidon.nima.webserver.http.HttpRouting; - -import static java.lang.System.Logger.Level.TRACE; - -/** - * Server HTTP/2 stream implementation. - */ -public class Http2Stream implements Runnable, io.helidon.nima.http2.Http2Stream { - private static final DataFrame TERMINATING_FRAME = - new DataFrame(Http2FrameHeader.create(0, - Http2FrameTypes.DATA, - Http2Flag.DataFlags.create(Http2Flag.DataFlags.END_OF_STREAM), - 0), BufferData.empty()); - private static final System.Logger LOGGER = System.getLogger(Http2Stream.class.getName()); - - private final ConnectionContext ctx; - private final Http2Config http2Config; - private final List subProviders; - private final int streamId; - private final Http2Settings serverSettings; - private final Http2Settings clientSettings; - private final Http2StreamWriter writer; - private final Router router; - private final ArrayBlockingQueue inboundData = new ArrayBlockingQueue<>(32); - private final StreamFlowControl flowControl; - - private boolean wasLastDataFrame = false; - private volatile Http2Headers headers; - private volatile Http2Priority priority; - // used from this instance and from connection - private volatile Http2StreamState state = Http2StreamState.IDLE; - private Http2SubProtocolSelector.SubProtocolHandler subProtocolHandler; - private long expectedLength = -1; - private HttpRouting routing; - private HttpPrologue prologue; - // create a semaphore if accessed before we get the one from connection - // must be volatile, as it is accessed both from connection thread and from stream thread - private volatile Semaphore requestSemaphore = new Semaphore(1); - private boolean semaphoreAcquired; - - /** - * A new HTTP/2 server stream. - * - * @param ctx connection context - * @param routing HTTP routing - * @param http2Config HTTP/2 configuration - * @param subProviders HTTP/2 sub protocol selectors - * @param streamId stream id - * @param serverSettings server settings - * @param clientSettings client settings - * @param writer writer - * @param connectionFlowControl connection flow control - */ - public Http2Stream(ConnectionContext ctx, - HttpRouting routing, - Http2Config http2Config, - List subProviders, - int streamId, - Http2Settings serverSettings, - Http2Settings clientSettings, - Http2StreamWriter writer, - ConnectionFlowControl connectionFlowControl) { - this.ctx = ctx; - this.routing = routing; - this.http2Config = http2Config; - this.subProviders = subProviders; - this.streamId = streamId; - this.serverSettings = serverSettings; - this.clientSettings = clientSettings; - this.writer = writer; - this.router = ctx.router(); - this.flowControl = connectionFlowControl.createStreamFlowControl( - streamId, - http2Config.initialWindowSize(), - http2Config.maxFrameSize() - ); - } - - /** - * Check this stream is not closed. - * This method is called from connection thread. - * - * @throws Http2Exception in case this stream is closed - */ - public void checkNotClosed() throws Http2Exception { - if (state == Http2StreamState.HALF_CLOSED_REMOTE - || state == Http2StreamState.CLOSED) { - throw new Http2Exception(Http2ErrorCode.STREAM_CLOSED, - "Stream " + streamId + " is closed. State: " + state); - } - } - - /** - * Check if data can be received on this stream. - * This method is called from connection thread. - * - * @throws Http2Exception in case data cannot be received - */ - public void checkDataReceivable() throws Http2Exception { - if (state != Http2StreamState.OPEN) { - throw new Http2Exception(Http2ErrorCode.PROTOCOL, "Received data for stream " - + streamId + " in state " + state); - } - } - - /** - * Check if headers can be received on this stream. - * This method is called from connection thread. - * - * @throws Http2Exception in case headers cannot be received. - */ - public void checkHeadersReceivable() throws Http2Exception { - switch (state) { - case IDLE: - // this is OK - break; - case HALF_CLOSED_LOCAL: - case HALF_CLOSED_REMOTE: - case CLOSED: - throw new Http2Exception(Http2ErrorCode.STREAM_CLOSED, - "Stream " + streamId + " received headers when stream is " + state); - case OPEN: - throw new Http2Exception(Http2ErrorCode.PROTOCOL, "Received headers for open stream " + streamId); - default: - throw new Http2Exception(Http2ErrorCode.INTERNAL, "Unknown stream state: " + streamId + ", state: " + state); - } - } - - @Override - public void rstStream(Http2RstStream rstStream) { - if (state == Http2StreamState.IDLE) { - throw new Http2Exception(Http2ErrorCode.PROTOCOL, - "Received RST_STREAM for stream " - + streamId + " in IDLE state"); - } - // TODO interrupt - this.state = Http2StreamState.CLOSED; - } - - @Override - public void windowUpdate(Http2WindowUpdate windowUpdate) { - if (state == Http2StreamState.IDLE) { - throw new Http2Exception(Http2ErrorCode.PROTOCOL, "Received WINDOW_UPDATE for stream " - + streamId + " in state IDLE"); - } - //6.9/2 - if (windowUpdate.windowSizeIncrement() == 0) { - Http2RstStream frame = new Http2RstStream(Http2ErrorCode.PROTOCOL); - writer.write(frame.toFrameData(clientSettings, streamId, Http2Flag.NoFlags.create())); - } - //6.9.1/3 - if (flowControl.outbound().incrementStreamWindowSize(windowUpdate.windowSizeIncrement()) > WindowSize.MAX_WIN_SIZE) { - Http2RstStream frame = new Http2RstStream(Http2ErrorCode.FLOW_CONTROL); - writer.write(frame.toFrameData(clientSettings, streamId, Http2Flag.NoFlags.create())); - } - } - - // this method is called from connection thread and start the - // thread o this stream - @Override - public void headers(Http2Headers headers, boolean endOfStream) { - this.headers = headers; - this.state = endOfStream ? Http2StreamState.HALF_CLOSED_REMOTE : Http2StreamState.OPEN; - if (state == Http2StreamState.HALF_CLOSED_REMOTE) { - try { - // we need to notify that there is no data coming - inboundData.put(TERMINATING_FRAME); - } catch (InterruptedException e) { - throw new Http2Exception(Http2ErrorCode.INTERNAL, "Interrupted", e); - } - } - } - - @Override - public void data(Http2FrameHeader header, BufferData data) { - // todo check number of queued items and modify flow control if we seem to be collecting messages - if (expectedLength != -1 && expectedLength < header.length()) { - state = Http2StreamState.CLOSED; - Http2RstStream rst = new Http2RstStream(Http2ErrorCode.PROTOCOL); - writer.write(rst.toFrameData(clientSettings, streamId, Http2Flag.NoFlags.create())); - return; - } - if (expectedLength != -1) { - expectedLength -= header.length(); - } - try { - inboundData.put(new DataFrame(header, data)); - } catch (InterruptedException e) { - throw new Http2Exception(Http2ErrorCode.INTERNAL, "Interrupted", e); - } - } - - @Override - public void priority(Http2Priority http2Priority) { - int i = http2Priority.streamId(); - if (i == this.streamId) { - throw new Http2Exception(Http2ErrorCode.PROTOCOL, "Stream depends on itself"); - } - this.priority = http2Priority; - } - - @Override - public int streamId() { - return streamId; - } - - @Override - public Http2StreamState streamState() { - return state; - } - - @Override - public StreamFlowControl flowControl() { - return this.flowControl; - } - - @Override - public void run() { - Thread.currentThread() - .setName("[" + ctx.socketId() + " " - + ctx.childSocketId() + " ] - " + streamId); - try { - handle(); - } catch (SocketWriterException | CloseConnectionException | UncheckedIOException e) { - Http2RstStream rst = new Http2RstStream(Http2ErrorCode.STREAM_CLOSED); - writer.write(rst.toFrameData(serverSettings, streamId, Http2Flag.NoFlags.create())); - // no sense in throwing an exception, as this is invoked from an executor service directly - } catch (RequestException e) { - DirectHandler handler = ctx.listenerContext() - .directHandlers() - .handler(e.eventType()); - DirectHandler.TransportResponse response = handler.handle(e.request(), - e.eventType(), - e.status(), - e.responseHeaders(), - e); - - ServerResponseHeaders headers = response.headers(); - byte[] message = response.entity().orElse(BufferData.EMPTY_BYTES); - if (message.length != 0) { - headers.set(Http.Headers.create(Http.HeaderNames.CONTENT_LENGTH, String.valueOf(message.length))); - } - Http2Headers http2Headers = Http2Headers.create(headers); - if (message.length == 0) { - writer.writeHeaders(http2Headers, - streamId, - Http2Flag.HeaderFlags.create(Http2Flag.END_OF_HEADERS | Http2Flag.END_OF_STREAM), - flowControl.outbound()); - } else { - Http2FrameHeader dataHeader = Http2FrameHeader.create(message.length, - Http2FrameTypes.DATA, - Http2Flag.DataFlags.create(Http2Flag.END_OF_STREAM), - streamId); - writer.writeHeaders(http2Headers, - streamId, - Http2Flag.HeaderFlags.create(Http2Flag.END_OF_HEADERS), - new Http2FrameData(dataHeader, BufferData.create(message)), - flowControl.outbound()); - } - } finally { - headers = null; - subProtocolHandler = null; - if (semaphoreAcquired) { - requestSemaphore.release(); - } - } - } - - void requestSemaphore(Semaphore requestSemaphore) { - this.requestSemaphore = requestSemaphore; - } - - void prologue(HttpPrologue prologue) { - this.prologue = prologue; - } - - private BufferData readEntityFromPipeline() { - if (wasLastDataFrame) { - return BufferData.empty(); - } - - DataFrame frame; - try { - frame = inboundData.take(); - flowControl.inbound().incrementWindowSize(frame.header().length()); - } catch (InterruptedException e) { - // this stream was interrupted, does not make sense to do anything else - return BufferData.empty(); - } - - if (frame.header().flags(Http2FrameTypes.DATA).endOfStream()) { - wasLastDataFrame = true; - } - return frame.data(); - } - - private void handle() { - Headers httpHeaders = headers.httpHeaders(); - if (httpHeaders.contains(Http.HeaderNames.CONTENT_LENGTH)) { - this.expectedLength = httpHeaders.get(HeaderNames.CONTENT_LENGTH).value(long.class); - } - - subProtocolHandler = null; - - for (Http2SubProtocolSelector provider : subProviders) { - SubProtocolResult subProtocolResult = provider.subProtocol(ctx, - prologue, - headers, - writer, - streamId, - serverSettings, - clientSettings, - flowControl, - state, - router); - if (subProtocolResult.supported()) { - subProtocolHandler = subProtocolResult.subProtocol(); - break; - } - } - - if (subProtocolHandler == null) { - ContentEncodingContext contentEncodingContext = ctx.listenerContext().contentEncodingContext(); - ContentDecoder decoder; - if (contentEncodingContext.contentDecodingEnabled()) { - if (httpHeaders.contains(Http.HeaderNames.CONTENT_ENCODING)) { - String contentEncoding = httpHeaders.get(Http.HeaderNames.CONTENT_ENCODING).value(); - if (contentEncodingContext.contentDecodingSupported(contentEncoding)) { - decoder = contentEncodingContext.decoder(contentEncoding); - } else { - throw RequestException.builder() - .type(DirectHandler.EventType.OTHER) - .status(Http.Status.UNSUPPORTED_MEDIA_TYPE_415) - .message("Unsupported content encoding") - .build(); - } - } else { - decoder = ContentDecoder.NO_OP; - } - } else { - decoder = ContentDecoder.NO_OP; - } - - Http2ServerRequest request = Http2ServerRequest.create(ctx, - routing.security(), - prologue, - headers, - decoder, - streamId, - this::readEntityFromPipeline); - Http2ServerResponse response = new Http2ServerResponse(ctx, request, writer, streamId, flowControl.outbound()); - semaphoreAcquired = requestSemaphore.tryAcquire(); - try { - if (semaphoreAcquired) { - routing.route(ctx, request, response); - } else { - ctx.log(LOGGER, TRACE, "Too many concurrent requests, rejecting request."); - response.status(Http.Status.SERVICE_UNAVAILABLE_503) - .send("Too Many Concurrent Requests"); - response.commit(); - } - } finally { - this.state = Http2StreamState.CLOSED; - } - } else { - subProtocolHandler.init(); - while (subProtocolHandler.streamState() != Http2StreamState.CLOSED - && subProtocolHandler.streamState() != Http2StreamState.HALF_CLOSED_LOCAL) { - DataFrame frame; - try { - frame = inboundData.take(); - flowControl.inbound().incrementWindowSize(frame.header().length()); - } catch (InterruptedException e) { - // this stream was interrupted, does not make sense to do anything else - String handlerName = subProtocolHandler.getClass().getSimpleName(); - ctx.log(LOGGER, System.Logger.Level.DEBUG, "%s interrupted stream %d", handlerName, streamId); - return; - } - subProtocolHandler.data(frame.header, frame.data); - this.state = subProtocolHandler.streamState(); - } - } - } - - private record DataFrame(Http2FrameHeader header, BufferData data) { } -} diff --git a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/package-info.java b/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/package-info.java deleted file mode 100644 index 9f8a0661835..00000000000 --- a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * HTTP/2 WebServer. - */ -package io.helidon.nima.http2.webserver; diff --git a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/spi/package-info.java b/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/spi/package-info.java deleted file mode 100644 index 0b2327fc046..00000000000 --- a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/spi/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * HTTP/2 WebServer SPI. - */ -package io.helidon.nima.http2.webserver.spi; diff --git a/nima/http2/webserver/src/main/java/module-info.java b/nima/http2/webserver/src/main/java/module-info.java deleted file mode 100644 index f677d8d316e..00000000000 --- a/nima/http2/webserver/src/main/java/module-info.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.common.features.api.Feature; -import io.helidon.common.features.api.HelidonFlavor; -import io.helidon.nima.http2.webserver.Http2ProtocolConfigProvider; -import io.helidon.nima.webserver.spi.ServerConnectionSelectorProvider; - -/** - * HTTP/2 WebServer. - */ -@Feature(value = "HTTP/2", - description = "HTTP/2 WebServer", - in = HelidonFlavor.SE, - path = {"WebServer", "HTTP/2"} -) -module io.helidon.nima.http2.webserver { - requires static io.helidon.common.features.api; - requires static io.helidon.config.metadata; - - requires transitive io.helidon.common; - requires transitive io.helidon.common.uri; - requires transitive io.helidon.common.socket; - requires transitive io.helidon.common.task; - requires transitive io.helidon.nima.webserver; - requires transitive io.helidon.common.http; - requires transitive io.helidon.nima.http2; - requires transitive io.helidon.nima.http.encoding; - requires transitive io.helidon.nima.http.media; - requires io.helidon.builder.api; - - exports io.helidon.nima.http2.webserver; - exports io.helidon.nima.http2.webserver.spi; - - // to support prior knowledge for h2c - provides ServerConnectionSelectorProvider - with io.helidon.nima.http2.webserver.Http2ConnectionProvider; - // to support upgrade requests for h2c - provides io.helidon.nima.webserver.http1.spi.Http1UpgradeProvider - with io.helidon.nima.http2.webserver.Http2UpgradeProvider; - provides io.helidon.nima.webserver.spi.ProtocolConfigProvider - with Http2ProtocolConfigProvider; - - uses io.helidon.nima.http2.webserver.spi.Http2SubProtocolProvider; -} diff --git a/nima/http2/webserver/src/test/java/io/helidon/nima/http2/webserver/ConnectionConfigTest.java b/nima/http2/webserver/src/test/java/io/helidon/nima/http2/webserver/ConnectionConfigTest.java deleted file mode 100644 index 214b8ef05fe..00000000000 --- a/nima/http2/webserver/src/test/java/io/helidon/nima/http2/webserver/ConnectionConfigTest.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.http2.webserver; - -import java.time.Duration; -import java.util.Map; - -import io.helidon.config.Config; -import io.helidon.nima.http2.Http2Setting; -import io.helidon.nima.webserver.ConnectionContext; -import io.helidon.nima.webserver.ListenerContext; -import io.helidon.nima.webserver.Router; -import io.helidon.nima.webserver.WebServer; - -import org.junit.jupiter.api.Test; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.hasKey; -import static org.junit.jupiter.api.Assertions.assertAll; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -class ConnectionConfigTest { - - // Verify that HTTP/2 connection provider is properly configured from config file - @Test - void testConnectionConfig() { - TestConnectionSelectorProvider.reset(); - // This will pick up application.yaml from the classpath as default configuration file - WebServer.builder().config(Config.create().get("server")).build(); - - Map http2Configs = TestConnectionSelectorProvider.config(); - assertThat(http2Configs, hasKey("@default")); - - Http2Config http2Config = http2Configs.get("@default"); - - assertAll( - () -> assertThat("maxFrameSize", http2Config.maxFrameSize(), is(8192)), - () -> assertThat("maxHeaderListSize", http2Config.maxHeaderListSize(), is(4096L)), - () -> assertThat("maxConcurrentStreams", http2Config.maxConcurrentStreams(), is(16384L)), - () -> assertThat("validatePath", http2Config.validatePath(), is(false)), - () -> assertThat("initialWindowSize", http2Config.initialWindowSize(), is(8192)), - () -> assertThat("flowControlTimeout", http2Config.flowControlTimeout(), is(Duration.ofMillis(700))) - ); - } - - // Verify that HTTP/2 connection provider is properly configured from builder - @Test - void testProviderConfigBuilder() { - - Http2ConnectionSelector selector = Http2ConnectionSelector.builder() - .http2Config(Http2Config.builder() - .name("@default") - .maxFrameSize(4096) - .maxHeaderListSize(2048L) - .build()) - .build(); - - Http2Connection conn = (Http2Connection) selector.connection(mockContext()); - // Verify values to be updated from configuration file - assertThat(conn.config().maxFrameSize(), is(4096)); - assertThat(conn.config().maxHeaderListSize(), is(2048L)); - // Verify Http2Settings values to be updated from configuration file - assertThat(conn.serverSettings().value(Http2Setting.MAX_FRAME_SIZE), is(4096L)); - assertThat(conn.serverSettings().value(Http2Setting.MAX_HEADER_LIST_SIZE), is(2048L)); - } - - private static ConnectionContext mockContext() { - ConnectionContext ctx = mock(ConnectionContext.class); - when(ctx.router()).thenReturn(Router.empty()); - when(ctx.listenerContext()).thenReturn(mock(ListenerContext.class)); - return ctx; - } -} diff --git a/nima/http2/webserver/src/test/java/io/helidon/nima/http2/webserver/TestConnectionSelectorProvider.java b/nima/http2/webserver/src/test/java/io/helidon/nima/http2/webserver/TestConnectionSelectorProvider.java deleted file mode 100644 index 14b01391a29..00000000000 --- a/nima/http2/webserver/src/test/java/io/helidon/nima/http2/webserver/TestConnectionSelectorProvider.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.http2.webserver; - -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import io.helidon.nima.webserver.ProtocolConfigs; -import io.helidon.nima.webserver.spi.ServerConnectionSelector; -import io.helidon.nima.webserver.spi.ServerConnectionSelectorProvider; - -import static org.mockito.Mockito.mock; - -// class must be public, as it is a service provider implementation -public class TestConnectionSelectorProvider implements ServerConnectionSelectorProvider { - private static final Map CONFIGS = new ConcurrentHashMap<>(); - - static Map config() { - return CONFIGS; - } - - static void reset() { - CONFIGS.clear(); - } - - @Override - public Class protocolConfigType() { - return Http2Config.class; - } - - @Override - public String protocolType() { - return "http_2"; - } - - @Override - public ServerConnectionSelector create(String socketName, Http2Config config, ProtocolConfigs configs) { - CONFIGS.put(socketName, config); - return mock(ServerConnectionSelector.class); - } - -} diff --git a/nima/http2/webserver/src/test/resources/META-INF/services/io.helidon.nima.webserver.spi.ServerConnectionSelectorProvider b/nima/http2/webserver/src/test/resources/META-INF/services/io.helidon.nima.webserver.spi.ServerConnectionSelectorProvider deleted file mode 100644 index 668a9388b05..00000000000 --- a/nima/http2/webserver/src/test/resources/META-INF/services/io.helidon.nima.webserver.spi.ServerConnectionSelectorProvider +++ /dev/null @@ -1,17 +0,0 @@ -# -# Copyright (c) 2023 Oracle and/or its affiliates. -# -# 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. -# - -io.helidon.nima.http2.webserver.TestConnectionSelectorProvider \ No newline at end of file diff --git a/nima/observe/config/pom.xml b/nima/observe/config/pom.xml deleted file mode 100644 index 9b9dbbb1499..00000000000 --- a/nima/observe/config/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.observe - helidon-nima-observe-project - 4.0.0-SNAPSHOT - - - helidon-nima-observe-config - Helidon Níma Observe Config - - - - - io.helidon.nima.observe - helidon-nima-observe - - - io.helidon.nima.webserver - helidon-nima-webserver - - - jakarta.json - jakarta.json-api - provided - - - io.helidon.nima.http.media - helidon-nima-http-media-jsonp - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - diff --git a/nima/observe/config/src/main/java/io/helidon/nima/observe/config/package-info.java b/nima/observe/config/src/main/java/io/helidon/nima/observe/config/package-info.java deleted file mode 100644 index 4450ef42a08..00000000000 --- a/nima/observe/config/src/main/java/io/helidon/nima/observe/config/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Config observability feature. - */ -package io.helidon.nima.observe.config; diff --git a/nima/observe/config/src/main/java/module-info.java b/nima/observe/config/src/main/java/module-info.java deleted file mode 100644 index c1e05278f61..00000000000 --- a/nima/observe/config/src/main/java/module-info.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.nima.observe.config.ConfigObserveProvider; -import io.helidon.nima.observe.spi.ObserveProvider; - -/** - * Observability features. - */ -module io.helidon.nima.observe.config { - requires transitive io.helidon.nima.observe; - requires io.helidon.nima.webserver; - requires io.helidon.nima.http.media.jsonp; - - exports io.helidon.nima.observe.config; - - provides ObserveProvider with ConfigObserveProvider; -} \ No newline at end of file diff --git a/nima/observe/health/etc/spotbugs/exclude.xml b/nima/observe/health/etc/spotbugs/exclude.xml deleted file mode 100644 index 0c27db8d4c0..00000000000 --- a/nima/observe/health/etc/spotbugs/exclude.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - diff --git a/nima/observe/health/pom.xml b/nima/observe/health/pom.xml deleted file mode 100644 index 658d4e9bcff..00000000000 --- a/nima/observe/health/pom.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.observe - helidon-nima-observe-project - 4.0.0-SNAPSHOT - - - helidon-nima-observe-health - Helidon Níma Observe Health - - - etc/spotbugs/exclude.xml - - - - - io.helidon.nima.observe - helidon-nima-observe - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.health - helidon-health - - - io.helidon.nima.service-common - helidon-nima-service-common - - - jakarta.json - jakarta.json-api - provided - - - io.helidon.nima.http.media - helidon-nima-http-media-jsonp - - - io.helidon.common.features - helidon-common-features-api - true - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - - - - - diff --git a/nima/observe/health/src/main/java/io/helidon/nima/observe/health/package-info.java b/nima/observe/health/src/main/java/io/helidon/nima/observe/health/package-info.java deleted file mode 100644 index 3d52b93c7ac..00000000000 --- a/nima/observe/health/src/main/java/io/helidon/nima/observe/health/package-info.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ -/** - * Health checks for Níma observability. - */ -package io.helidon.nima.observe.health; diff --git a/nima/observe/health/src/main/java/module-info.java b/nima/observe/health/src/main/java/module-info.java deleted file mode 100644 index ced456a2bc6..00000000000 --- a/nima/observe/health/src/main/java/module-info.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.common.features.api.Feature; -import io.helidon.common.features.api.HelidonFlavor; -import io.helidon.health.spi.HealthCheckProvider; -import io.helidon.nima.observe.health.HealthObserveProvider; -import io.helidon.nima.observe.spi.ObserveProvider; - -/** - * Health checks for Níma observability. - */ -@Feature(value = "Health", - description = "Health check support", - in = HelidonFlavor.SE) -module io.helidon.nima.observe.health { - requires java.management; - - requires transitive io.helidon.health; - requires transitive io.helidon.nima.observe; - requires io.helidon.nima.webserver; - requires io.helidon.nima.http.media.jsonp; - requires io.helidon.nima.servicecommon; - requires static io.helidon.common.features.api; - - exports io.helidon.nima.observe.health; - - provides ObserveProvider with HealthObserveProvider; - - uses HealthCheckProvider; -} \ No newline at end of file diff --git a/nima/observe/info/pom.xml b/nima/observe/info/pom.xml deleted file mode 100644 index f7a00323626..00000000000 --- a/nima/observe/info/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.observe - helidon-nima-observe-project - 4.0.0-SNAPSHOT - - - helidon-nima-observe-info - Helidon Níma Observe Info - Application information - - - - io.helidon.nima.observe - helidon-nima-observe - - - io.helidon.nima.webserver - helidon-nima-webserver - - - jakarta.json - jakarta.json-api - provided - - - io.helidon.nima.http.media - helidon-nima-http-media-jsonp - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - diff --git a/nima/observe/info/src/main/java/io/helidon/nima/observe/info/package-info.java b/nima/observe/info/src/main/java/io/helidon/nima/observe/info/package-info.java deleted file mode 100644 index a78b30e1592..00000000000 --- a/nima/observe/info/src/main/java/io/helidon/nima/observe/info/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Application information observability feature. - */ -package io.helidon.nima.observe.info; diff --git a/nima/observe/info/src/main/java/module-info.java b/nima/observe/info/src/main/java/module-info.java deleted file mode 100644 index 530df749fac..00000000000 --- a/nima/observe/info/src/main/java/module-info.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.nima.observe.info.InfoObserveProvider; -import io.helidon.nima.observe.spi.ObserveProvider; - -/** - * Observe info module. - * Info allows configuration of custom properties to be available to users. - * Info endpoint is unprotected by default and is available at {@code /observe/info} (configurable). - */ -module io.helidon.nima.observe.info { - requires io.helidon.config; - requires transitive io.helidon.nima.observe; - requires io.helidon.nima.webserver; - requires io.helidon.nima.http.media.jsonp; - - exports io.helidon.nima.observe.info; - - provides ObserveProvider with InfoObserveProvider; -} \ No newline at end of file diff --git a/nima/observe/log/etc/spotbugs/exclude.xml b/nima/observe/log/etc/spotbugs/exclude.xml deleted file mode 100644 index 910fcbc48f4..00000000000 --- a/nima/observe/log/etc/spotbugs/exclude.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - diff --git a/nima/observe/log/pom.xml b/nima/observe/log/pom.xml deleted file mode 100644 index b6302b9a157..00000000000 --- a/nima/observe/log/pom.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.observe - helidon-nima-observe-project - 4.0.0-SNAPSHOT - - - helidon-nima-observe-log - Helidon Níma Observe Log - Logging setup and log files - - - etc/spotbugs/exclude.xml - - - - - io.helidon.nima.observe - helidon-nima-observe - - - io.helidon.nima.webserver - helidon-nima-webserver - - - jakarta.json - jakarta.json-api - provided - - - io.helidon.nima.http.media - helidon-nima-http-media-jsonp - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - diff --git a/nima/observe/log/src/main/java/io/helidon/nima/observe/log/package-info.java b/nima/observe/log/src/main/java/io/helidon/nima/observe/log/package-info.java deleted file mode 100644 index 9ee5eb53cc8..00000000000 --- a/nima/observe/log/src/main/java/io/helidon/nima/observe/log/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Observe log module. - * Log observability allows reading and configuring of log levels of various loggers and reading log messages. - *

    - * Log endpoint is protected by default and is available at {@code /observe/log} (configurable). - */ -package io.helidon.nima.observe.log; diff --git a/nima/observe/log/src/main/java/module-info.java b/nima/observe/log/src/main/java/module-info.java deleted file mode 100644 index 61ee3256b6e..00000000000 --- a/nima/observe/log/src/main/java/module-info.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.nima.observe.log.LogObserveProvider; -import io.helidon.nima.observe.spi.ObserveProvider; - -/** - * Observe log module. - * Log observability allows reading and configuring of log levels of various loggers and reading log messages. - *

    - * Log endpoint is protected by default and is available at {@code /observe/log} (configurable). - */ -module io.helidon.nima.observe.log { - requires transitive io.helidon.nima.observe; - requires io.helidon.nima.webserver; - requires io.helidon.nima.http.media.jsonp; - requires java.logging; - - exports io.helidon.nima.observe.log; - - provides ObserveProvider with LogObserveProvider; -} \ No newline at end of file diff --git a/nima/observe/metrics/pom.xml b/nima/observe/metrics/pom.xml deleted file mode 100644 index f67259ff0ef..00000000000 --- a/nima/observe/metrics/pom.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - io.helidon.nima.observe - helidon-nima-observe-project - 4.0.0-SNAPSHOT - ../pom.xml - - 4.0.0 - - - helidon-nima-observe-metrics - Helidon Níma Observe Metrics - Integration of metrics with Níma webserver - - - - io.helidon.nima.observe - helidon-nima-observe - - - io.helidon.metrics - helidon-metrics-api - - - io.helidon.metrics - helidon-metrics-service-api - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.http.media - helidon-nima-http-media-jsonp - - - io.helidon.common - helidon-common-context - - - - - - - - - - - - - - - - - - - - - io.helidon.nima.service-common - helidon-nima-service-common - - - io.helidon.config - helidon-config-metadata - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - org.junit.jupiter - junit-jupiter-params - test - - - io.helidon.config - helidon-config-yaml - test - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - - - - - diff --git a/nima/observe/metrics/src/main/java/io/helidon/nima/observe/metrics/package-info.java b/nima/observe/metrics/src/main/java/io/helidon/nima/observe/metrics/package-info.java deleted file mode 100644 index df2863b34b1..00000000000 --- a/nima/observe/metrics/src/main/java/io/helidon/nima/observe/metrics/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Metrics endpoint for Níma WebServer. - */ -package io.helidon.nima.observe.metrics; diff --git a/nima/observe/metrics/src/main/java/module-info.java b/nima/observe/metrics/src/main/java/module-info.java deleted file mode 100644 index 494716a6bb1..00000000000 --- a/nima/observe/metrics/src/main/java/module-info.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2021, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.common.features.api.Feature; -import io.helidon.common.features.api.HelidonFlavor; - -/** - * Metrics endpoint for Níma WebServer. - */ -@Feature(value = "Metrics", - description = "Metrics support", - in = HelidonFlavor.SE) -module io.helidon.nima.observe.metrics { - requires transitive io.helidon.nima.observe; - requires io.helidon.nima.webserver; - requires io.helidon.nima.http.media.jsonp; - requires io.helidon.nima.servicecommon; - requires static io.helidon.config.metadata; - requires io.helidon.metrics.api; - requires io.helidon.metrics.serviceapi; - requires io.helidon.common.context; - requires io.helidon.common.features.api; - - exports io.helidon.nima.observe.metrics; - - provides io.helidon.nima.observe.spi.ObserveProvider with io.helidon.nima.observe.metrics.MetricsObserveProvider; -} \ No newline at end of file diff --git a/nima/observe/observe/pom.xml b/nima/observe/observe/pom.xml deleted file mode 100644 index 0961c914029..00000000000 --- a/nima/observe/observe/pom.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.observe - helidon-nima-observe-project - 4.0.0-SNAPSHOT - - - helidon-nima-observe - Helidon Níma Observe - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.webserver - helidon-nima-webserver-cors - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - diff --git a/nima/observe/observe/src/main/java/io/helidon/nima/observe/package-info.java b/nima/observe/observe/src/main/java/io/helidon/nima/observe/package-info.java deleted file mode 100644 index 61cb3e8a231..00000000000 --- a/nima/observe/observe/src/main/java/io/helidon/nima/observe/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Observability features and endpoint support. - */ -package io.helidon.nima.observe; diff --git a/nima/observe/observe/src/main/java/io/helidon/nima/observe/spi/package-info.java b/nima/observe/observe/src/main/java/io/helidon/nima/observe/spi/package-info.java deleted file mode 100644 index 567a152472a..00000000000 --- a/nima/observe/observe/src/main/java/io/helidon/nima/observe/spi/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Observability SPI. - */ -package io.helidon.nima.observe.spi; diff --git a/nima/observe/observe/src/main/java/module-info.java b/nima/observe/observe/src/main/java/module-info.java deleted file mode 100644 index f6d72d20a5d..00000000000 --- a/nima/observe/observe/src/main/java/module-info.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.nima.observe.spi.ObserveProvider; - -/** - * Observability features. - */ -module io.helidon.nima.observe { - requires transitive io.helidon.config; - requires transitive io.helidon.nima.webserver.cors; - requires io.helidon.common.http; - requires io.helidon.nima.webserver; - - exports io.helidon.nima.observe; - exports io.helidon.nima.observe.spi; - - uses ObserveProvider; -} \ No newline at end of file diff --git a/nima/observe/pom.xml b/nima/observe/pom.xml deleted file mode 100644 index 7e1a266630a..00000000000 --- a/nima/observe/pom.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima - helidon-nima-project - 4.0.0-SNAPSHOT - - - io.helidon.nima.observe - helidon-nima-observe-project - Helidon Níma Observe Project - pom - - - observe - health - config - info - metrics - log - - diff --git a/nima/openapi/etc/spotbugs/exclude.xml b/nima/openapi/etc/spotbugs/exclude.xml deleted file mode 100644 index 39fd88b1de3..00000000000 --- a/nima/openapi/etc/spotbugs/exclude.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/nima/openapi/pom.xml b/nima/openapi/pom.xml deleted file mode 100644 index 832c2417f39..00000000000 --- a/nima/openapi/pom.xml +++ /dev/null @@ -1,181 +0,0 @@ - - - - - - io.helidon.nima - helidon-nima-project - 4.0.0-SNAPSHOT - ../pom.xml - - 4.0.0 - - io.helidon.nima.openapi - helidon-nima-openapi - Helidon Nima OpenAPI - Integration of OpenAPI with Níma webserver - - - etc/spotbugs/exclude.xml - ${project.build.directory}/extracted-sources/openapi-interfaces - ${project.build.directory}/extracted-sources/openapi-impls - - - - - io.helidon.openapi - helidon-openapi - - - io.smallrye - smallrye-open-api-core - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.http.media - helidon-nima-http-media-jsonp - - - io.helidon.config - helidon-config-metadata - true - - - io.helidon.config - helidon-config-metadata-processor - true - - - io.helidon.common.features - helidon-common-features-api - true - - - io.helidon.config - helidon-config-yaml - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - io.helidon.nima.service-common - helidon-nima-service-common - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - - true - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - - - - - diff --git a/nima/openapi/src/main/java/io/helidon/nima/openapi/package-info.java b/nima/openapi/src/main/java/io/helidon/nima/openapi/package-info.java deleted file mode 100644 index abac9850346..00000000000 --- a/nima/openapi/src/main/java/io/helidon/nima/openapi/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2020, 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Open API integration with Níma WebServer. - */ -package io.helidon.nima.openapi; diff --git a/nima/openapi/src/main/java/module-info.java b/nima/openapi/src/main/java/module-info.java deleted file mode 100644 index b94beb168ce..00000000000 --- a/nima/openapi/src/main/java/module-info.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.common.features.api.Feature; -import io.helidon.common.features.api.HelidonFlavor; - - -/** - * Open API integration with Níma WebServer. - */ -@Feature(value = "OpenAPI", - description = "OpenAPI", - in = HelidonFlavor.NIMA, - invalidIn = HelidonFlavor.SE, - path = "OpenAPI" -) -module io.helidon.nima.openapi { - requires static io.helidon.common.features.api; - - requires io.helidon.common; - requires io.helidon.common.http; - requires io.helidon.config; - requires io.helidon.cors; - requires io.helidon.openapi; - - requires static io.helidon.config.metadata; - requires io.helidon.nima.webserver; - requires jakarta.json; - requires io.helidon.nima.webserver.cors; - - exports io.helidon.nima .openapi; -} \ No newline at end of file diff --git a/nima/pom.xml b/nima/pom.xml deleted file mode 100644 index d5910f70e16..00000000000 --- a/nima/pom.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - 4.0.0 - - - io.helidon - helidon-project - 4.0.0-SNAPSHOT - ../pom.xml - - - io.helidon.nima - helidon-nima-project - Helidon Níma Project - - pom - - - common - http - webclient - webserver - http2 - sse - websocket - grpc - observe - fault-tolerance - testing - service-common - graphql - - - - - tests - - tests - - - - diff --git a/nima/service-common/pom.xml b/nima/service-common/pom.xml deleted file mode 100644 index abd9f093519..00000000000 --- a/nima/service-common/pom.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - io.helidon.nima - helidon-nima-project - 4.0.0-SNAPSHOT - - 4.0.0 - - io.helidon.nima.service-common - helidon-nima-service-common - Helidon Níma Service Common - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.webserver - helidon-nima-webserver-cors - - - io.helidon.config - helidon-config-metadata - true - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - true - - - io.helidon.config - helidon-config-metadata-processor - ${helidon.version} - - - - - - - diff --git a/nima/service-common/src/main/java/io/helidon/nima/servicecommon/package-info.java b/nima/service-common/src/main/java/io/helidon/nima/servicecommon/package-info.java deleted file mode 100644 index 4e7bdb6c0e9..00000000000 --- a/nima/service-common/src/main/java/io/helidon/nima/servicecommon/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Support types for REST services. - */ -package io.helidon.nima.servicecommon; diff --git a/nima/service-common/src/main/java/module-info.java b/nima/service-common/src/main/java/module-info.java deleted file mode 100644 index f02b6da0912..00000000000 --- a/nima/service-common/src/main/java/module-info.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Support types for REST services. - */ -module io.helidon.nima.servicecommon { - requires transitive io.helidon.config; - requires static io.helidon.config.metadata; - requires transitive io.helidon.cors; - requires transitive io.helidon.nima.webserver; - requires transitive io.helidon.nima.webserver.cors; - - exports io.helidon.nima.servicecommon; - -} diff --git a/nima/sse/README.md b/nima/sse/README.md deleted file mode 100644 index 6c7c48bf1bf..00000000000 --- a/nima/sse/README.md +++ /dev/null @@ -1,5 +0,0 @@ -SSE ---- - -Server sent events implementation in Nima. - diff --git a/nima/sse/pom.xml b/nima/sse/pom.xml deleted file mode 100644 index d4fa1ec9efb..00000000000 --- a/nima/sse/pom.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - 4.0.0 - - - io.helidon.nima - helidon-nima-project - 4.0.0-SNAPSHOT - ../pom.xml - - - io.helidon.nima.sse - helidon-nima-sse-project - Helidon Níma SSE Project - - pom - - - sse - webclient - webserver - - - diff --git a/nima/sse/sse/pom.xml b/nima/sse/sse/pom.xml deleted file mode 100644 index 4252a0e16a4..00000000000 --- a/nima/sse/sse/pom.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.sse - helidon-nima-sse-project - 4.0.0-SNAPSHOT - - - helidon-nima-sse - Helidon Níma SSE - - - - io.helidon.common - helidon-common - - - io.helidon.common - helidon-common-media-type - - - io.helidon.nima.http.media - helidon-nima-http-media - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - org.mockito - mockito-core - test - - - \ No newline at end of file diff --git a/nima/sse/sse/src/main/java/io/helidon/nima/sse/package-info.java b/nima/sse/sse/src/main/java/io/helidon/nima/sse/package-info.java deleted file mode 100644 index c71eed213dc..00000000000 --- a/nima/sse/sse/src/main/java/io/helidon/nima/sse/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Nima SSE common package. Shares types between webclient and webserver modules. - */ -package io.helidon.nima.sse; diff --git a/nima/sse/sse/src/main/java/module-info.java b/nima/sse/sse/src/main/java/module-info.java deleted file mode 100644 index d3898d83919..00000000000 --- a/nima/sse/sse/src/main/java/module-info.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Nima SSE common package. Shares types between webclient and webserver modules. - */ -module io.helidon.nima.sse { - requires transitive io.helidon.common; - requires transitive io.helidon.common.media.type; - requires io.helidon.nima.http.media; - - exports io.helidon.nima.sse; -} diff --git a/nima/sse/webclient/pom.xml b/nima/sse/webclient/pom.xml deleted file mode 100644 index aa8907a4f61..00000000000 --- a/nima/sse/webclient/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.sse - helidon-nima-sse-project - 4.0.0-SNAPSHOT - - - helidon-nima-sse-webclient - Helidon Níma SSE WebClient - - - - io.helidon.common - helidon-common - - - io.helidon.common - helidon-common-media-type - - - io.helidon.nima.webclient - helidon-nima-webclient - - - io.helidon.nima.sse - helidon-nima-sse - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - org.mockito - mockito-core - test - - - diff --git a/nima/sse/webclient/src/main/java/io/helidon/nima/sse/webclient/package-info.java b/nima/sse/webclient/src/main/java/io/helidon/nima/sse/webclient/package-info.java deleted file mode 100644 index 7f52cefb39f..00000000000 --- a/nima/sse/webclient/src/main/java/io/helidon/nima/sse/webclient/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Nima SSE webclient package. - */ -package io.helidon.nima.sse.webclient; diff --git a/nima/sse/webclient/src/main/java/module-info.java b/nima/sse/webclient/src/main/java/module-info.java deleted file mode 100644 index bd38cc5025d..00000000000 --- a/nima/sse/webclient/src/main/java/module-info.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.nima.sse.webclient.SseSourceHandlerProvider; -import io.helidon.nima.webclient.spi.SourceHandlerProvider; - -/** - * Nima SSE webclient package. - */ -module io.helidon.nima.sse.webclient { - requires transitive io.helidon.common; - requires transitive io.helidon.common.media.type; - requires transitive io.helidon.nima.sse; - requires io.helidon.nima.webclient; - - provides SourceHandlerProvider with SseSourceHandlerProvider; - - exports io.helidon.nima.sse.webclient; -} diff --git a/nima/sse/webserver/pom.xml b/nima/sse/webserver/pom.xml deleted file mode 100644 index 4190945ad51..00000000000 --- a/nima/sse/webserver/pom.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.sse - helidon-nima-sse-project - 4.0.0-SNAPSHOT - - - helidon-nima-sse-webserver - Helidon Níma SSE WebServer - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.sse - helidon-nima-sse - - - io.helidon.common.features - helidon-common-features-api - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - org.mockito - mockito-core - test - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - io.helidon.builder - helidon-builder-processor - ${helidon.version} - - - io.helidon.config - helidon-config-metadata-processor - ${helidon.version} - - - io.helidon.common.processor - helidon-common-processor-helidon-copyright - ${helidon.version} - - - - - - io.helidon.builder - helidon-builder-processor - ${helidon.version} - - - io.helidon.config - helidon-config-metadata-processor - ${helidon.version} - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - io.helidon.common.processor - helidon-common-processor-helidon-copyright - ${helidon.version} - - - - - - diff --git a/nima/sse/webserver/src/main/java/io/helidon/nima/sse/webserver/package-info.java b/nima/sse/webserver/src/main/java/io/helidon/nima/sse/webserver/package-info.java deleted file mode 100644 index 7cc3aaac236..00000000000 --- a/nima/sse/webserver/src/main/java/io/helidon/nima/sse/webserver/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Nima SSE webserver. - */ -package io.helidon.nima.sse.webserver; diff --git a/nima/sse/webserver/src/main/java/module-info.java b/nima/sse/webserver/src/main/java/module-info.java deleted file mode 100644 index 92c3dbbdd59..00000000000 --- a/nima/sse/webserver/src/main/java/module-info.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.common.features.api.Feature; -import io.helidon.common.features.api.HelidonFlavor; -import io.helidon.nima.sse.webserver.SseSinkProvider; -import io.helidon.nima.webserver.http.spi.SinkProvider; - -/** - * Nima SSE WebServer. - */ -@Feature(value = "SSE", - description = "SSE WebServer", - in = HelidonFlavor.SE, - path = {"WebServer", "SSE"} -) -module io.helidon.nima.sse.webserver { - requires static io.helidon.common.features.api; - - requires transitive io.helidon.common; - requires transitive io.helidon.nima.webserver; - requires transitive io.helidon.nima.sse; - - exports io.helidon.nima.sse.webserver; - - provides SinkProvider with SseSinkProvider; -} diff --git a/nima/testing/junit5/http2/pom.xml b/nima/testing/junit5/http2/pom.xml deleted file mode 100644 index 10033be0df8..00000000000 --- a/nima/testing/junit5/http2/pom.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - 4.0.0 - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-project - 4.0.0-SNAPSHOT - ../pom.xml - - - helidon-nima-testing-junit5-http2 - Helidon Níma Testing JUnit5 HTTP/2 - - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - - - io.helidon.nima.http2 - helidon-nima-http2-webclient - - - io.helidon.nima.http2 - helidon-nima-http2-webserver - - - io.helidon.security.integration - helidon-security-integration-nima - - - org.junit.jupiter - junit-jupiter-api - - - org.hamcrest - hamcrest-all - provided - - - diff --git a/nima/testing/junit5/http2/src/main/java/io/helidon/nima/testing/junit5/http2/package-info.java b/nima/testing/junit5/http2/src/main/java/io/helidon/nima/testing/junit5/http2/package-info.java deleted file mode 100644 index bcbfe2d28cb..00000000000 --- a/nima/testing/junit5/http2/src/main/java/io/helidon/nima/testing/junit5/http2/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Unit and integration testing support for HTTP/2 and JUnit 5. - */ -package io.helidon.nima.testing.junit5.http2; diff --git a/nima/testing/junit5/http2/src/main/java/module-info.java b/nima/testing/junit5/http2/src/main/java/module-info.java deleted file mode 100644 index feafdfe8253..00000000000 --- a/nima/testing/junit5/http2/src/main/java/module-info.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Unit and integration testing support for Níma WebSocket and JUnit 5. - */ -module io.helidon.nima.testing.junit5.http2 { - requires transitive io.helidon.nima.testing.junit5.webserver; - requires io.helidon.nima.http2.webserver; - requires io.helidon.nima.http2.webclient; - - exports io.helidon.nima.testing.junit5.http2; - - provides io.helidon.nima.testing.junit5.webserver.spi.ServerJunitExtension - with io.helidon.nima.testing.junit5.http2.Http2ServerExtension; -} \ No newline at end of file diff --git a/nima/testing/junit5/pom.xml b/nima/testing/junit5/pom.xml deleted file mode 100644 index 40ea47548e5..00000000000 --- a/nima/testing/junit5/pom.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - 4.0.0 - - - io.helidon.nima.testing - helidon-nima-testing-project - 4.0.0-SNAPSHOT - ../pom.xml - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-project - Helidon Níma Testing JUnit5 Project - - pom - - - webserver - websocket - http2 - - - diff --git a/nima/testing/junit5/webserver/etc/spotbugs/exclude.xml b/nima/testing/junit5/webserver/etc/spotbugs/exclude.xml deleted file mode 100644 index e15955c2a6e..00000000000 --- a/nima/testing/junit5/webserver/etc/spotbugs/exclude.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - diff --git a/nima/testing/junit5/webserver/pom.xml b/nima/testing/junit5/webserver/pom.xml deleted file mode 100644 index 619b7ba01c9..00000000000 --- a/nima/testing/junit5/webserver/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - 4.0.0 - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-project - 4.0.0-SNAPSHOT - ../pom.xml - - - helidon-nima-testing-junit5-webserver - Helidon Níma Testing JUnit5 WebServer - - - etc/spotbugs/exclude.xml - - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.webclient - helidon-nima-webclient - - - io.helidon.common.testing - helidon-common-testing-http-junit5 - - - io.helidon.config - helidon-config-yaml - - - org.junit.jupiter - junit-jupiter-api - - - org.hamcrest - hamcrest-all - - - diff --git a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/RoutingTest.java b/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/RoutingTest.java deleted file mode 100644 index d867096cc1a..00000000000 --- a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/RoutingTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.testing.junit5.webserver; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.junit.jupiter.api.extension.ExtendWith; - -/** - * Test of router without opening a socket. - * Can be used together with: - *

      - *
    • {@link io.helidon.nima.testing.junit5.webserver.SetUpRoute}
    • - *
    - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -@ExtendWith(HelidonRoutingJunitExtension.class) -@Inherited -public @interface RoutingTest { -} diff --git a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/package-info.java b/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/package-info.java deleted file mode 100644 index d93c6664b54..00000000000 --- a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Unit and integration testing support for Níma WebServer and JUnit 5. - * - * @see io.helidon.nima.testing.junit5.webserver.ServerTest - * @see io.helidon.nima.testing.junit5.webserver.RoutingTest - */ -package io.helidon.nima.testing.junit5.webserver; diff --git a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/spi/package-info.java b/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/spi/package-info.java deleted file mode 100644 index ac889ff895f..00000000000 --- a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/spi/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * SPI for JUnit5 support to add support for additional types (such as WebSocket clients, grpc clients etc.). - * - * @see io.helidon.nima.testing.junit5.webserver.spi.DirectJunitExtension - * @see io.helidon.nima.testing.junit5.webserver.spi.ServerJunitExtension - */ -package io.helidon.nima.testing.junit5.webserver.spi; diff --git a/nima/testing/junit5/webserver/src/main/java/module-info.java b/nima/testing/junit5/webserver/src/main/java/module-info.java deleted file mode 100644 index 7e7b62b7a1e..00000000000 --- a/nima/testing/junit5/webserver/src/main/java/module-info.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Unit and integration testing support for Níma WebServer and JUnit 5. - * - * @see io.helidon.nima.testing.junit5.webserver.ServerTest - * @see io.helidon.nima.testing.junit5.webserver.RoutingTest - */ -module io.helidon.nima.testing.junit5.webserver { - requires transitive io.helidon.common.testing.http.junit5; - requires transitive io.helidon.nima.webserver; - requires transitive io.helidon.nima.webclient; - requires io.helidon.logging.common; - - requires transitive org.junit.jupiter.api; - requires transitive hamcrest.all; - - - exports io.helidon.nima.testing.junit5.webserver; - exports io.helidon.nima.testing.junit5.webserver.spi; - - uses io.helidon.nima.testing.junit5.webserver.spi.ServerJunitExtension; - uses io.helidon.nima.testing.junit5.webserver.spi.DirectJunitExtension; - - provides io.helidon.nima.testing.junit5.webserver.spi.ServerJunitExtension - with io.helidon.nima.testing.junit5.webserver.Http1ServerJunitExtension; - - provides io.helidon.nima.testing.junit5.webserver.spi.DirectJunitExtension - with io.helidon.nima.testing.junit5.webserver.Http1DirectJunitExtension; - - opens io.helidon.nima.testing.junit5.webserver to org.junit.platform.commons; -} \ No newline at end of file diff --git a/nima/testing/junit5/websocket/pom.xml b/nima/testing/junit5/websocket/pom.xml deleted file mode 100644 index bf3a69b77a3..00000000000 --- a/nima/testing/junit5/websocket/pom.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - 4.0.0 - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-project - 4.0.0-SNAPSHOT - ../pom.xml - - - helidon-nima-testing-junit5-websocket - Helidon Níma Testing JUnit5 WebSocket - - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - - - io.helidon.nima.websocket - helidon-nima-websocket-client - - - io.helidon.nima.websocket - helidon-nima-websocket-webserver - - - org.junit.jupiter - junit-jupiter-api - - - org.hamcrest - hamcrest-all - provided - - - diff --git a/nima/testing/junit5/websocket/src/main/java/io/helidon/nima/testing/junit5/websocket/package-info.java b/nima/testing/junit5/websocket/src/main/java/io/helidon/nima/testing/junit5/websocket/package-info.java deleted file mode 100644 index a5c7d57ffa1..00000000000 --- a/nima/testing/junit5/websocket/src/main/java/io/helidon/nima/testing/junit5/websocket/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Unit and integration testing support for Níma WebSocket and JUnit 5. - */ -package io.helidon.nima.testing.junit5.websocket; diff --git a/nima/testing/junit5/websocket/src/main/java/module-info.java b/nima/testing/junit5/websocket/src/main/java/module-info.java deleted file mode 100644 index 9bb326371e1..00000000000 --- a/nima/testing/junit5/websocket/src/main/java/module-info.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.nima.testing.junit5.websocket.WsDirectExtension; -import io.helidon.nima.testing.junit5.websocket.WsServerExtension; - -/** - * Unit and integration testing support for Níma WebSocket and JUnit 5. - */ -module io.helidon.nima.testing.junit5.websocket { - requires transitive io.helidon.nima.testing.junit5.webserver; - requires io.helidon.nima.websocket.webserver; - requires io.helidon.nima.websocket.client; - - exports io.helidon.nima.testing.junit5.websocket; - - provides io.helidon.nima.testing.junit5.webserver.spi.ServerJunitExtension - with WsServerExtension; - - provides io.helidon.nima.testing.junit5.webserver.spi.DirectJunitExtension - with WsDirectExtension; -} \ No newline at end of file diff --git a/nima/testing/pom.xml b/nima/testing/pom.xml deleted file mode 100644 index 6c33dcdd91f..00000000000 --- a/nima/testing/pom.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - 4.0.0 - - - io.helidon.nima - helidon-nima-project - 4.0.0-SNAPSHOT - ../pom.xml - - - io.helidon.nima.testing - helidon-nima-testing-project - Helidon Níma Testing Project - - pom - - - junit5 - - - diff --git a/nima/tests/benchmark/jmh/README.md b/nima/tests/benchmark/jmh/README.md deleted file mode 100644 index beb2b9fe8c0..00000000000 --- a/nima/tests/benchmark/jmh/README.md +++ /dev/null @@ -1,34 +0,0 @@ -Benchmarks ---- - -# JMH - -JMH tests are being executed with maven profile `mvn clean install -Pjmh`, baseline result is created if -file `benchmarks/jmh/jmh-baseline.json` doesn't exist. Baseline is used for current result comparison, if regression larger than -error margin(15% by default) -is detected, build fails. - -```shell -[ERROR] Failures: -[ERROR] JunitJMHRunnerTest.renderResult:69 -==================== HttpJMH.http2 (-31.41%) - Baseline ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ 44877.472 ops/s - Current ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ 30781.420 ops/s -HttpJMH.http2 regression detected. Error margin 10%(3078.14) -Expected: a value equal to or greater than <44877.471663551245> - but: <33859.562325823645> was less than <44877.471663551245> -[INFO] -[ERROR] Tests run: 2, Failures: 1, Errors: 0, Skipped: 0 -``` - -## Adding JMH tests - -New JMH tests classes should be created in `benchmarks/jmh/src/main/java/io/helidon/tests/benchmark/jmh/` -with simple name ending with `JMHTest`. - -## Troubleshooting - -When tests fails repeatedly without any code change, try regenerating baseline file -with `mvn clean install -Pjmh -Dnima.jmh.resetBaseline=true`. If that doesn't help, you can also set different error margin (in -percents) with -`mvn clean install -Pjmh -Dnima.jmh.errorMargin=15`. \ No newline at end of file diff --git a/nima/tests/benchmark/jmh/pom.xml b/nima/tests/benchmark/jmh/pom.xml deleted file mode 100644 index 8d75776ac63..00000000000 --- a/nima/tests/benchmark/jmh/pom.xml +++ /dev/null @@ -1,106 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests.benchmark - helidon-nima-tests-benchmark-project - 4.0.0-SNAPSHOT - - - helidon-nima-tests-benchmark-jmh - Helidon Níma Tests Benchmarks JMH Benchmarks - - - true - - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.http2 - helidon-nima-http2-webserver - - - org.openjdk.jmh - jmh-core - - - org.openjdk.jmh - jmh-generator-annprocess - - - org.eclipse.parsson - parsson - runtime - - - org.junit.jupiter - junit-jupiter-api - test - - - org.junit.jupiter - junit-jupiter-params - test - - - org.hamcrest - hamcrest-all - test - - - org.eclipse - yasson - test - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - true - - - - - - - - jmh - - - - org.apache.maven.plugins - maven-surefire-plugin - - false - - - - - - - diff --git a/nima/tests/benchmark/jmh/src/main/resources/logging.properties b/nima/tests/benchmark/jmh/src/main/resources/logging.properties deleted file mode 100644 index fa598923176..00000000000 --- a/nima/tests/benchmark/jmh/src/main/resources/logging.properties +++ /dev/null @@ -1,20 +0,0 @@ -# -# Copyright (c) 2022 Oracle and/or its affiliates. -# -# 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. -# -handlers=java.util.logging.ConsoleHandler -java.util.logging.ConsoleHandler.level=INFO -java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter -java.util.logging.SimpleFormatter.format=%1$tH:%1$tM:%1$tS %5$s%6$s%n -.level=SEVERE diff --git a/nima/tests/benchmark/pom.xml b/nima/tests/benchmark/pom.xml deleted file mode 100644 index 0c541ebd324..00000000000 --- a/nima/tests/benchmark/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests - helidon-nima-tests-project - 4.0.0-SNAPSHOT - - - io.helidon.nima.tests.benchmark - helidon-nima-tests-benchmark-project - Helidon Níma Tests Benchmark Project - pom - - - jmh - - diff --git a/nima/tests/integration/encoding/deflate/pom.xml b/nima/tests/integration/encoding/deflate/pom.xml deleted file mode 100644 index 54dda3b1709..00000000000 --- a/nima/tests/integration/encoding/deflate/pom.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests.integration.encoding - helidon-nima-tests-integration-encoding-project - 4.0.0-SNAPSHOT - - - helidon-nima-tests-integration-encoding-deflate - Helidon Níma Tests Integration Encoding deflate - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.http2 - helidon-nima-http2-webserver - - - io.helidon.nima.http.encoding - helidon-nima-http-encoding-deflate - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-http2 - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - diff --git a/nima/tests/integration/encoding/gzip/pom.xml b/nima/tests/integration/encoding/gzip/pom.xml deleted file mode 100644 index 8cd21905bb2..00000000000 --- a/nima/tests/integration/encoding/gzip/pom.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests.integration.encoding - helidon-nima-tests-integration-encoding-project - 4.0.0-SNAPSHOT - - - helidon-nima-tests-integration-encoding-gzip - Helidon Níma Tests Integration Encoding GZIP - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.http2 - helidon-nima-http2-webserver - - - io.helidon.nima.http.encoding - helidon-nima-http-encoding-gzip - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-http2 - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - diff --git a/nima/tests/integration/encoding/pom.xml b/nima/tests/integration/encoding/pom.xml deleted file mode 100644 index 134b9cfb27b..00000000000 --- a/nima/tests/integration/encoding/pom.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests.integration - helidon-nima-tests-integration-project - 4.0.0-SNAPSHOT - - - io.helidon.nima.tests.integration.encoding - helidon-nima-tests-integration-encoding-project - Helidon Níma Tests Integration Encoding Project - pom - - - gzip - deflate - - diff --git a/nima/tests/integration/grpc/pom.xml b/nima/tests/integration/grpc/pom.xml deleted file mode 100644 index 0d58ec19b48..00000000000 --- a/nima/tests/integration/grpc/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests.integration - helidon-nima-tests-integration-project - 4.0.0-SNAPSHOT - - - io.helidon.nima.tests.integration.grpc - helidon-nima-tests-integration-grpc-project - Helidon Níma Tests Integration grpc Project - pom - - - server - - diff --git a/nima/tests/integration/grpc/server/pom.xml b/nima/tests/integration/grpc/server/pom.xml deleted file mode 100644 index fd740a9243f..00000000000 --- a/nima/tests/integration/grpc/server/pom.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests.integration.grpc - helidon-nima-tests-integration-grpc-project - 4.0.0-SNAPSHOT - - - helidon-nima-tests-integration-grpc-webserver - Helidon Níma Tests Integration grpc WebServer - - - - io.helidon.nima.grpc - helidon-nima-grpc-webserver - - - com.google.protobuf - protobuf-java - - - - - javax.annotation - javax.annotation-api - 1.3.2 - true - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - io.grpc - grpc-netty - test - - - - - - - kr.motd.maven - os-maven-plugin - ${version.plugin.os} - - - - - org.xolstice.maven.plugins - protobuf-maven-plugin - - - - compile - compile-custom - - - - - com.google.protobuf:protoc:3.5.1-1:exe:${os.detected.classifier} - grpc-java - io.grpc:protoc-gen-grpc-java:${version.lib.grpc}:exe:${os.detected.classifier} - - - - - - diff --git a/nima/tests/integration/grpc/server/src/main/proto/events.proto b/nima/tests/integration/grpc/server/src/main/proto/events.proto deleted file mode 100644 index 1b44447608f..00000000000 --- a/nima/tests/integration/grpc/server/src/main/proto/events.proto +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * 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. - */ - - -syntax = "proto3"; -option java_package = "io.helidon.nima.grpc.events"; - -import "google/protobuf/empty.proto"; - -service EventService { - rpc Send (Message) returns (google.protobuf.Empty) {} - rpc Events (stream EventRequest) returns (stream EventResponse) {} -} - -message Message { - string text = 2; -} - -message EventRequest { - int64 id = 1; - enum Action { - SUBSCRIBE = 0; - UNSUBSCRIBE = 1; - } - Action action = 2; -} - -message EventResponse { - oneof response_type { - Subscribed subscribed = 1; - Unsubscribed unsubscribed = 2; - Event event = 3; - } -} - -message Subscribed { - int64 id = 1; -} - -message Unsubscribed { - int64 id = 1; -} - -message Event { - int64 id = 1; - string text = 2; -} diff --git a/nima/tests/integration/grpc/server/src/main/proto/strings.proto b/nima/tests/integration/grpc/server/src/main/proto/strings.proto deleted file mode 100644 index 72209025488..00000000000 --- a/nima/tests/integration/grpc/server/src/main/proto/strings.proto +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2021 Oracle and/or its affiliates. - * - * 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. - */ - - -syntax = "proto3"; -option java_package = "io.helidon.nima.grpc.strings"; - -service StringService { - rpc Upper (StringMessage) returns (StringMessage) {} - rpc Lower (StringMessage) returns (StringMessage) {} - rpc Split (StringMessage) returns (stream StringMessage) {} - rpc Join (stream StringMessage) returns (StringMessage) {} - rpc Echo (stream StringMessage) returns (stream StringMessage) {} -} - -message StringMessage { - string text = 1; -} diff --git a/nima/tests/integration/grpc/server/src/test/java/io/helidon/nima/tests/integration/grpc/webserver/BindableGrpcServiceTest.java b/nima/tests/integration/grpc/server/src/test/java/io/helidon/nima/tests/integration/grpc/webserver/BindableGrpcServiceTest.java deleted file mode 100644 index 52136f162bc..00000000000 --- a/nima/tests/integration/grpc/server/src/test/java/io/helidon/nima/tests/integration/grpc/webserver/BindableGrpcServiceTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.tests.integration.grpc.webserver; - -import io.helidon.nima.grpc.strings.Strings; -import io.helidon.nima.grpc.webserver.GrpcRouting; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webserver.Router; -import io.helidon.nima.webserver.WebServer; - -@ServerTest -class BindableGrpcServiceTest - extends BaseStringServiceTest { - BindableGrpcServiceTest(WebServer server) { - super(server); - } - - @SetUpRoute - static void routing(Router.RouterBuilder router) { - router.addRouting(GrpcRouting.builder().service(Strings.getDescriptor(), new BindableStringService())); - } -} \ No newline at end of file diff --git a/nima/tests/integration/grpc/server/src/test/java/io/helidon/nima/tests/integration/grpc/webserver/StringServiceTest.java b/nima/tests/integration/grpc/server/src/test/java/io/helidon/nima/tests/integration/grpc/webserver/StringServiceTest.java deleted file mode 100644 index 77198654f11..00000000000 --- a/nima/tests/integration/grpc/server/src/test/java/io/helidon/nima/tests/integration/grpc/webserver/StringServiceTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.tests.integration.grpc.webserver; - -import io.helidon.nima.grpc.webserver.GrpcRouting; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webserver.Router; -import io.helidon.nima.webserver.WebServer; - -@ServerTest -class StringServiceTest - extends BaseStringServiceTest { - StringServiceTest(WebServer server) { - super(server); - } - - @SetUpRoute - static void routing(Router.RouterBuilder router) { - router.addRouting(GrpcRouting.builder().service(new StringService())); - } -} diff --git a/nima/tests/integration/grpc/server/src/test/resources/logging.properties b/nima/tests/integration/grpc/server/src/test/resources/logging.properties deleted file mode 100644 index 86065c7277f..00000000000 --- a/nima/tests/integration/grpc/server/src/test/resources/logging.properties +++ /dev/null @@ -1,21 +0,0 @@ -# -# Copyright (c) 2022 Oracle and/or its affiliates. -# -# 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. -# -handlers=io.helidon.logging.jul.HelidonConsoleHandler -java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS.%1$tL %5$s%6$s%n -# Global logging level. Can be overridden by specific loggers -.level=INFO - -# io.helidon.nima.level=FINEST diff --git a/nima/tests/integration/http2/client/pom.xml b/nima/tests/integration/http2/client/pom.xml deleted file mode 100644 index 13302101d9f..00000000000 --- a/nima/tests/integration/http2/client/pom.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests.integration.http2 - helidon-nima-tests-integration-http2-project - 4.0.0-SNAPSHOT - - - helidon-nima-tests-integration-http2-client - Helidon Níma Tests Integration HTTP/2 Client - - - - io.helidon.nima.http2 - helidon-nima-http2-webserver - - - io.helidon.nima.http2 - helidon-nima-http2-webclient - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - io.vertx - vertx-core - test - - - diff --git a/nima/tests/integration/http2/client/src/main/resources/logging.properties b/nima/tests/integration/http2/client/src/main/resources/logging.properties deleted file mode 100644 index 3a2ccac5c46..00000000000 --- a/nima/tests/integration/http2/client/src/main/resources/logging.properties +++ /dev/null @@ -1,20 +0,0 @@ -# -# Copyright (c) 2022 Oracle and/or its affiliates. -# -# 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. -# -handlers=java.util.logging.ConsoleHandler -java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS.%1$tL %5$s%6$s%n -# Global logging level. Can be overridden by specific loggers -.level=INFO -io.helidon.nima.level=INFO diff --git a/nima/tests/integration/http2/client/src/test/java/io/helidon/nima/tests/integration/http2/client/GetTest.java b/nima/tests/integration/http2/client/src/test/java/io/helidon/nima/tests/integration/http2/client/GetTest.java deleted file mode 100644 index 70ac77a068e..00000000000 --- a/nima/tests/integration/http2/client/src/test/java/io/helidon/nima/tests/integration/http2/client/GetTest.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.tests.integration.http2.client; - -import java.io.IOException; -import java.io.OutputStream; -import java.io.UncheckedIOException; -import java.net.URI; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.time.Duration; -import java.util.Optional; -import java.util.OptionalLong; -import java.util.Random; - -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderName; -import io.helidon.common.http.Http.HeaderNames; -import io.helidon.nima.http2.webserver.Http2Route; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webserver.http.Handler; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; - -import org.junit.jupiter.api.Test; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; - -@ServerTest -class GetTest { - private static final byte[] BYTES = new byte[256]; - private static final String REQUEST_HEADER_NAME_STRING = "X-REquEst-HEADeR"; - private static final String REQUEST_HEADER_VALUE_STRING = "some nice value"; - private static final String RESPONSE_HEADER_NAME_STRING = "X-REsponSE-HeADER"; - private static final String RESPONSE_HEADER_VALUE_STRING = "another nice value"; - private static final HeaderName REQUEST_HEADER_NAME = Http.HeaderNames.create(REQUEST_HEADER_NAME_STRING); - private static final HeaderName RESPONSE_HEADER_NAME = HeaderNames.create(RESPONSE_HEADER_NAME_STRING); - private static final Http.Header RESPONSE_HEADER_VALUE = Http.Headers.createCached(RESPONSE_HEADER_NAME, - RESPONSE_HEADER_VALUE_STRING); - - static { - Random random = new Random(); - random.nextBytes(BYTES); - } - - private final HttpClient httpClient; - private final URI uri; - - public GetTest(URI uri) { - this.httpClient = HttpClient.newBuilder() - .version(HttpClient.Version.HTTP_2) - .connectTimeout(Duration.ofSeconds(10)) - .build(); - this.uri = uri; - } - - @SetUpRoute - static void routing(HttpRouting.Builder router) { - // enforce http/2 so we know if upgrade failed - router.route(Http2Route.route(Http.Method.GET, "/string", Handler.create(Routes::string))) - .route(Http.Method.GET, "/bytes", Routes::bytes) - .route(Http.Method.GET, "/chunked", Routes::chunked) - .route(Http.Method.GET, "/headers", Routes::headers); - } - - @Test - void testStringRoute() throws IOException, InterruptedException { - HttpRequest request = HttpRequest.newBuilder() - .GET() - .uri(uri.resolve("/string")) - .build(); - HttpResponse response = httpClient.send(request, HttpResponse.BodyHandlers.ofString()); - - assertThat(response.statusCode(), is(Http.Status.OK_200.code())); - assertThat(response.body(), is("Hello")); - - java.net.http.HttpHeaders headers = response.headers(); - assertThat(headers.firstValueAsLong(HeaderNames.CONTENT_LENGTH.defaultCase()), - is(OptionalLong.of(5))); - } - - @Test - void testByteRoute() throws IOException, InterruptedException { - HttpRequest request = HttpRequest.newBuilder() - .GET() - .uri(uri.resolve("/bytes")) - .build(); - HttpResponse response = httpClient.send(request, HttpResponse.BodyHandlers.ofByteArray()); - - assertThat(response.statusCode(), is(Http.Status.OK_200.code())); - assertThat(response.body(), is(BYTES)); - java.net.http.HttpHeaders headers = response.headers(); - assertThat(headers.firstValueAsLong(HeaderNames.CONTENT_LENGTH.defaultCase()), - is(OptionalLong.of(BYTES.length))); - } - - @Test - void testChunkedRoute() throws IOException, InterruptedException { - HttpRequest request = HttpRequest.newBuilder() - .GET() - .uri(uri.resolve("/chunked")) - .timeout(Duration.ofSeconds(5)) - .build(); - HttpResponse response = httpClient.send(request, HttpResponse.BodyHandlers.ofByteArray()); - - assertThat(response.statusCode(), is(Http.Status.OK_200.code())); - assertThat(response.body(), is(BYTES)); - java.net.http.HttpHeaders headers = response.headers(); - assertThat(headers.firstValueAsLong(HeaderNames.CONTENT_LENGTH.defaultCase()), - is(OptionalLong.of(BYTES.length))); - } - - @Test - void testHeadersRoute() throws IOException, InterruptedException { - HttpRequest request = HttpRequest.newBuilder() - .GET() - .uri(uri.resolve("/headers")) - .header(REQUEST_HEADER_NAME_STRING, REQUEST_HEADER_VALUE_STRING) - .build(); - - HttpResponse response = httpClient.send(request, HttpResponse.BodyHandlers.ofString()); - - assertThat(response.statusCode(), is(Http.Status.OK_200.code())); - assertThat(response.body(), is("Hello")); - - java.net.http.HttpHeaders headers = response.headers(); - assertThat(headers.firstValueAsLong(Http.HeaderNames.CONTENT_LENGTH.defaultCase()), - is(OptionalLong.of(5))); - assertThat("Should contain echoed request header", - headers.firstValue(REQUEST_HEADER_NAME_STRING), is(Optional.of(REQUEST_HEADER_VALUE_STRING))); - assertThat("Should contain response header", - headers.firstValue(RESPONSE_HEADER_NAME_STRING), is(Optional.of(RESPONSE_HEADER_VALUE_STRING))); - } - - private static class Routes { - private static String string() { - return "Hello"; - } - - private static byte[] bytes() { - return BYTES; - } - - private static void chunked(ServerRequest req, ServerResponse res) { - try (OutputStream outputStream = res.outputStream()) { - outputStream.write(BYTES); - } catch (IOException e) { - throw new UncheckedIOException(e); - } - } - - private static void headers(ServerRequest req, ServerResponse res) { - res.header(req.headers().get(REQUEST_HEADER_NAME)); - res.header(RESPONSE_HEADER_VALUE); - res.send("Hello"); - } - } - -} diff --git a/nima/tests/integration/http2/client/src/test/java/io/helidon/nima/tests/integration/http2/client/HeadersTest.java b/nima/tests/integration/http2/client/src/test/java/io/helidon/nima/tests/integration/http2/client/HeadersTest.java deleted file mode 100644 index 3ff80b74e4c..00000000000 --- a/nima/tests/integration/http2/client/src/test/java/io/helidon/nima/tests/integration/http2/client/HeadersTest.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.tests.integration.http2.client; - -import java.time.Duration; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeoutException; - -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; -import io.helidon.logging.common.LogConfig; -import io.helidon.nima.http2.webclient.Http2Client; -import io.helidon.nima.http2.webclient.Http2ClientResponse; - -import io.vertx.core.MultiMap; -import io.vertx.core.Vertx; -import io.vertx.core.http.Http2Settings; -import io.vertx.core.http.HttpServer; -import io.vertx.core.http.HttpServerOptions; -import io.vertx.core.http.HttpServerResponse; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; - -import static java.util.concurrent.TimeUnit.MILLISECONDS; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.is; - -class HeadersTest { - - private static final Duration TIMEOUT = Duration.ofSeconds(10); - private static final String DATA = "Helidon!!!".repeat(10); - private static final Vertx vertx = Vertx.vertx(); - private static final ExecutorService exec = Executors.newVirtualThreadPerTaskExecutor(); - private static HttpServer server; - private static int port; - - @BeforeAll - static void beforeAll() throws ExecutionException, InterruptedException, TimeoutException { - LogConfig.configureRuntime(); - server = vertx.createHttpServer(new HttpServerOptions() - .setInitialSettings(new Http2Settings() - .setMaxHeaderListSize(Integer.MAX_VALUE) - ) - ) - .requestHandler(req -> { - HttpServerResponse res = req.response(); - switch (req.path()) { - case "/trailer" -> { - res.putHeader("test", "before"); - res.write(DATA); - res.putTrailer("Trailer-header", "trailer-test"); - res.end(); - } - case "/cont-in" -> { - for (int i = 0; i < 500; i++) { - res.headers().add("test-header-" + i, DATA); - } - res.write(DATA); - res.end(); - } - case "/cont-out" -> { - MultiMap headers = req.headers(); - StringBuilder sb = new StringBuilder(); - for (Map.Entry header : headers) { - if (!header.getKey().startsWith("test-header-")) continue; - sb.append(header.getKey() + "=" + header.getValue() + "\n"); - } - - res.write(sb.toString()); - res.end(); - } - default -> res.setStatusCode(404).end(); - } - }) - .listen(0) - .toCompletionStage() - .toCompletableFuture() - .get(TIMEOUT.toMillis(), MILLISECONDS); - - port = server.actualPort(); - } - - @AfterAll - static void afterAll() { - server.close(); - vertx.close(); - exec.shutdown(); - try { - if (!exec.awaitTermination(TIMEOUT.toMillis(), MILLISECONDS)) { - exec.shutdownNow(); - } - } catch (InterruptedException e) { - exec.shutdownNow(); - } - } - - @Test - //FIXME: #6544 trailer headers are not implemented yet - @Disabled - void trailerHeader() { - try (Http2ClientResponse res = Http2Client.builder() - .baseUri("http://localhost:" + port + "/") - .build() - .method(Http.Method.GET) - .path("/trailer") - .priorKnowledge(true) - .request()) { - Headers h = res.headers(); - assertThat(h.first(Http.HeaderNames.create("test")).orElse(null), is("before")); - assertThat(res.as(String.class), is(DATA)); - assertThat(h.first(Http.HeaderNames.create("Trailer-header")).orElse(null), is("trailer-test")); - } - } - - @Test - void continuationInbound() { - try (Http2ClientResponse res = Http2Client.builder() - .baseUri("http://localhost:" + port + "/") - .build() - .method(Http.Method.GET) - .path("/cont-in") - .priorKnowledge(true) - .request()) { - - Headers h = res.headers(); - for (int i = 0; i < 500; i++) { - String name = "test-header-" + i; - assertThat("Headers " + name, h.first(Http.HeaderNames.create(name)).orElse(null), is(DATA)); - } - - assertThat(res.as(String.class), is(DATA)); - } - } - - @Test - void continuationOutbound() { - Set expected = new HashSet<>(500); - try (Http2ClientResponse res = Http2Client.builder() - .baseUri("http://localhost:" + port + "/") - .build() - .method(Http.Method.GET) - .path("/cont-out") - .priorKnowledge(true) - .headers(hv -> { - for (int i = 0; i < 500; i++) { - hv.add(Http.Headers.createCached("test-header-" + i, DATA + i)); - expected.add("test-header-" + i + "=" + DATA + i); - } - }) - .request()) { - String actual = res.as(String.class); - assertThat(List.of(actual.split("\\n")), containsInAnyOrder(expected.toArray(new String[0]))); - } - } - - @Test - void continuationOutboundPost() { - Set expected = new HashSet<>(500); - try (Http2ClientResponse res = Http2Client.builder() - .baseUri("http://localhost:" + port + "/") - .build() - .method(Http.Method.POST) - .path("/cont-out") - .priorKnowledge(true) - .headers(hv -> { - for (int i = 0; i < 500; i++) { - hv.add(Http.Headers.createCached("test-header-" + i, DATA + i)); - expected.add("test-header-" + i + "=" + DATA + i); - } - }) - .submit(DATA)) { - String actual = res.as(String.class); - assertThat(List.of(actual.split("\\n")), containsInAnyOrder(expected.toArray(new String[0]))); - } - } -} diff --git a/nima/tests/integration/http2/client/src/test/java/io/helidon/nima/tests/integration/http2/client/PostTest.java b/nima/tests/integration/http2/client/src/test/java/io/helidon/nima/tests/integration/http2/client/PostTest.java deleted file mode 100644 index 980cf889f51..00000000000 --- a/nima/tests/integration/http2/client/src/test/java/io/helidon/nima/tests/integration/http2/client/PostTest.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.tests.integration.http2.client; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.UncheckedIOException; -import java.util.OptionalLong; -import java.util.Random; - -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderName; -import io.helidon.common.http.Http.HeaderNames; -import io.helidon.nima.http2.webclient.Http2Client; -import io.helidon.nima.http2.webclient.Http2ClientResponse; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.Handler; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; - -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import static io.helidon.common.testing.http.junit5.HttpHeaderMatcher.hasHeader; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; - -class PostTest { - private static final byte[] BYTES = new byte[256]; - private static final HeaderName REQUEST_HEADER_NAME = HeaderNames.create("X-REquEst-HEADeR"); - private static final String REQUEST_HEADER_VALUE_STRING = "some nice value"; - private static final Http.Header REQUEST_HEADER_VALUE = Http.Headers.createCached(REQUEST_HEADER_NAME, REQUEST_HEADER_VALUE_STRING); - private static final HeaderName RESPONSE_HEADER_NAME = HeaderNames.create("X-REsponSE-HeADER"); - private static final String RESPONSE_HEADER_VALUE_STRING = "another nice value"; - private static final Http.Header RESPONSE_HEADER_VALUE = Http.Headers.create(RESPONSE_HEADER_NAME, - RESPONSE_HEADER_VALUE_STRING); - - private static WebServer server; - private static Http2Client client; - - static { - Random random = new Random(); - random.nextBytes(BYTES); - } - - @BeforeAll - static void startServer() { - server = WebServer.builder() - .host("localhost") - .port(-1) - .routing(routing -> routing - .route(Http.Method.POST, "/string", Handler.create(String.class, Routes::string)) - .route(Http.Method.POST, "/bytes", Handler.create(byte[].class, Routes::bytes)) - .route(Http.Method.POST, "/chunked", Routes::chunked) - .route(Http.Method.POST, "/headers", Routes::headers) - .route(Http.Method.POST, "/close", Routes::close) - ) - .build() - .start(); - - client = Http2Client.builder() - .baseUri("http://localhost:" + server.port()) - .protocolConfig(it -> it.priorKnowledge(true)) - .build(); - } - - @AfterAll - static void stopServer() { - if (server != null) { - server.stop(); - } - } - - @Test - void testStringRoute() { - Http2ClientResponse response = client - .method(Http.Method.POST) - .uri("/string") - .submit("Hello"); - - assertThat(response.status(), is(Http.Status.OK_200)); - String entity = response.entity().as(String.class); - assertThat(entity, is("Hello")); - Headers headers = response.headers(); - assertThat("Should have correct length", headers.contentLength(), is(OptionalLong.of(5))); - } - - @Test - void testByteRoute() { - Http2ClientResponse response = client - .method(Http.Method.POST) - .uri("/bytes") - .submit(BYTES); - - assertThat(response.status(), is(Http.Status.OK_200)); - byte[] entity = response.entity().as(byte[].class); - assertThat(entity, is(BYTES)); - Headers headers = response.headers(); - assertThat(headers.contentLength(), is(OptionalLong.of(BYTES.length))); - } - - @Test - void testChunkedRoute() { - Http2ClientResponse response = client - .method(Http.Method.POST) - .uri("/chunked") - .outputStream(outputStream -> { - outputStream.write(BYTES); - outputStream.close(); - }); - - assertThat(response.status(), is(Http.Status.OK_200)); - byte[] entity = response.entity().as(byte[].class); - assertThat(entity, is(BYTES)); - } - - @Test - void testHeadersRoute() { - Http2ClientResponse response = client - .method(Http.Method.POST) - .uri("/headers") - .header(REQUEST_HEADER_VALUE) - .submit("Hello"); - - assertThat(response.status(), is(Http.Status.OK_200)); - String entity = response.entity().as(String.class); - assertThat(entity, is("Hello")); - Headers headers = response.headers(); - assertThat(headers.contentLength(), is(OptionalLong.of(5))); - assertThat(headers, hasHeader(REQUEST_HEADER_VALUE)); - assertThat(headers, hasHeader(RESPONSE_HEADER_VALUE)); - } - - @Test - void testCloseRoute() { - Http2ClientResponse response = client - .method(Http.Method.POST) - .uri("/close") - .submit("Hello"); - - assertThat(response.status(), is(Http.Status.NO_CONTENT_204)); - String entity = response.entity().as(String.class); - assertThat(entity, is("")); - } - - private static class Routes { - public static void close(ServerRequest req, ServerResponse res) { - res.status(Http.Status.NO_CONTENT_204); - res.send(); - } - - private static String string(String request) { - return request; - } - - private static byte[] bytes(byte[] bytes) { - return bytes; - } - - private static void chunked(ServerRequest req, ServerResponse res) { - byte[] buffer = new byte[512]; - try (InputStream inputStream = req.content().inputStream(); OutputStream outputStream = res.outputStream()) { - int read; - while ((read = inputStream.read(buffer)) > 0) { - outputStream.write(buffer, 0, read); - } - } catch (IOException e) { - throw new UncheckedIOException(e); - } - } - - private static void headers(ServerRequest req, ServerResponse res) { - res.header(req.headers().get(REQUEST_HEADER_NAME)); - res.header(RESPONSE_HEADER_VALUE); - res.send(req.content().as(String.class)); - } - } - -} diff --git a/nima/tests/integration/http2/client/src/test/resources/logging-test.properties b/nima/tests/integration/http2/client/src/test/resources/logging-test.properties deleted file mode 100644 index eba7d6f4be5..00000000000 --- a/nima/tests/integration/http2/client/src/test/resources/logging-test.properties +++ /dev/null @@ -1,21 +0,0 @@ -# -# Copyright (c) 2023 Oracle and/or its affiliates. -# -# 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. -# -handlers=java.util.logging.ConsoleHandler -java.util.logging.ConsoleHandler.level=FINEST -java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS.%1$tL %5$s%6$s%n -# Global logging level. Can be overridden by specific loggers -.level=INFO -io.helidon.nima.level=INFO diff --git a/nima/tests/integration/http2/pom.xml b/nima/tests/integration/http2/pom.xml deleted file mode 100644 index f5686d9c652..00000000000 --- a/nima/tests/integration/http2/pom.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests.integration - helidon-nima-tests-integration-project - 4.0.0-SNAPSHOT - - - io.helidon.nima.tests.integration.http2 - helidon-nima-tests-integration-http2-project - Helidon Níma Tests Integration HTTP/2 Project - pom - - - server - client - - diff --git a/nima/tests/integration/http2/server/pom.xml b/nima/tests/integration/http2/server/pom.xml deleted file mode 100644 index dc2b6c10af8..00000000000 --- a/nima/tests/integration/http2/server/pom.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests.integration.http2 - helidon-nima-tests-integration-http2-project - 4.0.0-SNAPSHOT - - - helidon-nima-tests-integration-http2-webserver - Helidon Níma Tests Integration HTTP/2 WebServer - - - - io.helidon.nima.http2 - helidon-nima-http2-webserver - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - io.helidon.common - helidon-common-reactive - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - io.helidon.nima.http2 - helidon-nima-http2-webclient - test - - - diff --git a/nima/tests/integration/http2/server/src/test/java/io/helidon/nima/tests/integration/http2/webserver/GetTest.java b/nima/tests/integration/http2/server/src/test/java/io/helidon/nima/tests/integration/http2/webserver/GetTest.java deleted file mode 100644 index 157bb187f83..00000000000 --- a/nima/tests/integration/http2/server/src/test/java/io/helidon/nima/tests/integration/http2/webserver/GetTest.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.tests.integration.http2.webserver; - -import java.io.IOException; -import java.io.OutputStream; -import java.io.UncheckedIOException; -import java.net.URI; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.time.Duration; -import java.util.Optional; -import java.util.OptionalLong; -import java.util.Random; - -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderName; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; - -import org.junit.jupiter.api.Test; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; - -@ServerTest -class GetTest { - private static final byte[] BYTES = new byte[256]; - private static final HeaderName REQUEST_HEADER_NAME = Http.HeaderNames.create("X-ReQUEst-header"); - private static final String REQUEST_HEADER_VALUE = "some nice value"; - private static final HeaderName RESPONSE_HEADER_NAME = Http.HeaderNames.create("X-REsponSE-HeADER"); - private static final String RESPONSE_HEADER_VALUE_STRING = "another nice value"; - private static final Http.Header RESPONSE_HEADER_VALUE = Http.Headers.create(RESPONSE_HEADER_NAME, - RESPONSE_HEADER_VALUE_STRING); - - static { - Random random = new Random(); - random.nextBytes(BYTES); - } - - private final HttpClient client; - private final URI uri; - - GetTest(URI uri) { - this.uri = uri; - client = HttpClient.newBuilder() - .version(HttpClient.Version.HTTP_2) - .connectTimeout(Duration.ofSeconds(5)) - .build(); - } - - @SetUpRoute - static void routing(HttpRouting.Builder router) { - router.route(Http.Method.GET, "/string", Routes::string) - .route(Http.Method.GET, "/bytes", Routes::bytes) - .route(Http.Method.GET, "/stream", Routes::outputStream) - .route(Http.Method.GET, "/headers", Routes::headers); - } - - @Test - void testStringRoute() throws IOException, InterruptedException { - HttpResponse response = client.send(HttpRequest.newBuilder() - .timeout(Duration.ofSeconds(5)) - .uri(uri.resolve("/string")) - .GET() - .build(), HttpResponse.BodyHandlers.ofString()); - - assertThat(response.statusCode(), is(Http.Status.OK_200.code())); - String entity = response.body(); - assertThat(entity, is("Hello")); - java.net.http.HttpHeaders headers = response.headers(); - assertThat(headers.firstValueAsLong("content-length"), is(OptionalLong.of(5))); - assertThat(response.version(), is(HttpClient.Version.HTTP_2)); - } - - @Test - void testByteRoute() throws IOException, InterruptedException { - HttpResponse response = client.send(HttpRequest.newBuilder() - .timeout(Duration.ofSeconds(5)) - .uri(uri.resolve("/bytes")) - .GET() - .build(), HttpResponse.BodyHandlers.ofByteArray()); - - assertThat(response.statusCode(), is(Http.Status.OK_200.code())); - byte[] entity = response.body(); - assertThat(entity, is(BYTES)); - java.net.http.HttpHeaders headers = response.headers(); - assertThat(headers.firstValueAsLong("content-length"), is(OptionalLong.of(BYTES.length))); - assertThat(response.version(), is(HttpClient.Version.HTTP_2)); - } - - @Test - void testStreamRoute() throws IOException, InterruptedException { - HttpResponse response = client.send(HttpRequest.newBuilder() - .timeout(Duration.ofSeconds(5)) - .uri(uri.resolve("/stream")) - .GET() - .build(), HttpResponse.BodyHandlers.ofByteArray()); - - assertThat(response.statusCode(), is(Http.Status.OK_200.code())); - byte[] entity = response.body(); - assertThat(entity, is(BYTES)); - java.net.http.HttpHeaders headers = response.headers(); - assertThat(headers.firstValueAsLong("content-length"), is(OptionalLong.of(BYTES.length))); - assertThat(response.version(), is(HttpClient.Version.HTTP_2)); - } - - @Test - void testHeadersRoute() throws IOException, InterruptedException { - HttpResponse response = client.send(HttpRequest.newBuilder() - .timeout(Duration.ofSeconds(5)) - .uri(uri.resolve("/headers")) - .header(REQUEST_HEADER_NAME.lowerCase(), - REQUEST_HEADER_VALUE) - .GET() - .build(), HttpResponse.BodyHandlers.ofString()); - - assertThat(response.statusCode(), is(Http.Status.OK_200.code())); - String entity = response.body(); - assertThat(entity, is("Hello")); - java.net.http.HttpHeaders headers = response.headers(); - assertThat(headers.firstValueAsLong("content-length"), is(OptionalLong.of(5))); - assertThat("Should contain echoed request header", - headers.firstValue(REQUEST_HEADER_NAME.lowerCase()), - is(Optional.of(REQUEST_HEADER_VALUE))); - assertThat("Should contain configured response header", - headers.firstValue(RESPONSE_HEADER_NAME.lowerCase()), - is(Optional.of(RESPONSE_HEADER_VALUE_STRING))); - assertThat(response.version(), is(HttpClient.Version.HTTP_2)); - } - - private static class Routes { - private static String string() { - return "Hello"; - } - - private static byte[] bytes() { - return BYTES; - } - - private static void outputStream(ServerRequest req, ServerResponse res) { - try (OutputStream outputStream = res.outputStream()) { - outputStream.write(BYTES); - } catch (IOException e) { - throw new UncheckedIOException(e); - } - } - - private static void headers(ServerRequest req, ServerResponse res) { - res.header(req.headers().get(REQUEST_HEADER_NAME)); - res.header(RESPONSE_HEADER_VALUE); - res.send("Hello"); - } - } - -} diff --git a/nima/tests/integration/http2/server/src/test/java/io/helidon/nima/tests/integration/http2/webserver/HeadersTest.java b/nima/tests/integration/http2/server/src/test/java/io/helidon/nima/tests/integration/http2/webserver/HeadersTest.java deleted file mode 100644 index 9f2fef95a7b..00000000000 --- a/nima/tests/integration/http2/server/src/test/java/io/helidon/nima/tests/integration/http2/webserver/HeadersTest.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.tests.integration.http2.webserver; - -import java.io.IOException; -import java.net.URI; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.time.Duration; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - -import io.helidon.nima.http2.webserver.Http2Config; -import io.helidon.nima.http2.webserver.Http2ConnectionSelector; -import io.helidon.nima.http2.webserver.Http2Route; -import io.helidon.nima.http2.webserver.Http2Upgrader; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.http1.Http1Config; -import io.helidon.nima.webserver.http1.Http1ConnectionSelector; - -import org.hamcrest.Matchers; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -import static io.helidon.common.http.Http.Method.GET; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; - -@ServerTest -public class HeadersTest { - - private static final Duration TIMEOUT = Duration.ofSeconds(10); - private static final String DATA = "Helidon!!!".repeat(10); - - @SetUpServer - static void setUpServer(WebServerConfig.Builder serverBuilder) { - Http2Config http2Config = Http2Config.builder() - .sendErrorDetails(true) - .maxHeaderListSize(128_000) - .build(); - - serverBuilder.port(-1) - .protocolsDiscoverServices(false) - // HTTP/2 prior knowledge config - .addConnectionSelector(Http2ConnectionSelector.builder() - .http2Config(http2Config) - .build()) - // HTTP/1.1 -> HTTP/2 upgrade config - .addConnectionSelector(Http1ConnectionSelector.builder() - .config(Http1Config.create()) - .addUpgrader(Http2Upgrader.create(http2Config)) - .build()); - } - - @SetUpRoute - static void router(HttpRouting.Builder router) { - router.route(Http2Route.route(GET, "/ping", (req, res) -> res.send("pong"))); - router.route(Http2Route.route(GET, "/cont-out", - (req, res) -> { - for (int i = 0; i < 500; i++) { - res.header("test-header-" + i, DATA + i); - } - res.send(); - } - )); - router.route(Http2Route.route(GET, "/cont-in", - (req, res) -> { - String joinedHeaders = req.headers() - .stream() - .filter(h -> h.name().startsWith("test-header-")) - .map(h -> h.name() + "=" + h.value()) - .collect(Collectors.joining("\n")); - res.send(joinedHeaders); - } - )); - } - - @Test - void serverOutbound(WebServer server) throws IOException, InterruptedException { - URI base = URI.create("http://localhost:" + server.port()); - HttpClient client = http2Client(base); - - Set expected = new HashSet<>(500); - for (int i = 0; i < 500; i++) { - expected.add("test-header-" + i + "=" + DATA + i); - } - - HttpResponse res = client.send(HttpRequest.newBuilder() - .timeout(TIMEOUT) - .uri(base.resolve("/cont-out")) - .GET() - .build(), HttpResponse.BodyHandlers.ofString()); - - List actual = res.headers() - .map() - .entrySet() - .stream() - .filter(e -> e.getKey().startsWith("test-header-")) - .map(e -> e.getKey() + "=" + String.join("", e.getValue())) - .toList(); - - assertThat(res.statusCode(), is(200)); - assertThat(actual, Matchers.containsInAnyOrder(expected.toArray(new String[0]))); - } - - @Test - void serverInbound(WebServer server) throws IOException, InterruptedException { - URI base = URI.create("http://localhost:" + server.port()); - HttpClient client = http2Client(base); - - HttpRequest.Builder req = HttpRequest.newBuilder() - .timeout(TIMEOUT) - .GET(); - - Set expected = new HashSet<>(500); - for (int i = 0; i < 800; i++) { - req.setHeader("test-header-" + i, DATA + i); - expected.add("test-header-" + i + "=" + DATA + i); - } - - HttpResponse res = client.send(req.uri(base.resolve("/cont-in")).build(), - HttpResponse.BodyHandlers.ofString()); - - assertThat(res.statusCode(), is(200)); - assertThat(List.of(res.body().split("\n")), Matchers.containsInAnyOrder(expected.toArray(new String[0]))); - } - - @Test - void serverInboundTooLarge(WebServer server) throws IOException, InterruptedException { - URI base = URI.create("http://localhost:" + server.port()); - HttpClient client = http2Client(base); - - HttpRequest.Builder req = HttpRequest.newBuilder() - .timeout(TIMEOUT) - .GET(); - - for (int i = 0; i < 5200; i++) { - req.setHeader("test-header-" + i, DATA + i); - } - - // There is no way how to access GO_AWAY status code and additional data with JDK Http client - Assertions.assertThrows(IOException.class, - () -> client.send(req.uri(base.resolve("/cont-in")).build(), - HttpResponse.BodyHandlers.ofString())); - } - - private HttpClient http2Client(URI base) throws IOException, InterruptedException { - HttpClient client = HttpClient.newBuilder() - .version(HttpClient.Version.HTTP_2) - .connectTimeout(TIMEOUT) - .build(); - - HttpRequest req = HttpRequest.newBuilder() - .timeout(TIMEOUT) - .GET() - .uri(base.resolve("/ping")) - .build(); - - // Java client can't do the prior knowledge - client.send(req, HttpResponse.BodyHandlers.ofString()); - return client; - } - -} diff --git a/nima/tests/integration/http2/server/src/test/java/io/helidon/nima/tests/integration/http2/webserver/PostTest.java b/nima/tests/integration/http2/server/src/test/java/io/helidon/nima/tests/integration/http2/webserver/PostTest.java deleted file mode 100644 index f21d285d9aa..00000000000 --- a/nima/tests/integration/http2/server/src/test/java/io/helidon/nima/tests/integration/http2/webserver/PostTest.java +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.tests.integration.http2.webserver; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.UncheckedIOException; -import java.net.URI; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.time.Duration; -import java.util.Optional; -import java.util.OptionalLong; -import java.util.Random; - -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderName; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webserver.http.Handler; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; - -import org.junit.jupiter.api.Test; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; - -@ServerTest -class PostTest { - private static final byte[] BYTES = new byte[256]; - private static final HeaderName REQUEST_HEADER_NAME = Http.HeaderNames.create("X-REquEst-HEADeR"); - private static final String REQUEST_HEADER_VALUE_STRING = "some nice value"; - private static final Http.Header REQUEST_HEADER_VALUE = Http.Headers.create(REQUEST_HEADER_NAME, REQUEST_HEADER_VALUE_STRING); - private static final HeaderName RESPONSE_HEADER_NAME = Http.HeaderNames.create("X-REsponSE-HeADER"); - private static final String RESPONSE_HEADER_VALUE_STRING = "another nice value"; - private static final Http.Header RESPONSE_HEADER_VALUE = Http.Headers.create(RESPONSE_HEADER_NAME, - RESPONSE_HEADER_VALUE_STRING); - - static { - Random random = new Random(); - random.nextBytes(BYTES); - } - - private final HttpClient client; - private final URI uri; - - PostTest(URI uri) { - this.uri = uri; - client = HttpClient.newBuilder() - .version(HttpClient.Version.HTTP_2) - .connectTimeout(Duration.ofSeconds(5)) - .build(); - } - - @SetUpRoute - static void routing(HttpRouting.Builder router) { - router.route(Http.Method.POST, "/string", Handler.create(String.class, Routes::string)) - .route(Http.Method.POST, "/bytes", Handler.create(byte[].class, Routes::bytes)) - .route(Http.Method.POST, "/streamed", Routes::streamed) - .route(Http.Method.POST, "/headers", Routes::headers) - .route(Http.Method.POST, "/nocontent", Routes::noContent); - } - - @Test - void testStringRoute() throws IOException, InterruptedException { - // do a head request (will get 404) to upgrade - client.send(HttpRequest.newBuilder() - .HEAD() - .uri(uri.resolve("/string")) - .build(), HttpResponse.BodyHandlers.discarding()); - - HttpResponse response = client.send(HttpRequest.newBuilder() - .timeout(Duration.ofSeconds(5)) - .uri(uri.resolve("/string")) - .POST(HttpRequest.BodyPublishers.ofString("Hello")) - .build(), HttpResponse.BodyHandlers.ofString()); - - assertThat(response.statusCode(), is(Http.Status.OK_200.code())); - String entity = response.body(); - assertThat(entity, is("Hello")); - java.net.http.HttpHeaders headers = response.headers(); - assertThat(headers.firstValueAsLong("content-length"), is(OptionalLong.of(5))); - assertThat(response.version(), is(HttpClient.Version.HTTP_2)); - } - - @Test - void testByteRoute() throws IOException, InterruptedException { - // do a head request (will get 404) to upgrade - client.send(HttpRequest.newBuilder() - .HEAD() - .uri(uri.resolve("/string")) - .build(), HttpResponse.BodyHandlers.discarding()); - - HttpResponse response = client.send(HttpRequest.newBuilder() - .timeout(Duration.ofSeconds(5)) - .uri(uri.resolve("/bytes")) - .POST(HttpRequest.BodyPublishers.ofByteArray(BYTES)) - .build(), HttpResponse.BodyHandlers.ofByteArray()); - - assertThat(response.statusCode(), is(Http.Status.OK_200.code())); - byte[] entity = response.body(); - assertThat(entity, is(BYTES)); - java.net.http.HttpHeaders headers = response.headers(); - assertThat(headers.firstValueAsLong("content-length"), is(OptionalLong.of(BYTES.length))); - assertThat(response.version(), is(HttpClient.Version.HTTP_2)); - } - - @Test - void testStreamedRoute() throws IOException, InterruptedException { - // do a head request (will get 404) to upgrade - client.send(HttpRequest.newBuilder() - .HEAD() - .uri(uri.resolve("/string")) - .build(), HttpResponse.BodyHandlers.discarding()); - - HttpResponse response = client.send(HttpRequest.newBuilder() - .timeout(Duration.ofSeconds(5)) - .uri(uri.resolve("/streamed")) - .POST(HttpRequest.BodyPublishers.ofByteArray(BYTES)) - .build(), HttpResponse.BodyHandlers.ofByteArray()); - - assertThat(response.statusCode(), is(Http.Status.OK_200.code())); - byte[] entity = response.body(); - assertThat(entity, is(BYTES)); - java.net.http.HttpHeaders headers = response.headers(); - assertThat(headers.firstValueAsLong("content-length"), is(OptionalLong.of(BYTES.length))); - assertThat(response.version(), is(HttpClient.Version.HTTP_2)); - } - - @Test - void testHeadersRoute() throws IOException, InterruptedException { - // do a head request (will get 404) to upgrade - client.send(HttpRequest.newBuilder() - .HEAD() - .uri(uri.resolve("/string")) - .build(), HttpResponse.BodyHandlers.discarding()); - - HttpResponse response = client.send(HttpRequest.newBuilder() - .timeout(Duration.ofSeconds(5)) - .uri(uri.resolve("/headers")) - .header(REQUEST_HEADER_NAME.lowerCase(), - REQUEST_HEADER_VALUE_STRING) - .POST(HttpRequest.BodyPublishers.ofString("Hello")) - .build(), HttpResponse.BodyHandlers.ofString()); - - assertThat(response.statusCode(), is(Http.Status.OK_200.code())); - String entity = response.body(); - assertThat(entity, is("Hello")); - java.net.http.HttpHeaders headers = response.headers(); - assertThat(headers.firstValueAsLong("content-length"), is(OptionalLong.of(5))); - assertThat("Should contain echoed request header", - headers.firstValue(REQUEST_HEADER_NAME.lowerCase()), - is(Optional.of(REQUEST_HEADER_VALUE_STRING))); - assertThat("Should contain configured response header", - headers.firstValue(RESPONSE_HEADER_NAME.lowerCase()), - is(Optional.of(RESPONSE_HEADER_VALUE_STRING))); - assertThat(response.version(), is(HttpClient.Version.HTTP_2)); - } - - @Test - void testNoContentRoute() throws IOException, InterruptedException { - // do a head request (will get 404) to upgrade - client.send(HttpRequest.newBuilder() - .HEAD() - .uri(uri.resolve("/nocontent")) - .build(), HttpResponse.BodyHandlers.discarding()); - - HttpResponse response = client.send(HttpRequest.newBuilder() - .timeout(Duration.ofSeconds(5)) - .uri(uri.resolve("/nocontent")) - .header(REQUEST_HEADER_NAME.lowerCase(), - REQUEST_HEADER_VALUE_STRING) - .POST(HttpRequest.BodyPublishers.ofString("Hello")) - .build(), HttpResponse.BodyHandlers.ofString()); - - assertThat(response.statusCode(), is(Http.Status.NO_CONTENT_204.code())); - } - - private static class Routes { - public static void noContent(ServerRequest req, ServerResponse res) { - res.status(Http.Status.NO_CONTENT_204); - res.send(); - } - - private static String string(String request) { - return request; - } - - private static byte[] bytes(byte[] bytes) { - return bytes; - } - - private static void streamed(ServerRequest req, ServerResponse res) { - byte[] buffer = new byte[512]; - try (InputStream inputStream = req.content().inputStream(); OutputStream outputStream = res.outputStream()) { - int read; - while ((read = inputStream.read(buffer)) > 0) { - outputStream.write(buffer, 0, read); - } - } catch (IOException e) { - throw new UncheckedIOException(e); - } - } - - private static void headers(ServerRequest req, ServerResponse res) { - res.header(req.headers().get(REQUEST_HEADER_NAME)); - res.header(RESPONSE_HEADER_VALUE); - String entity = req.content().as(String.class); - res.send(entity); - } - } - -} diff --git a/nima/tests/integration/http2/server/src/test/resources/logging-test.properties b/nima/tests/integration/http2/server/src/test/resources/logging-test.properties deleted file mode 100644 index aff4b62fc13..00000000000 --- a/nima/tests/integration/http2/server/src/test/resources/logging-test.properties +++ /dev/null @@ -1,22 +0,0 @@ -# -# Copyright (c) 2022, 2023 Oracle and/or its affiliates. -# -# 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. -# -handlers=java.util.logging.ConsoleHandler -java.util.logging.ConsoleHandler.level=FINEST -java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter -java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS.%1$tL %5$s%6$s%n -# Global logging level. Can be overridden by specific loggers -.level=INFO -io.helidon.nima.level=INFO diff --git a/nima/tests/integration/imperative/pom.xml b/nima/tests/integration/imperative/pom.xml deleted file mode 100644 index d12b1d6b4bf..00000000000 --- a/nima/tests/integration/imperative/pom.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests.integration - helidon-nima-tests-integration-project - 4.0.0-SNAPSHOT - ../pom.xml - - - helidon-nima-tests-integration-imperative - Helidon Níma Tests Integration Imperative - Validation of imperative APIs and their dependencies - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.config - helidon-config-yaml - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - integration-test - verify - - - - - - org.apache.maven.plugins - maven-enforcer-plugin - - - enforce-config-not-included - - enforce - - - - - - - io.helidon.inject:helidon-inject-runtime - io.helidon.inject.configdriven:helidon-configdriven-runtime - - - - true - - - - - - - diff --git a/nima/tests/integration/imperative/src/main/java/io/helidon/nima/tests/integration/imperative/ImperativeMain.java b/nima/tests/integration/imperative/src/main/java/io/helidon/nima/tests/integration/imperative/ImperativeMain.java deleted file mode 100644 index 47ec6622f61..00000000000 --- a/nima/tests/integration/imperative/src/main/java/io/helidon/nima/tests/integration/imperative/ImperativeMain.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.tests.integration.imperative; - -import io.helidon.common.config.Config; -import io.helidon.common.config.GlobalConfig; -import io.helidon.common.http.Http; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRouting; - -/** - * Main class of this example, starts the server. - */ -public final class ImperativeMain { - private ImperativeMain() { - } - - /** - * Start the example. - * - * @param args ignored - */ - public static void main(String[] args) { - Config config = GlobalConfig.config(); - - WebServer server = WebServer.create(ws -> ws.config(config.get("server")) - .routing(ImperativeMain::routing)) - .start(); - - System.out.println("Server started. Server configuration: " + server.prototype()); - } - - static void routing(HttpRouting.Builder routing) { - Http.Method list = Http.Method.create("LIST"); - - routing.get("/", (req, res) -> res.send("Hello World!")) - .route(list, "/", (req, res) -> res.send("lll")) - .route(list, (req, res) -> res.send("listed")); - } -} diff --git a/nima/tests/integration/logging/log4j/pom.xml b/nima/tests/integration/logging/log4j/pom.xml deleted file mode 100644 index ef552066a9e..00000000000 --- a/nima/tests/integration/logging/log4j/pom.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests.integration.logging - helidon-nima-tests-integration-logging-project - 4.0.0-SNAPSHOT - - - helidon-nima-tests-integration-logging-log4j - Helidon Níma Tests Integration Logging Log4j - - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - - - io.helidon.logging - helidon-logging-log4j - - - - - org.apache.logging.log4j - log4j-core - - - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - diff --git a/nima/tests/integration/logging/pom.xml b/nima/tests/integration/logging/pom.xml deleted file mode 100644 index a6083780a96..00000000000 --- a/nima/tests/integration/logging/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests.integration - helidon-nima-tests-integration-project - 4.0.0-SNAPSHOT - - - io.helidon.nima.tests.integration.logging - helidon-nima-tests-integration-logging-project - Helidon Níma Tests Integration Logging Project - pom - - - log4j - - diff --git a/nima/tests/integration/media/jsonb/pom.xml b/nima/tests/integration/media/jsonb/pom.xml deleted file mode 100644 index 11896443cd0..00000000000 --- a/nima/tests/integration/media/jsonb/pom.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests.integration.media - helidon-nima-tests-integration-media-project - 4.0.0-SNAPSHOT - - - helidon-nima-tests-integration-media-jsonb - Helidon Níma Tests Integration Media JSON-B - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.http.media - helidon-nima-http-media-jsonb - runtime - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - diff --git a/nima/tests/integration/media/jsonp/pom.xml b/nima/tests/integration/media/jsonp/pom.xml deleted file mode 100644 index 822331aa7ae..00000000000 --- a/nima/tests/integration/media/jsonp/pom.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests.integration.media - helidon-nima-tests-integration-media-project - 4.0.0-SNAPSHOT - - - helidon-nima-tests-integration-media-jsonp - Helidon Níma Tests Integration Media JSON-P - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.http.media - helidon-nima-http-media-jsonp - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - diff --git a/nima/tests/integration/media/multipart/pom.xml b/nima/tests/integration/media/multipart/pom.xml deleted file mode 100644 index 6da3e7d7b24..00000000000 --- a/nima/tests/integration/media/multipart/pom.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests.integration.media - helidon-nima-tests-integration-media-project - 4.0.0-SNAPSHOT - - - helidon-nima-tests-integration-media-multipart - Helidon Níma Tests Integration Media MultiPart - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.http.media - helidon-nima-http-media-multipart - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - diff --git a/nima/tests/integration/media/multipart/src/test/resources/logging-test.properties b/nima/tests/integration/media/multipart/src/test/resources/logging-test.properties deleted file mode 100644 index b18cc69f3e6..00000000000 --- a/nima/tests/integration/media/multipart/src/test/resources/logging-test.properties +++ /dev/null @@ -1,22 +0,0 @@ -# -# Copyright (c) 2022 Oracle and/or its affiliates. -# -# 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. -# -handlers=java.util.logging.ConsoleHandler -java.util.logging.ConsoleHandler.level=FINEST -java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter -java.util.logging.SimpleFormatter.format=%1$tH:%1$tM:%1$tS %4$s %3$s %5$s%6$s%n -# Global logging level. Can be overridden by specific loggers -.level=INFO -io.helidon.nima.level=FINEST diff --git a/nima/tests/integration/media/pom.xml b/nima/tests/integration/media/pom.xml deleted file mode 100644 index 0fbd07fee6a..00000000000 --- a/nima/tests/integration/media/pom.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests.integration - helidon-nima-tests-integration-project - 4.0.0-SNAPSHOT - - - io.helidon.nima.tests.integration.media - helidon-nima-tests-integration-media-project - Helidon Níma Tests Integration Media Project - pom - - - string - jsonb - jsonp - multipart - - diff --git a/nima/tests/integration/media/string/pom.xml b/nima/tests/integration/media/string/pom.xml deleted file mode 100644 index 8735c25ebf6..00000000000 --- a/nima/tests/integration/media/string/pom.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests.integration.media - helidon-nima-tests-integration-media-project - 4.0.0-SNAPSHOT - - - helidon-nima-tests-integration-media-string - Helidon Níma Tests Integration Media String - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.http.media - helidon-nima-http-media - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - diff --git a/nima/tests/integration/observe/health/pom.xml b/nima/tests/integration/observe/health/pom.xml deleted file mode 100644 index 65c942ca1a0..00000000000 --- a/nima/tests/integration/observe/health/pom.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests.integration.observe - helidon-nima-tests-integration-observe-project - 4.0.0-SNAPSHOT - - - helidon-nima-tests-integration-observe-health - Helidon Níma Tests Integration Observe Health - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.observe - helidon-nima-observe-health - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - diff --git a/nima/tests/integration/observe/health/src/test/resources/logging-test.properties b/nima/tests/integration/observe/health/src/test/resources/logging-test.properties deleted file mode 100644 index d2981c133c2..00000000000 --- a/nima/tests/integration/observe/health/src/test/resources/logging-test.properties +++ /dev/null @@ -1,22 +0,0 @@ -# -# Copyright (c) 2022 Oracle and/or its affiliates. -# -# 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. -# -handlers=java.util.logging.ConsoleHandler -java.util.logging.ConsoleHandler.level=FINEST -java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter -java.util.logging.SimpleFormatter.format=%1$tH:%1$tM:%1$tS %4$s %3$s %5$s%6$s%n -# Global logging level. Can be overridden by specific loggers -.level=INFO -io.helidon.nima.level=INFO diff --git a/nima/tests/integration/observe/pom.xml b/nima/tests/integration/observe/pom.xml deleted file mode 100644 index 9bffbc8f23a..00000000000 --- a/nima/tests/integration/observe/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests.integration - helidon-nima-tests-integration-project - 4.0.0-SNAPSHOT - - - io.helidon.nima.tests.integration.observe - helidon-nima-tests-integration-observe-project - Helidon Níma Tests Integration Observe Project - pom - - - health - - diff --git a/nima/tests/integration/pom.xml b/nima/tests/integration/pom.xml deleted file mode 100644 index 9fca6b3c219..00000000000 --- a/nima/tests/integration/pom.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests - helidon-nima-tests-project - 4.0.0-SNAPSHOT - - - io.helidon.nima.tests.integration - helidon-nima-tests-integration-project - Helidon Níma Tests Integration Project - pom - - - webserver - webclient - grpc - websocket - http2 - encoding - media - observe - logging - sse - imperative - - diff --git a/nima/tests/integration/sse/pom.xml b/nima/tests/integration/sse/pom.xml deleted file mode 100644 index b72e4fae1f9..00000000000 --- a/nima/tests/integration/sse/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests.integration - helidon-nima-tests-integration-project - 4.0.0-SNAPSHOT - - - io.helidon.nima.tests.integration.sse - helidon-nima-tests-integration-sse-project - Helidon Níma Tests Integration SSE Project - pom - - - server - - diff --git a/nima/tests/integration/sse/server/pom.xml b/nima/tests/integration/sse/server/pom.xml deleted file mode 100644 index 14263f5b3e4..00000000000 --- a/nima/tests/integration/sse/server/pom.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests.integration.sse - helidon-nima-tests-integration-sse-project - 4.0.0-SNAPSHOT - - - helidon-nima-tests-integration-sse-webserver - Helidon Níma Tests Integration SSE WebServer - - - - io.helidon.nima.sse - helidon-nima-sse-webserver - test - - - io.helidon.nima.sse - helidon-nima-sse-webclient - test - - - io.helidon.nima.http.media - helidon-nima-http-media-jsonp - test - - - jakarta.json - jakarta.json-api - test - - - io.helidon.nima.http.media - helidon-nima-http-media-jsonb - test - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - diff --git a/nima/tests/integration/sse/server/src/main/resources/logging.properties b/nima/tests/integration/sse/server/src/main/resources/logging.properties deleted file mode 100644 index b3e81c5cb71..00000000000 --- a/nima/tests/integration/sse/server/src/main/resources/logging.properties +++ /dev/null @@ -1,20 +0,0 @@ -# -# Copyright (c) 2023 Oracle and/or its affiliates. -# -# 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. -# -handlers=java.util.logging.ConsoleHandler -java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS.%1$tL %5$s%6$s%n -# Global logging level. Can be overridden by specific loggers -.level=INFO -io.helidon.nima.level=INFO diff --git a/nima/tests/integration/sse/server/src/test/resources/META-INF/services/io.helidon.nima.http.media.spi.MediaSupportProvider b/nima/tests/integration/sse/server/src/test/resources/META-INF/services/io.helidon.nima.http.media.spi.MediaSupportProvider deleted file mode 100644 index 24063f7817b..00000000000 --- a/nima/tests/integration/sse/server/src/test/resources/META-INF/services/io.helidon.nima.http.media.spi.MediaSupportProvider +++ /dev/null @@ -1 +0,0 @@ -io.helidon.nima.tests.integration.sse.webserver.SseServerMediaTest$MyStringSupportProvider diff --git a/nima/tests/integration/webclient/pom.xml b/nima/tests/integration/webclient/pom.xml deleted file mode 100644 index 730421c6b77..00000000000 --- a/nima/tests/integration/webclient/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests.integration - helidon-nima-tests-integration-project - 4.0.0-SNAPSHOT - ../pom.xml - - - io.helidon.nima.tests.integration.webclient - helidon-nima-tests-integration-webclient-project - Helidon Níma Tests Integration WebClient Project - pom - - - webclient - protocols - - diff --git a/nima/tests/integration/webclient/protocols/pom.xml b/nima/tests/integration/webclient/protocols/pom.xml deleted file mode 100644 index 1f89e13258b..00000000000 --- a/nima/tests/integration/webclient/protocols/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests.integration.webclient - helidon-nima-tests-integration-webclient-project - 4.0.0-SNAPSHOT - ../pom.xml - - - helidon-nima-tests-integration-webclient-protocols - Helidon Níma Tests Integration Webclient Protocols - - - - io.helidon.nima.webclient - helidon-nima-webclient - - - io.helidon.nima.http2 - helidon-nima-http2-webclient - - - io.helidon.nima.websocket - helidon-nima-websocket-client - - - io.helidon.nima.webserver - helidon-nima-webserver - test - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - diff --git a/nima/tests/integration/webclient/webclient/pom.xml b/nima/tests/integration/webclient/webclient/pom.xml deleted file mode 100644 index d250a03b898..00000000000 --- a/nima/tests/integration/webclient/webclient/pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests.integration.webclient - helidon-nima-tests-integration-webclient-project - 4.0.0-SNAPSHOT - - - helidon-nima-tests-integration-webclient - Helidon Níma Tests Integration Webclient - - - - io.helidon.nima.webclient - helidon-nima-webclient - - - io.helidon.nima.http2 - helidon-nima-http2-webclient - - - io.helidon.nima.webserver - helidon-nima-webserver - test - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-http2 - test - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.junit.jupiter - junit-jupiter-params - test - - - org.hamcrest - hamcrest-all - test - - - diff --git a/nima/tests/integration/webclient/webclient/src/test/java/io/helidon/nima/tests/integration/webclient/HeadersTest.java b/nima/tests/integration/webclient/webclient/src/test/java/io/helidon/nima/tests/integration/webclient/HeadersTest.java deleted file mode 100644 index e86d028d86b..00000000000 --- a/nima/tests/integration/webclient/webclient/src/test/java/io/helidon/nima/tests/integration/webclient/HeadersTest.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.tests.integration.webclient; - -import java.util.Optional; - -import io.helidon.common.http.ClientResponseHeaders; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpMediaType; -import io.helidon.common.media.type.ParserMode; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.api.WebClient; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; - -import org.junit.jupiter.api.Test; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.junit.jupiter.api.Assertions.fail; - -@ServerTest -class HeadersTest { - - private final WebClient client; - - HeadersTest(WebClient client) { - this.client = client; - } - - @SetUpRoute - static void routing(HttpRules rules) { - rules.register("/test", new TestService()); - } - - - // Verify that invalid content type is present in response headers and is accessible - @Test - public void testInvalidContentType() { - try (HttpClientResponse res = client.method(Http.Method.GET) - .path("/test/invalidContentType") - .request()) { - ClientResponseHeaders h = res.headers(); - Http.Header contentType = h.get(Http.HeaderNames.CONTENT_TYPE); - assertThat(res.status(), is(Http.Status.OK_200)); - assertThat(contentType.value(), is(TestService.INVALID_CONTENT_TYPE_VALUE)); - } - } - - // Verify that "Content-Type: text" header parsing fails in strict mode - @Test - public void testInvalidTextContentTypeStrict() { - try (HttpClientResponse res = client.method(Http.Method.GET) - .path("/test/invalidTextContentType") - .request()) { - assertThat(res.status(), is(Http.Status.OK_200)); - Headers h = res.headers(); - // Raw protocol data value - Http.Header rawContentType = h.get(Http.HeaderNames.CONTENT_TYPE); - assertThat(rawContentType.value(), is(TestService.INVALID_CONTENT_TYPE_TEXT)); - // Media type parsed value is invalid, IllegalArgumentException shall be thrown - try { - Optional httpMediaType = h.contentType(); - fail("Content-Type: text parsing must throw an exception in strict mode, got: " + httpMediaType); - } catch (IllegalArgumentException ex) { - assertThat(ex.getMessage(), is("Cannot parse media type: text")); - } - } - } - - // Verify that "Content-Type: text" header parsing returns text/plain in relaxed mode - @Test - public void testInvalidTextContentTypeRelaxed() { - WebClient client = WebClient.builder() - .from(this.client.prototype()) - .mediaTypeParserMode(ParserMode.RELAXED) - .build(); - try (HttpClientResponse res = client.method(Http.Method.GET) - .path("/test/invalidTextContentType") - .request()) { - assertThat(res.status(), is(Http.Status.OK_200)); - Headers h = res.headers(); - // Raw protocol data value - Http.Header rawContentType = h.get(Http.HeaderNames.CONTENT_TYPE); - assertThat(rawContentType.value(), is(TestService.INVALID_CONTENT_TYPE_TEXT)); - // Media type parsed value - Optional contentType = h.contentType(); - assertThat(contentType.isPresent(), is(true)); - assertThat(contentType.get().text(), is(TestService.RELAXED_CONTENT_TYPE_TEXT)); - } - } - - static final class TestService implements HttpService { - - TestService() { - } - - @Override - public void routing(HttpRules rules) { - rules - .get("/invalidContentType", this::invalidContentType) - .get("/invalidTextContentType", this::invalidTextContentType); - } - - private static final String INVALID_CONTENT_TYPE_VALUE = "invalid header value"; - - private void invalidContentType(ServerRequest request, ServerResponse response) { - response.header(Http.HeaderNames.CONTENT_TYPE, INVALID_CONTENT_TYPE_VALUE) - .send(); - } - - private static final String INVALID_CONTENT_TYPE_TEXT = "text"; - private static final String RELAXED_CONTENT_TYPE_TEXT = "text/plain"; - - // Returns Content-Type: text instead of text/plain - private void invalidTextContentType(ServerRequest request, ServerResponse response) { - response.header(Http.HeaderNames.CONTENT_TYPE, INVALID_CONTENT_TYPE_TEXT) - .send(); - } - - } - -} diff --git a/nima/tests/integration/webclient/webclient/src/test/java/io/helidon/nima/webclient/http1/Http1ClientTest.java b/nima/tests/integration/webclient/webclient/src/test/java/io/helidon/nima/webclient/http1/Http1ClientTest.java deleted file mode 100644 index 4848bd91610..00000000000 --- a/nima/tests/integration/webclient/webclient/src/test/java/io/helidon/nima/webclient/http1/Http1ClientTest.java +++ /dev/null @@ -1,554 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.webclient.http1; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.UncheckedIOException; -import java.net.SocketTimeoutException; -import java.nio.charset.StandardCharsets; -import java.time.Duration; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import io.helidon.common.GenericType; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; -import io.helidon.common.http.WritableHeaders; -import io.helidon.nima.http.media.EntityReader; -import io.helidon.nima.http.media.EntityWriter; -import io.helidon.nima.http.media.MediaContext; -import io.helidon.nima.http.media.MediaContextConfig; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.api.ClientConnection; -import io.helidon.nima.webclient.api.ClientResponseTyped; -import io.helidon.nima.webclient.api.HttpClientRequest; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.api.Proxy; -import io.helidon.nima.webclient.api.WebClient; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; - -import org.junit.jupiter.api.Test; - -import static io.helidon.common.testing.http.junit5.HttpHeaderMatcher.hasHeader; -import static io.helidon.common.testing.http.junit5.HttpHeaderMatcher.noHeader; -import static org.hamcrest.CoreMatchers.containsString; -import static org.hamcrest.CoreMatchers.instanceOf; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.IsNot.not; -import static org.junit.jupiter.api.Assertions.assertThrows; - -/* -This class uses package local API to validate connection cache, and at the same time benefits from @ServerTest -that is why this tests is in this module, but in the wrong package - */ -@ServerTest -class Http1ClientTest { - private static final Http.Header REQ_CHUNKED_HEADER = Http.Headers.createCached( - Http.HeaderNames.create("X-Req-Chunked"), "true"); - private static final Http.Header REQ_EXPECT_100_HEADER_NAME = Http.Headers.createCached( - Http.HeaderNames.create("X-Req-Expect100"), "true"); - private static final Http.HeaderName REQ_CONTENT_LENGTH_HEADER_NAME = Http.HeaderNames.create("X-Req-ContentLength"); - private static final String EXPECTED_GET_AFTER_REDIRECT_STRING = "GET after redirect endpoint reached"; - private static final long NO_CONTENT_LENGTH = -1L; - - private final String baseURI; - private final WebClient injectedHttp1client; - - Http1ClientTest(WebServer webServer, WebClient client) { - baseURI = "http://localhost:" + webServer.port(); - injectedHttp1client = client; - } - - @SetUpRoute - static void routing(HttpRules rules) { - rules.put("/test", Http1ClientTest::responseHandler); - rules.put("/redirectKeepMethod", Http1ClientTest::redirectKeepMethod); - rules.put("/redirect", Http1ClientTest::redirect); - rules.get("/afterRedirect", Http1ClientTest::afterRedirectGet); - rules.put("/afterRedirect", Http1ClientTest::afterRedirectPut); - rules.put("/chunkresponse", Http1ClientTest::chunkResponseHandler); - rules.put("/delayedEndpoint", Http1ClientTest::delayedHandler); - } - - @Test - void testMaxHeaderSizeFail() { - Http1Client client = Http1Client.create(clientConfig -> clientConfig.baseUri(baseURI) - .protocolConfig(it -> it.maxHeaderSize(15))); - - validateFailedResponse(client, "Header size exceeded"); - } - - @Test - void testMaxHeaderSizeSuccess() { - Http1Client client = Http1Client.create(clientConfig -> clientConfig.baseUri(baseURI) - .protocolConfig(it -> it.maxHeaderSize(500))); - validateSuccessfulResponse(client); - } - - @Test - void testMaxStatusLineLengthFail() { - Http1Client client = Http1Client.create(clientConfig -> clientConfig.baseUri(baseURI) - .protocolConfig(it -> it.maxStatusLineLength(1))); - - validateFailedResponse(client, "HTTP Response did not contain HTTP status line"); - } - - @Test - void testMaxHeaderLineLengthSuccess() { - Http1Client client = Http1Client.create(clientConfig -> clientConfig.baseUri(baseURI) - .protocolConfig(it -> it.maxStatusLineLength(20))); - - validateSuccessfulResponse(client); - } - - @Test - void testMediaContext() { - Http1Client client = Http1Client.create(clientConfig -> clientConfig.baseUri(baseURI) - .mediaContext(new CustomizedMediaContext())); - - validateSuccessfulResponse(client); - } - - @Test - void testChunk() { - String[] requestEntityParts = {"First", "Second", "Third"}; - - HttpClientRequest request = getHttp1ClientRequest(Http.Method.PUT, "/test"); - HttpClientResponse response = getHttp1ClientResponseFromOutputStream(request, requestEntityParts); - - validateChunkTransfer(response, true, NO_CONTENT_LENGTH, String.join("", requestEntityParts)); - } - - @Test - void testChunkAndChunkResponse() { - String[] requestEntityParts = {"First", "Second", "Third"}; - - HttpClientRequest request = getHttp1ClientRequest(Http.Method.PUT, "/chunkresponse"); - HttpClientResponse response = getHttp1ClientResponseFromOutputStream(request, requestEntityParts); - - validateChunkTransfer(response, true, NO_CONTENT_LENGTH, String.join("", requestEntityParts)); - assertThat(response.headers(), hasHeader(Http.Headers.TRANSFER_ENCODING_CHUNKED)); - } - - @Test - void testNoChunk() { - String[] requestEntityParts = {"First"}; - long contentLength = requestEntityParts[0].length(); - - HttpClientRequest request = getHttp1ClientRequest(Http.Method.PUT, "/test") - .header(Http.HeaderNames.CONTENT_LENGTH, String.valueOf(contentLength)); - HttpClientResponse response = getHttp1ClientResponseFromOutputStream(request, requestEntityParts); - - validateChunkTransfer(response, false, contentLength, requestEntityParts[0]); - } - - @Test - void testForcedChunkNoContentLength() { - String[] requestEntityParts = {"First"}; - - HttpClientRequest request = getHttp1ClientRequest(Http.Method.PUT, "/test"); - HttpClientResponse response = getHttp1ClientResponseFromOutputStream(request, requestEntityParts); - - validateChunkTransfer(response, true, NO_CONTENT_LENGTH, requestEntityParts[0]); - } - - @Test - void testForcedChunkTransferEncodingChunked() { - String[] requestEntityParts = {"First"}; - - HttpClientRequest request = getHttp1ClientRequest(Http.Method.PUT, "/test") - .header(Http.Headers.TRANSFER_ENCODING_CHUNKED); - HttpClientResponse response = getHttp1ClientResponseFromOutputStream(request, requestEntityParts); - - validateChunkTransfer(response, true, NO_CONTENT_LENGTH, requestEntityParts[0]); - } - - @Test - void testExpect100() { - String[] requestEntityParts = {"First", "Second", "Third"}; - - WebClient client = WebClient.builder() - .baseUri(baseURI) - .sendExpectContinue(true) - .build(); - HttpClientRequest request = client.put("/test"); - - HttpClientResponse response = getHttp1ClientResponseFromOutputStream(request, requestEntityParts); - - validateChunkTransfer(response, true, NO_CONTENT_LENGTH, String.join("", requestEntityParts)); - assertThat(response.headers(), hasHeader(REQ_EXPECT_100_HEADER_NAME)); - } - - // validates that HEAD is not allowed with entity payload - @Test - void testHeadMethod() { - String path = "/test"; - assertThrows(IllegalArgumentException.class, () -> - injectedHttp1client.head(path).submit("Foo Bar")); - assertThrows(IllegalArgumentException.class, () -> - injectedHttp1client.head(path).outputStream(it -> { - it.write("Foo Bar".getBytes(StandardCharsets.UTF_8)); - it.close(); - })); - injectedHttp1client.head(path).request(); - } - - @Test - void testConnectionQueueDequeue() { - ClientConnection connectionNow = null; - ClientConnection connectionPrior = null; - for (int i = 0; i < 5; ++i) { - HttpClientRequest request = injectedHttp1client.put("/test"); - // connection will be dequeued if queue is not empty - WebClient webClient = WebClient.create(); - Http1ClientConfig clientConfig = Http1ClientConfig.create(); - Http1ClientImpl http1Client = new Http1ClientImpl(webClient, clientConfig); - connectionNow = http1Client - .connectionCache() - .connection(http1Client, - injectedHttp1client.prototype().tls(), - Proxy.noProxy(), - request.resolvedUri(), - request.headers(), - true); - request.connection(connectionNow); - HttpClientResponse response = request.request(); - // connection will be queued up - response.close(); - if (connectionPrior != null) { - assertThat(connectionNow, is(connectionPrior)); - } - connectionPrior = connectionNow; - } - } - - @Test - void testConnectionQueueSizeLimit() { - int connectionQueueSize = injectedHttp1client.prototype().connectionCacheSize(); - - List connectionList = new ArrayList<>(); - List responseList = new ArrayList<>(); - // create connections beyond the queue size limit - for (int i = 0; i < connectionQueueSize + 1; ++i) { - HttpClientRequest request = injectedHttp1client.put("/test"); - - WebClient webClient = WebClient.create(); - Http1ClientConfig clientConfig = Http1ClientConfig.create(); - Http1ClientImpl http1Client = new Http1ClientImpl(webClient, clientConfig); - - connectionList.add(http1Client - .connectionCache() - .connection(http1Client, - clientConfig.tls(), - Proxy.noProxy(), - request.resolvedUri(), - request.headers(), - true)); - request.connection(connectionList.get(i)); - responseList.add(request.request()); - } - - // Queue up all connections except the last one because it exceeded the queue size limit - for (HttpClientResponse response : responseList) { - response.close(); - } - - // dequeue all the created connections - ClientConnection connection = null; - HttpClientResponse response = null; - for (int i = 0; i < connectionQueueSize + 1; ++i) { - HttpClientRequest request = injectedHttp1client.put("/test"); - - WebClient webClient = WebClient.create(); - Http1ClientConfig clientConfig = Http1ClientConfig.create(); - Http1ClientImpl http1Client = new Http1ClientImpl(webClient, clientConfig); - - connection = http1Client - .connectionCache() - .connection(http1Client, - clientConfig.tls(), - Proxy.noProxy(), - request.resolvedUri(), - request.headers(), - true); - - request.connection(connection); - response = request.request(); - if (i < connectionQueueSize) { - // Verify connections that are dequeued - assertThat("Failed on connection index " + i, connection, is(connectionList.get(i))); - } else { - // Verify that the last connection was not dequeued but created as new, because it exceeded the queue size limit - assertThat(connection, is(not(connectionList.get(i)))); - } - } - - // The queue is currently empty so check if we can add the last created connection into it. - response.close(); - HttpClientRequest request = injectedHttp1client.put("/test"); - - WebClient webClient = WebClient.create(); - Http1ClientConfig clientConfig = Http1ClientConfig.create(); - Http1ClientImpl http1Client = new Http1ClientImpl(webClient, clientConfig); - - ClientConnection connectionNow = http1Client - .connectionCache() - .connection(http1Client, - clientConfig.tls(), - Proxy.noProxy(), - request.resolvedUri(), - request.headers(), - true); - - request.connection(connectionNow); - HttpClientResponse responseNow = request.request(); - // Verify that the connection was dequeued - assertThat(connectionNow, is(connection)); - } - - @Test - void testRedirect() { - try (HttpClientResponse response = injectedHttp1client.put("/redirect") - .followRedirects(false) - .submit("Test entity")) { - assertThat(response.status(), is(Http.Status.FOUND_302)); - } - - try (HttpClientResponse response = injectedHttp1client.put("/redirect") - .submit("Test entity")) { - assertThat(response.status(), is(Http.Status.OK_200)); - assertThat(response.lastEndpointUri().path().path(), is("/afterRedirect")); - assertThat(response.as(String.class), is(EXPECTED_GET_AFTER_REDIRECT_STRING)); - } - } - - @Test - void testRedirectKeepMethod() { - try (HttpClientResponse response = injectedHttp1client.put("/redirectKeepMethod") - .followRedirects(false) - .submit("Test entity")) { - assertThat(response.status(), is(Http.Status.TEMPORARY_REDIRECT_307)); - } - - try (HttpClientResponse response = injectedHttp1client.put("/redirectKeepMethod") - .submit("Test entity")) { - assertThat(response.lastEndpointUri().path().path(), is("/afterRedirect")); - assertThat(response.status(), is(Http.Status.NO_CONTENT_204)); - } - } - - @Test - void testReadTimeoutPerRequest() { - String testEntity = "Test entity"; - try (HttpClientResponse response = injectedHttp1client.put("/delayedEndpoint") - .submit(testEntity)) { - assertThat(response.status(), is(Http.Status.OK_200)); - assertThat(response.as(String.class), is(testEntity)); - } - - UncheckedIOException ste = assertThrows(UncheckedIOException.class, - () -> injectedHttp1client.put("/delayedEndpoint") - .readTimeout(Duration.ofMillis(1)) - .submit(testEntity)); - assertThat(ste.getCause(), instanceOf(SocketTimeoutException.class)); - } - - private static void validateSuccessfulResponse(Http1Client client) { - String requestEntity = "Sending Something"; - Http1ClientRequest request = client.put("/test"); - ClientResponseTyped response = request.submit(requestEntity, String.class); - - assertThat(response.status(), is(Http.Status.OK_200)); - assertThat(response.entity(), is(requestEntity)); - } - - private static void validateFailedResponse(Http1Client client, String errorMessage) { - String requestEntity = "Sending Something"; - Http1ClientRequest request = client.put("/test"); - IllegalStateException ie = assertThrows(IllegalStateException.class, () -> request.submit(requestEntity)); - assertThat(ie.getMessage(), containsString(errorMessage)); - } - - private static void validateChunkTransfer(HttpClientResponse response, boolean chunked, long contentLength, String entity) { - assertThat(response.status(), is(Http.Status.OK_200)); - if (contentLength == NO_CONTENT_LENGTH) { - assertThat(response.headers(), noHeader(REQ_CONTENT_LENGTH_HEADER_NAME)); - } else { - assertThat(response.headers(), hasHeader(REQ_CONTENT_LENGTH_HEADER_NAME, String.valueOf(contentLength))); - } - if (chunked) { - assertThat(response.headers(), hasHeader(REQ_CHUNKED_HEADER)); - } else { - assertThat(response.headers(), noHeader(REQ_CHUNKED_HEADER.headerName())); - } - String responseEntity = response.entity().as(String.class); - assertThat(responseEntity, is(entity)); - } - - private static void redirect(ServerRequest req, ServerResponse res) { - res.status(Http.Status.FOUND_302) - .header(Http.HeaderNames.LOCATION, "/afterRedirect") - .send(); - } - - private static void redirectKeepMethod(ServerRequest req, ServerResponse res) { - res.status(Http.Status.TEMPORARY_REDIRECT_307) - .header(Http.HeaderNames.LOCATION, "/afterRedirect") - .send(); - } - - private static void afterRedirectGet(ServerRequest req, ServerResponse res) { - if (req.content().hasEntity()) { - res.status(Http.Status.BAD_REQUEST_400) - .send("GET after redirect endpoint reached with entity"); - return; - } - res.send(EXPECTED_GET_AFTER_REDIRECT_STRING); - } - - private static void afterRedirectPut(ServerRequest req, ServerResponse res) { - String entity = req.content().as(String.class); - if (!entity.equals("Test entity")) { - res.status(Http.Status.BAD_REQUEST_400) - .send("Entity was not kept the same after the redirect"); - return; - } - res.status(Http.Status.NO_CONTENT_204) - .send(); - } - - private static void delayedHandler(ServerRequest req, ServerResponse res) throws IOException, InterruptedException { - TimeUnit.MILLISECONDS.sleep(10); - customHandler(req, res, false); - } - - private static void responseHandler(ServerRequest req, ServerResponse res) throws IOException { - customHandler(req, res, false); - } - - private static void chunkResponseHandler(ServerRequest req, ServerResponse res) throws IOException { - customHandler(req, res, true); - } - - private static void customHandler(ServerRequest req, ServerResponse res, boolean chunkResponse) throws IOException { - Headers reqHeaders = req.headers(); - if (reqHeaders.contains(Http.Headers.EXPECT_100)) { - res.headers().set(REQ_EXPECT_100_HEADER_NAME); - } - if (reqHeaders.contains(Http.HeaderNames.CONTENT_LENGTH)) { - res.headers().set(REQ_CONTENT_LENGTH_HEADER_NAME, reqHeaders.get(Http.HeaderNames.CONTENT_LENGTH).value()); - } - if (reqHeaders.contains(Http.Headers.TRANSFER_ENCODING_CHUNKED)) { - res.headers().set(REQ_CHUNKED_HEADER); - } - - try (InputStream inputStream = req.content().inputStream(); - OutputStream outputStream = res.outputStream()) { - if (!chunkResponse) { - new ByteArrayInputStream(inputStream.readAllBytes()).transferTo(outputStream); - } else { - // Break the entity into 3 parts and send them in chunks - int chunkParts = 3; - byte[] entity = inputStream.readAllBytes(); - int regularChunkLen = entity.length / chunkParts; - int lastChunkLen = regularChunkLen + entity.length % chunkParts; - for (int i = 0; i < chunkParts; i++) { - int chunkLen = (i != chunkParts - 1) ? regularChunkLen : lastChunkLen; - byte[] chunk = new byte[chunkLen]; - System.arraycopy(entity, i * regularChunkLen, chunk, 0, chunkLen); - outputStream.write(chunk); - outputStream.flush(); // will force chunked - } - } - } - } - - private static HttpClientResponse getHttp1ClientResponseFromOutputStream(HttpClientRequest request, - String[] requestEntityParts) { - - return request.outputStream(it -> { - for (String r : requestEntityParts) { - it.write(r.getBytes(StandardCharsets.UTF_8)); - } - it.close(); - }); - } - - private HttpClientRequest getHttp1ClientRequest(Http.Method method, String uriPath) { - return injectedHttp1client.method(method).uri(uriPath); - } - - private static class CustomizedMediaContext implements MediaContext { - private final MediaContext delegated = MediaContext.create(); - - @Override - public MediaContextConfig prototype() { - return delegated.prototype(); - } - - @Override - public EntityReader reader(GenericType type, Headers headers) { - return delegated.reader(type, headers); - } - - @Override - public EntityWriter writer(GenericType type, Headers requestHeaders, WritableHeaders responseHeaders) { - EntityWriter impl = delegated.writer(type, requestHeaders, responseHeaders); - - EntityWriter realWriter = new EntityWriter() { - @Override - public void write(GenericType type, - T object, - OutputStream outputStream, - Headers requestHeaders, - WritableHeaders responseHeaders) { - if (object instanceof String) { - String maxLen5 = ((String) object).substring(0, 5); - impl.write(type, (T) maxLen5, outputStream, requestHeaders, responseHeaders); - } else { - impl.write(type, object, outputStream, requestHeaders, responseHeaders); - } - } - - @Override - public void write(GenericType type, T object, OutputStream outputStream, WritableHeaders headers) { - impl.write(type, object, outputStream, headers); - } - }; - return realWriter; - } - - @Override - public EntityReader reader(GenericType type, Headers requestHeaders, Headers responseHeaders) { - return delegated.reader(type, requestHeaders, responseHeaders); - } - - @Override - public EntityWriter writer(GenericType type, WritableHeaders requestHeaders) { - return delegated.writer(type, requestHeaders); - } - } -} diff --git a/nima/tests/integration/webclient/webclient/src/test/resources/logging-test.properties b/nima/tests/integration/webclient/webclient/src/test/resources/logging-test.properties deleted file mode 100644 index 275831c1cdc..00000000000 --- a/nima/tests/integration/webclient/webclient/src/test/resources/logging-test.properties +++ /dev/null @@ -1,25 +0,0 @@ -# -# Copyright (c) 2023 Oracle and/or its affiliates. -# -# 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. -# -handlers=java.util.logging.ConsoleHandler -java.util.logging.ConsoleHandler.level=INFO -java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter -java.util.logging.SimpleFormatter.format=%1$tH:%1$tM:%1$tS %4$s %3$s %5$s%6$s%n -# Global logging level. Can be overridden by specific loggers -.level=INFO -io.helidon.nima.level=INFO -io.helidon.nima.webclient.http1.ClientRequestImpl.level=INFO -io.helidon.nima.webclient.http1.Http1ClientConnection.level=INFO -io.helidon.common.testing.http.junit5.level=INFO diff --git a/nima/tests/integration/webserver/access-log/pom.xml b/nima/tests/integration/webserver/access-log/pom.xml deleted file mode 100644 index dfaeb26101e..00000000000 --- a/nima/tests/integration/webserver/access-log/pom.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests.integration.webserver - helidon-nima-tests-integration-webserver-project - 4.0.0-SNAPSHOT - - - helidon-nima-tests-integration-webserver-access-log - Helidon Níma Tests Integration WebServer Access Log - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.webserver - helidon-nima-webserver-access-log - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - diff --git a/nima/tests/integration/webserver/access-log/src/test/resources/logging-test.properties b/nima/tests/integration/webserver/access-log/src/test/resources/logging-test.properties deleted file mode 100644 index 6cc63d28c91..00000000000 --- a/nima/tests/integration/webserver/access-log/src/test/resources/logging-test.properties +++ /dev/null @@ -1,27 +0,0 @@ -# -# Copyright (c) 2022, 2023 Oracle and/or its affiliates. -# -# 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. -# -handlers=java.util.logging.ConsoleHandler -java.util.logging.ConsoleHandler.level=FINEST -java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter -java.util.logging.SimpleFormatter.format=%1$tH:%1$tM:%1$tS %4$s %3$s %5$s%6$s%n -# Global logging level. Can be overridden by specific loggers -.level=INFO - -io.helidon.nima.webserver.accesslog.MemoryLogHandler.level=FINEST -io.helidon.nima.webserver.accesslog.MemoryLogHandler.append=false -io.helidon.nima.webserver.AccessLog.level=INFO -io.helidon.nima.webserver.AccessLog.useParentHandlers=false -io.helidon.nima.webserver.AccessLog.handlers=io.helidon.nima.tests.integration.server.accesslog.AccessLogTest$MemoryLogHandler diff --git a/nima/tests/integration/webserver/mtls/pom.xml b/nima/tests/integration/webserver/mtls/pom.xml deleted file mode 100644 index f6e50cc81ea..00000000000 --- a/nima/tests/integration/webserver/mtls/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests.integration.webserver - helidon-nima-tests-integration-webserver-project - 4.0.0-SNAPSHOT - - - helidon-nima-tests-integration-webserver-mtls - Helidon Níma Tests Integration WebServer MTLS - Mutual TLS test - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - diff --git a/nima/tests/integration/webserver/mtls/src/main/resources/logging.properties b/nima/tests/integration/webserver/mtls/src/main/resources/logging.properties deleted file mode 100644 index 76a079c3d8f..00000000000 --- a/nima/tests/integration/webserver/mtls/src/main/resources/logging.properties +++ /dev/null @@ -1,20 +0,0 @@ -# -# Copyright (c) 2022 Oracle and/or its affiliates. -# -# 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. -# -handlers=java.util.logging.ConsoleHandler -java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS.%1$tL %5$s%6$s%n -# Global logging level. Can be overridden by specific loggers -.level=INFO - diff --git a/nima/tests/integration/webserver/mtls/src/main/resources/second-valid/server.p12 b/nima/tests/integration/webserver/mtls/src/main/resources/second-valid/server.p12 deleted file mode 100644 index 07068e4cc6e..00000000000 Binary files a/nima/tests/integration/webserver/mtls/src/main/resources/second-valid/server.p12 and /dev/null differ diff --git a/nima/tests/integration/webserver/pom.xml b/nima/tests/integration/webserver/pom.xml deleted file mode 100644 index c68812aa877..00000000000 --- a/nima/tests/integration/webserver/pom.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests.integration - helidon-nima-tests-integration-project - 4.0.0-SNAPSHOT - - - io.helidon.nima.tests.integration.webserver - helidon-nima-tests-integration-webserver-project - Helidon Níma Tests Integration WebServer Project - pom - - - webserver - access-log - mtls - static-content - - diff --git a/nima/tests/integration/webserver/static-content/pom.xml b/nima/tests/integration/webserver/static-content/pom.xml deleted file mode 100644 index 5423cbfe91a..00000000000 --- a/nima/tests/integration/webserver/static-content/pom.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests.integration.webserver - helidon-nima-tests-integration-webserver-project - 4.0.0-SNAPSHOT - - - helidon-nima-tests-integration-webserver-static-content - Helidon Níma Tests Integration WebServer Static Content - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.webserver - helidon-nima-webserver-static-content - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - diff --git a/nima/tests/integration/webserver/static-content/src/test/java/io/helidon/nima/tests/integration/server/staticcontent/StaticContentTest.java b/nima/tests/integration/webserver/static-content/src/test/java/io/helidon/nima/tests/integration/server/staticcontent/StaticContentTest.java deleted file mode 100644 index fb528bdac6b..00000000000 --- a/nima/tests/integration/webserver/static-content/src/test/java/io/helidon/nima/tests/integration/server/staticcontent/StaticContentTest.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.tests.integration.server.staticcontent; - -import io.helidon.common.http.Http; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.staticcontent.StaticContentService; - -import org.junit.jupiter.api.Test; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; - -@ServerTest -class StaticContentTest { - private final Http1Client client; - - StaticContentTest(Http1Client client) { - this.client = client; - } - - @SetUpRoute - static void routing(HttpRouting.Builder routing) { - routing.register("/files", StaticContentService.builder("static") - .welcomeFileName("welcome.txt") - .build()) - .get("/files/default", (req, res) -> res.send("Nexted")); - } - - @Test - void testWelcomeFile() { - String response = client.get("/files/") - .requestEntity(String.class); - assertThat(response, is("Welcome")); - } - - @Test - void testStaticContent() { - String response = client.get("/files/static-content.txt") - .requestEntity(String.class); - assertThat(response, is("Hi")); - } - - @Test - void testNexted() { - String response = client.get("/files/default") - .requestEntity(String.class); - assertThat(response, is("Nexted")); - } - - @Test - void testNotFound() { - try (Http1ClientResponse response = client.get("/files/notThere") - .request()) { - assertThat(response.status(), is(Http.Status.NOT_FOUND_404)); - } - } - - @Test - void testOutOfDirectory() { - try (Http1ClientResponse response = client.get("/files/../logging-test.properties") - .request()) { - assertThat(response.status(), is(Http.Status.NOT_FOUND_404)); - } - } -} diff --git a/nima/tests/integration/webserver/static-content/src/test/resources/logging-test.properties b/nima/tests/integration/webserver/static-content/src/test/resources/logging-test.properties deleted file mode 100644 index b9670589882..00000000000 --- a/nima/tests/integration/webserver/static-content/src/test/resources/logging-test.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2022 Oracle and/or its affiliates. -# -# 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. -# -handlers=java.util.logging.ConsoleHandler -java.util.logging.ConsoleHandler.level=FINEST -java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter -java.util.logging.SimpleFormatter.format=%1$tH:%1$tM:%1$tS %4$s %3$s %5$s%6$s%n -# Global logging level. Can be overridden by specific loggers -.level=INFO -io.helidon.nima.level=WARNING - diff --git a/nima/tests/integration/webserver/webserver/pom.xml b/nima/tests/integration/webserver/webserver/pom.xml deleted file mode 100644 index 8af0ac6d4ed..00000000000 --- a/nima/tests/integration/webserver/webserver/pom.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests.integration.webserver - helidon-nima-tests-integration-webserver-project - 4.0.0-SNAPSHOT - - - helidon-nima-tests-integration-webserver - Helidon Níma Tests Integration WebServer - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.junit.jupiter - junit-jupiter-params - test - - - org.hamcrest - hamcrest-all - test - - - diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/GetTest.java b/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/GetTest.java deleted file mode 100644 index 40ad28ee4fc..00000000000 --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/GetTest.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.tests.integration.server; - -import java.io.IOException; -import java.io.OutputStream; -import java.io.UncheckedIOException; -import java.util.Optional; -import java.util.Random; - -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.Header; -import io.helidon.common.http.Http.HeaderName; -import io.helidon.common.http.Http.Headers; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; - -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; - -import static io.helidon.common.http.Http.HeaderNames.CONTENT_LENGTH; -import static io.helidon.common.http.Http.Method.GET; -import static io.helidon.common.testing.http.junit5.HttpHeaderMatcher.hasHeader; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; - -@ServerTest -class GetTest { - private static final byte[] BYTES = new byte[256]; - private static final HeaderName REQUEST_HEADER_NAME = Http.HeaderNames.create("X-REquEst-HEADeR"); - private static final String REQUEST_HEADER_VALUE_STRING = "some nice value"; - private static final Header REQUEST_HEADER_VALUE = Headers.create(REQUEST_HEADER_NAME, REQUEST_HEADER_VALUE_STRING); - private static final HeaderName RESPONSE_HEADER_NAME = Http.HeaderNames.create("X-REsponSE-HeADER"); - private static final String RESPONSE_HEADER_VALUE_STRING = "another nice value"; - private static final Http.Header RESPONSE_HEADER_VALUE = Headers.create(RESPONSE_HEADER_NAME, - RESPONSE_HEADER_VALUE_STRING); - public static final Header CONTENT_LENGTH_5 = Headers.create(CONTENT_LENGTH, "5"); - - static { - Random random = new Random(); - random.nextBytes(BYTES); - } - - private final Http1Client client; - - GetTest(Http1Client client) { - this.client = client; - } - - @SetUpRoute - static void routing(HttpRouting.Builder router) { - router.route(GET, "/string", Routes::string) - .route(GET, "/bytes", Routes::bytes) - .route(GET, "/chunked", Routes::chunked) - .route(GET, "/headers", Routes::headers) - .route(GET, "/close", Routes::close) - .route(GET, "/optional", Routes::optional); - } - - @Test - void testStringRoute() { - try (Http1ClientResponse response = client.get("/string") - .request()) { - - assertThat(response.status(), is(Http.Status.OK_200)); - String entity = response.entity().as(String.class); - assertThat(entity, is("Hello")); - io.helidon.common.http.Headers headers = response.headers(); - assertThat(headers, hasHeader(CONTENT_LENGTH_5)); - assertThat(headers, hasHeader(Http.Headers.CONNECTION_KEEP_ALIVE)); - } - } - - @Test - void testByteRoute() { - try (Http1ClientResponse response = client.get("/bytes") - .request()) { - - assertThat(response.status(), is(Http.Status.OK_200)); - byte[] entity = response.entity().as(byte[].class); - assertThat(entity, is(BYTES)); - io.helidon.common.http.Headers headers = response.headers(); - assertThat(headers, hasHeader(Headers.create(CONTENT_LENGTH, String.valueOf(BYTES.length)))); - assertThat(headers, hasHeader(Http.Headers.CONNECTION_KEEP_ALIVE)); - } - } - - @Test - @Disabled("Optimization kicks in") - void testChunkedRoute() { - try (Http1ClientResponse response = client.get("/chunked") - .request()) { - - assertThat(response.status(), is(Http.Status.OK_200)); - byte[] entity = response.entity().as(byte[].class); - assertThat(entity, is(BYTES)); - io.helidon.common.http.Headers headers = response.headers(); - assertThat(headers, hasHeader(Http.Headers.TRANSFER_ENCODING_CHUNKED)); - assertThat(headers, hasHeader(Http.Headers.CONNECTION_KEEP_ALIVE)); - } - - } - - @Test - void testHeadersRoute() { - try (Http1ClientResponse response = client.get("/headers") - .header(REQUEST_HEADER_VALUE) - .request()) { - - assertThat(response.status(), is(Http.Status.OK_200)); - String entity = response.entity().as(String.class); - assertThat(entity, is("Hello")); - io.helidon.common.http.Headers headers = response.headers(); - - assertThat("Should contain echoed request header", headers, hasHeader(REQUEST_HEADER_VALUE)); - assertThat("Should contain configured response header", headers, hasHeader(RESPONSE_HEADER_VALUE)); - assertThat(headers, hasHeader(CONTENT_LENGTH_5)); - assertThat(headers, hasHeader(Http.Headers.CONNECTION_KEEP_ALIVE)); - } - } - - @Test - void testCloseRoute() { - try (Http1ClientResponse response = client.get("/close") - .request()) { - - assertThat(response.status(), is(Http.Status.OK_200)); - String entity = response.entity().as(String.class); - assertThat(entity, is("Hello")); - io.helidon.common.http.Headers headers = response.headers(); - assertThat(headers, hasHeader(CONTENT_LENGTH_5)); - assertThat(headers, hasHeader(Http.Headers.CONNECTION_CLOSE)); - } - } - - @Test - void testOptionalResponseWithValue() { - try (Http1ClientResponse response = client.get("/optional") - .request()) { - - assertThat(response.status(), is(Http.Status.OK_200)); - String entity = response.entity().as(String.class); - assertThat(entity, is("return value")); - } - } - - @Test - void testOptionalResponseEmpty() { - try (Http1ClientResponse response = client.get("/optional") - .queryParam("empty", "true") - .request()) { - - assertThat(response.status(), is(Http.Status.NOT_FOUND_404)); - assertThat(response.headers(), hasHeader(Headers.CONTENT_LENGTH_ZERO)); - } - } - - private static class Routes { - public static void optional(ServerRequest req, ServerResponse res) { - String empty = req.query().first("empty").orElse("false"); - - if ("false".equals(empty)) { - res.send(Optional.of("return value")); - } else { - res.send(Optional.empty()); - } - } - - private static void close(ServerRequest req, ServerResponse res) { - res.header(Http.Headers.CONNECTION_CLOSE); - res.send("Hello"); - } - - private static String string() { - return "Hello"; - } - - private static byte[] bytes() { - return BYTES; - } - - private static void chunked(ServerRequest req, ServerResponse res) { - try (OutputStream outputStream = res.outputStream()) { - outputStream.write(BYTES); - } catch (IOException e) { - throw new UncheckedIOException(e); - } - } - - private static void headers(ServerRequest req, ServerResponse res) { - res.header(req.headers().get(REQUEST_HEADER_NAME)); - res.header(RESPONSE_HEADER_VALUE); - res.send("Hello"); - } - } - -} diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/MediaContextTest.java b/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/MediaContextTest.java deleted file mode 100644 index 2f2f5b35183..00000000000 --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/MediaContextTest.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.tests.integration.server; - -import java.io.OutputStream; - -import io.helidon.common.GenericType; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; -import io.helidon.common.http.WritableHeaders; -import io.helidon.nima.http.media.EntityReader; -import io.helidon.nima.http.media.EntityWriter; -import io.helidon.nima.http.media.MediaContext; -import io.helidon.nima.http.media.MediaContextConfig; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.http.HttpRules; - -import org.junit.jupiter.api.Test; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; -import static org.hamcrest.core.IsEqual.equalTo; - -@ServerTest -class MediaContextTest { - - private final Http1Client client; - - public MediaContextTest(Http1Client client) { - this.client = client; - } - - @SetUpServer - static void server(WebServerConfig.Builder server) { - server.mediaContext(new CustomizedMediaContext()); - } - - @SetUpRoute - static void routing(HttpRules rules) { - rules.get("/hello", (req, res) -> res.send("hello nima")); - } - - @Test - void testCustomizeMediaContext() { - - try (Http1ClientResponse response = client.method(Http.Method.GET).uri("/hello").request()) { - String responseEntityString = response.entity().as(String.class); - assertThat(responseEntityString.length(), equalTo(5)); - assertThat(responseEntityString, is("hello")); - } - } - - private static class CustomizedMediaContext implements MediaContext { - private MediaContext delegated = MediaContext.create(); - - @Override - public MediaContextConfig prototype() { - return delegated.prototype(); - } - - @Override - public EntityReader reader(GenericType type, Headers headers) { - return delegated.reader(type, headers); - } - - @Override - public EntityWriter writer(GenericType type, Headers requestHeaders, WritableHeaders responseHeaders) { - EntityWriter impl = delegated.writer(type, requestHeaders, responseHeaders); - - EntityWriter realWriter = new EntityWriter() { - @Override - public void write(GenericType type, T object, OutputStream outputStream, Headers requestHeaders, WritableHeaders responseHeaders) { - if (object instanceof String) { - String maxLen5 = (String) ((String) object).substring(0, 5); - impl.write(type, (T) maxLen5, outputStream, requestHeaders, responseHeaders); - } else { - impl.write(type, object, outputStream, requestHeaders, responseHeaders); - } - } - - @Override - public void write(GenericType type, T object, OutputStream outputStream, WritableHeaders headers) { - impl.write(type, object, outputStream, headers); - } - }; - return realWriter; - } - - @Override - public EntityReader reader(GenericType type, Headers requestHeaders, Headers responseHeaders) { - return delegated.reader(type, requestHeaders, responseHeaders); - } - - @Override - public EntityWriter writer(GenericType type, WritableHeaders requestHeaders) { - return delegated.writer(type, requestHeaders); - } - } - -} diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/PostTest.java b/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/PostTest.java deleted file mode 100644 index 6dc69e22641..00000000000 --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/PostTest.java +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.tests.integration.server; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.UncheckedIOException; -import java.util.Random; - -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.Header; -import io.helidon.common.http.Http.HeaderName; -import io.helidon.common.http.Http.HeaderNames; -import io.helidon.common.http.Http.Headers; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.http.Handler; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; - -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; - -import static io.helidon.common.http.Http.HeaderNames.CONTENT_LENGTH; -import static io.helidon.common.testing.http.junit5.HttpHeaderMatcher.hasHeader; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.jupiter.api.Assertions.assertThrows; - -@ServerTest -class PostTest { - private static final byte[] BYTES = new byte[256]; - private static final HeaderName REQUEST_HEADER_NAME = Http.HeaderNames.create("X-REquEst-HEADeR"); - private static final String REQUEST_HEADER_VALUE_STRING = "some nice value"; - private static final Header REQUEST_HEADER_VALUE = Headers.create(REQUEST_HEADER_NAME, REQUEST_HEADER_VALUE_STRING); - private static final HeaderName RESPONSE_HEADER_NAME = HeaderNames.create("X-REsponSE-HeADER"); - private static final String RESPONSE_HEADER_VALUE_STRING = "another nice value"; - private static final Http.Header RESPONSE_HEADER_VALUE = Headers.create(RESPONSE_HEADER_NAME, - RESPONSE_HEADER_VALUE_STRING); - - static { - Random random = new Random(); - random.nextBytes(BYTES); - } - - private final Http1Client client; - - PostTest(Http1Client client) { - this.client = client; - } - - @SetUpRoute - static void routing(HttpRouting.Builder router) { - router.route(Http.Method.POST, "/string", Handler.create(String.class, Routes::string)) - .route(Http.Method.POST, "/bytes", Handler.create(byte[].class, Routes::bytes)) - .route(Http.Method.POST, "/chunked", Routes::chunked) - .route(Http.Method.POST, "/headers", Routes::headers) - .route(Http.Method.POST, "/close", Routes::close); - } - - @Test - void testStringRoute() { - io.helidon.common.http.Headers headers; - try (Http1ClientResponse response = client.method(Http.Method.POST) - .uri("/string") - .submit("Hello")) { - - assertThat(response.status(), is(Http.Status.OK_200)); - String entity = response.entity().as(String.class); - assertThat(entity, is("Hello")); - headers = response.headers(); - } - assertThat(headers, hasHeader(Headers.create(CONTENT_LENGTH, "5"))); - assertThat(headers, hasHeader(Headers.CONNECTION_KEEP_ALIVE)); - } - - @Test - void testByteRoute() { - io.helidon.common.http.Headers headers; - try (Http1ClientResponse response = client.method(Http.Method.POST) - .uri("/bytes") - .submit(BYTES)) { - - assertThat(response.status(), is(Http.Status.OK_200)); - byte[] entity = response.entity().as(byte[].class); - assertThat(entity, is(BYTES)); - headers = response.headers(); - } - assertThat(headers, hasHeader(Headers.create(CONTENT_LENGTH, String.valueOf(BYTES.length)))); - assertThat(headers, hasHeader(Headers.CONNECTION_KEEP_ALIVE)); - } - - @Test - @Disabled("Optimization kicks in") - void testChunkedRoute() { - io.helidon.common.http.Headers headers; - try (Http1ClientResponse response = client.method(Http.Method.POST) - .uri("/chunked") - .outputStream(outputStream -> { - outputStream.write(BYTES); - outputStream.close(); - })) { - - assertThat(response.status(), is(Http.Status.OK_200)); - byte[] entity = response.entity().as(byte[].class); - assertThat(entity, is(BYTES)); - headers = response.headers(); - } - assertThat(headers, hasHeader(Http.Headers.TRANSFER_ENCODING_CHUNKED)); - assertThat(headers, hasHeader(Headers.CONNECTION_KEEP_ALIVE)); - } - - @Test - void testHeadersRoute() { - io.helidon.common.http.Headers headers; - try (Http1ClientResponse response = client.method(Http.Method.POST) - .uri("/headers") - .header(REQUEST_HEADER_VALUE) - .submit("Hello")) { - - assertThat(response.status(), is(Http.Status.OK_200)); - String entity = response.entity().as(String.class); - assertThat(entity, is("Hello")); - headers = response.headers(); - } - assertThat(headers, hasHeader(Headers.create(CONTENT_LENGTH, "5"))); - assertThat(headers, hasHeader(Headers.CONNECTION_KEEP_ALIVE)); - assertThat(headers, hasHeader(REQUEST_HEADER_VALUE)); - assertThat(headers, hasHeader(RESPONSE_HEADER_VALUE)); - } - - @Test - void testCloseRoute() { - io.helidon.common.http.Headers headers; - try (Http1ClientResponse response = client.method(Http.Method.POST) - .uri("/close") - .submit("Hello")) { - - assertThat(response.status(), is(Http.Status.NO_CONTENT_204)); - assertThrows(IllegalStateException.class, () -> response.entity().as(String.class)); - headers = response.headers(); - } - assertThat(headers, hasHeader(Headers.CONNECTION_CLOSE)); - } - - private static class Routes { - public static void close(ServerRequest req, ServerResponse res) { - res.header(Headers.CONNECTION_CLOSE); - res.status(Http.Status.NO_CONTENT_204); - res.send(); - } - - private static String string(String request) { - return request; - } - - private static byte[] bytes(byte[] bytes) { - return bytes; - } - - private static void chunked(ServerRequest req, ServerResponse res) { - byte[] buffer = new byte[512]; - try (InputStream inputStream = req.content().inputStream(); OutputStream outputStream = res.outputStream()) { - int read; - while ((read = inputStream.read(buffer)) > 0) { - outputStream.write(buffer, 0, read); - } - } catch (IOException e) { - throw new UncheckedIOException(e); - } - } - - private static void headers(ServerRequest req, ServerResponse res) { - System.out.println("Headers"); - res.header(req.headers().get(REQUEST_HEADER_NAME)); - res.header(RESPONSE_HEADER_VALUE); - String entity = req.content().as(String.class); - res.send(entity); - } - } - -} diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/RoutingTest.java b/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/RoutingTest.java deleted file mode 100644 index be5ebfae283..00000000000 --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/RoutingTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.tests.integration.server; - -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webserver.WebServerConfig; - -@ServerTest -class RoutingTest extends RoutingTestBase { - - RoutingTest(Http1Client client) { - this.client = client; - } - - @SetUpServer - static void setUp(WebServerConfig.Builder builder) { - builder.routing(routing -> routing - .get("/my path", (req, res) -> res.send("done")) - .get("/českáCesta", (req, res) -> res.send("done")) - // shortcut methods with path matchers - .get("/wildcard_*", (req, res) -> res.send("wildcard_test1")) - .post("/wildcard/*", (req, res) -> res.send("wildcard_test2")) - // shortcut methods with path - .get("/get", (req, res) -> res.send("get")) - .post("/post", (req, res) -> res.send("post")) - .put("/put", (req, res) -> res.send("put")) - .delete("/delete", (req, res) -> res.send("delete")) - .head("/head", (req, res) -> res.send("head")) - .options("/options", (req, res) -> res.send("options")) - .trace("/trace", (req, res) -> res.send("trace")) - .patch("/patch", (req, res) -> res.send("patch")) - .any("/any", (req, res) -> res.send("any")) - // shortcut methods using multiple handlers - .get("/get_multi", RoutingTestBase::multiHandler, (req, res) -> res.send("get_multi")) - .post("/post_multi", RoutingTestBase::multiHandler, (req, res) -> res.send("post_multi")) - .put("/put_multi", RoutingTestBase::multiHandler, (req, res) -> res.send("put_multi")) - .delete("/delete_multi", RoutingTestBase::multiHandler, (req, res) -> res.send("delete_multi")) - .head("/head_multi", RoutingTestBase::multiHandler, (req, res) -> res.send("head_multi")) - .options("/options_multi", - RoutingTestBase::multiHandler, - (req, res) -> res.send("options_multi")) - .trace("/trace_multi", RoutingTestBase::multiHandler, (req, res) -> res.send("trace_multi")) - .patch("/patch_multi", RoutingTestBase::multiHandler, (req, res) -> res.send("patch_multi")) - // shortcut methods with no path pattern - .get((req, res) -> res.send("get_catchall")) - .post((req, res) -> res.send("post_catchall")) - .put((req, res) -> res.send("put_catchall")) - .delete((req, res) -> res.send("delete_catchall")) - .head((req, res) -> res.send("head_catchall")) - .options((req, res) -> res.send("options_catchall")) - .trace((req, res) -> res.send("trace_catchall")) - .patch((req, res) -> res.send("patch_catchall"))); - } -} diff --git a/nima/tests/integration/webserver/webserver/src/test/resources/logging-test.properties b/nima/tests/integration/webserver/webserver/src/test/resources/logging-test.properties deleted file mode 100644 index e17e2657367..00000000000 --- a/nima/tests/integration/webserver/webserver/src/test/resources/logging-test.properties +++ /dev/null @@ -1,26 +0,0 @@ -# -# Copyright (c) 2022, 2023 Oracle and/or its affiliates. -# -# 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. -# -handlers=java.util.logging.ConsoleHandler -java.util.logging.ConsoleHandler.level=FINEST -java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter -java.util.logging.SimpleFormatter.format=%1$tH:%1$tM:%1$tS %4$s %3$s %5$s%6$s%n -# Global logging level. Can be overridden by specific loggers -.level=INFO -io.helidon.nima.level=INFO -io.helidon.nima.webserver.http.Http1Connection.level=INFO -io.helidon.nima.webserver.http.HttpRouting.level=INFO -io.helidon.common.testing.http.junit5.level=INFO - diff --git a/nima/tests/integration/websocket/pom.xml b/nima/tests/integration/websocket/pom.xml deleted file mode 100644 index e40bf0b3aca..00000000000 --- a/nima/tests/integration/websocket/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests.integration - helidon-nima-tests-integration-project - 4.0.0-SNAPSHOT - - - io.helidon.nima.tests.integration.websocket - helidon-nima-tests-integration-websocket-project - Helidon Níma Tests Integration WebSocket Project - pom - - - server - - diff --git a/nima/tests/integration/websocket/server/pom.xml b/nima/tests/integration/websocket/server/pom.xml deleted file mode 100644 index 2a8b51d7b8e..00000000000 --- a/nima/tests/integration/websocket/server/pom.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.tests.integration.websocket - helidon-nima-tests-integration-websocket-project - 4.0.0-SNAPSHOT - - - helidon-nima-tests-integration-websocket-webserver - Helidon Níma Tests Integration WebSocket WebServer - - - - io.helidon.nima.websocket - helidon-nima-websocket-webserver - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - diff --git a/nima/tests/integration/websocket/server/src/main/resources/logging.properties b/nima/tests/integration/websocket/server/src/main/resources/logging.properties deleted file mode 100644 index 3a2ccac5c46..00000000000 --- a/nima/tests/integration/websocket/server/src/main/resources/logging.properties +++ /dev/null @@ -1,20 +0,0 @@ -# -# Copyright (c) 2022 Oracle and/or its affiliates. -# -# 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. -# -handlers=java.util.logging.ConsoleHandler -java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS.%1$tL %5$s%6$s%n -# Global logging level. Can be overridden by specific loggers -.level=INFO -io.helidon.nima.level=INFO diff --git a/nima/tests/pom.xml b/nima/tests/pom.xml deleted file mode 100644 index bb5984828f5..00000000000 --- a/nima/tests/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - 4.0.0 - - - io.helidon.nima - helidon-nima-project - 4.0.0-SNAPSHOT - ../pom.xml - - - io.helidon.nima.tests - helidon-nima-tests-project - Helidon Níma Tests Project - - pom - - - benchmark - integration - - - - true - true - true - true - true - true - true - - diff --git a/nima/webclient/api/etc/spotbugs/exclude.xml b/nima/webclient/api/etc/spotbugs/exclude.xml deleted file mode 100644 index aba3c07cd27..00000000000 --- a/nima/webclient/api/etc/spotbugs/exclude.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/nima/webclient/api/pom.xml b/nima/webclient/api/pom.xml deleted file mode 100644 index f35b5f133e2..00000000000 --- a/nima/webclient/api/pom.xml +++ /dev/null @@ -1,158 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.webclient - helidon-nima-webclient-project - 4.0.0-SNAPSHOT - ../pom.xml - - - helidon-nima-webclient-api - Helidon Níma WebClient API - - - etc/spotbugs/exclude.xml - - - - - io.helidon.common - helidon-common-http - - - io.helidon.common - helidon-common-socket - - - io.helidon.common - helidon-common-key-util - - - io.helidon.nima.common - helidon-nima-common-tls - - - io.helidon.common - helidon-common-config - - - io.helidon.nima.http.media - helidon-nima-http-media - - - io.helidon.nima.http.encoding - helidon-nima-http-encoding - - - io.helidon.common - helidon-common-context - - - io.helidon.common.features - helidon-common-features-api - true - - - io.helidon.config - helidon-config-metadata - true - - - io.helidon.builder - helidon-builder-api - - - io.helidon.inject.configdriven - helidon-inject-configdriven-api - true - - - io.helidon.inject.configdriven - helidon-inject-configdriven-runtime - true - - - org.junit.jupiter - junit-jupiter-api - test - - - junit-jupiter-params - org.junit.jupiter - test - - - org.hamcrest - hamcrest-all - test - - - io.helidon.common.testing - helidon-common-testing-http-junit5 - test - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - io.helidon.builder - helidon-builder-processor - ${helidon.version} - - - io.helidon.inject.configdriven - helidon-inject-configdriven-processor - ${helidon.version} - - - - - - io.helidon.inject.configdriven - helidon-inject-configdriven-processor - ${helidon.version} - - - io.helidon.builder - helidon-builder-processor - ${helidon.version} - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - - - - diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ProtocolConfigs.java b/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ProtocolConfigs.java deleted file mode 100644 index d5138305b96..00000000000 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ProtocolConfigs.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.webclient.api; - -import java.util.List; -import java.util.Objects; -import java.util.function.Supplier; - -import io.helidon.nima.webclient.spi.ProtocolConfig; - -/** - * Protocol configuration to obtain explicitly configured details for the current socket. - */ -class ProtocolConfigs { - private final List protocolConfigs; - - private ProtocolConfigs(List protocolConfigs) { - this.protocolConfigs = List.copyOf(protocolConfigs); - } - - /** - * Create new protocol configuration handler. - * - * @param protocolConfigs all available protocol configurations. - * @return protocol configuration handler - */ - public static ProtocolConfigs create(List protocolConfigs) { - Objects.requireNonNull(protocolConfigs); - return new ProtocolConfigs(protocolConfigs); - } - - /** - * Get a protocol configuration if defined. - * - * @param protocolType type of the protocol, to distinguish between protocols - * (two protocols may use the same configuration class) - * @param protocolConfigType type of the expected configuration (same protocol type may use different configuration - * class) - * @param type of the expected protocol configuration - * @return protocol configuration(s) to use, if empty, this protocol should not be used - */ - public T config(String protocolType, - Class protocolConfigType, - Supplier defaultConfigSupplier) { - Objects.requireNonNull(protocolType); - Objects.requireNonNull(protocolConfigType); - - return protocolConfigs.stream() - .filter(it -> protocolType.equals(it.type())) - .filter(it -> protocolConfigType.isAssignableFrom(it.getClass())) - .map(protocolConfigType::cast) - .findFirst() - .orElseGet(defaultConfigSupplier); - } -} diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/package-info.java b/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/package-info.java deleted file mode 100644 index 2664163ebea..00000000000 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * WebClient APIs shared by all types of clients. - */ -package io.helidon.nima.webclient.api; diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/ProtocolConfig.java b/nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/ProtocolConfig.java deleted file mode 100644 index 64c3ad048ff..00000000000 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/ProtocolConfig.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.webclient.spi; - -import io.helidon.common.config.NamedService; - -/** - * Client protocol configuration. - */ -public interface ProtocolConfig extends NamedService { -} diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/ProtocolConfigProvider.java b/nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/ProtocolConfigProvider.java deleted file mode 100644 index f42741519eb..00000000000 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/ProtocolConfigProvider.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.webclient.spi; - -import io.helidon.common.config.ConfiguredProvider; - -/** - * Client protocol configuration. - * - * @param type of configuration supported by this provider - */ -public interface ProtocolConfigProvider extends ConfiguredProvider { -} diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/WebClientService.java b/nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/WebClientService.java deleted file mode 100644 index 3291614055f..00000000000 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/WebClientService.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.webclient.spi; - - -import io.helidon.common.config.NamedService; -import io.helidon.nima.webclient.api.WebClientServiceRequest; -import io.helidon.nima.webclient.api.WebClientServiceResponse; - -/** - * Extension that can modify web client behavior. - * This is now only designed for HTTP/1 - */ -@FunctionalInterface -public interface WebClientService extends NamedService { - @Override - default String name() { - return "@default"; - } - - @Override - default String type() { - return "inlined-service"; - } - - /** - * Invoke a service, call {@link Chain#proceed(io.helidon.nima.webclient.api.WebClientServiceRequest)} to call the - * next service in the chain. - * - * @param chain to invoke next web client service, or the HTTP call if this is the last service - * @param clientRequest request from the client, or previous services - * @return response to be returned to the client - */ - WebClientServiceResponse handle(Chain chain, WebClientServiceRequest clientRequest); - - /** - * Chain of services. - */ - interface Chain { - /** - * Proceed with invocation of the next service, or the HTTP call. - * This method is always fully blocking. - * - * @param clientRequest request - * @return response from the next service or HTTP call - */ - WebClientServiceResponse proceed(WebClientServiceRequest clientRequest); - } -} diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/package-info.java b/nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/package-info.java deleted file mode 100644 index 7ed73881d86..00000000000 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/package-info.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Interfaces to be implemented by new clients. - * These do not use {@link java.util.ServiceLoader}. - */ -package io.helidon.nima.webclient.spi; diff --git a/nima/webclient/api/src/main/java/module-info.java b/nima/webclient/api/src/main/java/module-info.java deleted file mode 100644 index 99cc650eacd..00000000000 --- a/nima/webclient/api/src/main/java/module-info.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.common.features.api.Feature; -import io.helidon.common.features.api.HelidonFlavor; - -/** - * WebClient API and HTTP/1.1 implementation. - */ -@Feature(value = "Web Client", - description = "Web Client", - in = HelidonFlavor.SE, - path = "Web Client" -) -module io.helidon.nima.webclient.api { - // @Feature - requires static io.helidon.common.features.api; - // @ConfiguredOption etc - requires static io.helidon.config.metadata; - requires static io.helidon.inject.configdriven.api; - requires static io.helidon.inject.configdriven.runtime; - // Injection support - requires static jakarta.inject; - - // @Builder - interfaces are a runtime dependency - requires io.helidon.builder.api; - - requires transitive io.helidon.common; - requires transitive io.helidon.common.context; - requires transitive io.helidon.common.http; - requires transitive io.helidon.common.configurable; - requires transitive io.helidon.common.socket; - requires transitive io.helidon.common.uri; - requires transitive io.helidon.nima.common.tls; - requires transitive io.helidon.nima.http.encoding; - requires transitive io.helidon.nima.http.media; - requires transitive io.helidon.common.config; - - exports io.helidon.nima.webclient.api; - exports io.helidon.nima.webclient.spi; - - uses io.helidon.nima.webclient.spi.DnsResolverProvider; - uses io.helidon.nima.webclient.spi.SourceHandlerProvider; - uses io.helidon.nima.webclient.spi.WebClientServiceProvider; - uses io.helidon.nima.webclient.spi.ProtocolConfigProvider; - uses io.helidon.nima.webclient.spi.HttpClientSpiProvider; -} diff --git a/nima/webclient/dns-resolver/first/pom.xml b/nima/webclient/dns-resolver/first/pom.xml deleted file mode 100644 index 7744e4b2aab..00000000000 --- a/nima/webclient/dns-resolver/first/pom.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.webclient.dns.resolver - helidon-nima-webclient-dns-resolver-project - 4.0.0-SNAPSHOT - ../pom.xml - - - helidon-nima-webclient-dns-resolver-first - Helidon Níma WebClient DNS Resolver First - DNS resolver that uses the first address from DNS lookup - - - - io.helidon.nima.webclient - helidon-nima-webclient-api - - - org.junit.jupiter - junit-jupiter-api - test - - - diff --git a/nima/webclient/dns-resolver/first/src/main/java/io/helidon/nima/webclient/dns/resolver/first/package-info.java b/nima/webclient/dns-resolver/first/src/main/java/io/helidon/nima/webclient/dns/resolver/first/package-info.java deleted file mode 100644 index 02ed0decbfe..00000000000 --- a/nima/webclient/dns-resolver/first/src/main/java/io/helidon/nima/webclient/dns/resolver/first/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * DNS resolver implementation that uses the first address from DNS lookup. - */ -package io.helidon.nima.webclient.dns.resolver.first; diff --git a/nima/webclient/dns-resolver/first/src/main/java/module-info.java b/nima/webclient/dns-resolver/first/src/main/java/module-info.java deleted file mode 100644 index ced8df15e22..00000000000 --- a/nima/webclient/dns-resolver/first/src/main/java/module-info.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * DNS resolver implementation that uses the first address from DNS lookup. - */ -module io.helidon.nima.webclient.dns.resolver.first { - requires io.helidon.nima.webclient.api; - - exports io.helidon.nima.webclient.dns.resolver.first; - - provides io.helidon.nima.webclient.spi.DnsResolverProvider - with io.helidon.nima.webclient.dns.resolver.first.FirstDnsResolverProvider; -} \ No newline at end of file diff --git a/nima/webclient/dns-resolver/pom.xml b/nima/webclient/dns-resolver/pom.xml deleted file mode 100644 index d0cd72ebace..00000000000 --- a/nima/webclient/dns-resolver/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.webclient - helidon-nima-webclient-project - 4.0.0-SNAPSHOT - ../pom.xml - - - pom - - io.helidon.nima.webclient.dns.resolver - helidon-nima-webclient-dns-resolver-project - Helidon Níma WebClient DNS Resolver Project - - - first - round-robin - - - diff --git a/nima/webclient/dns-resolver/round-robin/pom.xml b/nima/webclient/dns-resolver/round-robin/pom.xml deleted file mode 100644 index 19281a8f69e..00000000000 --- a/nima/webclient/dns-resolver/round-robin/pom.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.webclient.dns.resolver - helidon-nima-webclient-dns-resolver-project - 4.0.0-SNAPSHOT - ../pom.xml - - - helidon-nima-webclient-dns-resolver-round-robin - Helidon Níma WebClient DNS Resolver Round Robin - DNS resolver that cycles through addresses from DNS lookup - - - - io.helidon.nima.webclient - helidon-nima-webclient-api - - - diff --git a/nima/webclient/dns-resolver/round-robin/src/main/java/io/helidon/nima/webclient/dns/resolver/roundrobin/package-info.java b/nima/webclient/dns-resolver/round-robin/src/main/java/io/helidon/nima/webclient/dns/resolver/roundrobin/package-info.java deleted file mode 100644 index 44e10c14e5f..00000000000 --- a/nima/webclient/dns-resolver/round-robin/src/main/java/io/helidon/nima/webclient/dns/resolver/roundrobin/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * DNS resolver implementation that cycles through addresses from DNS lookup. - */ -package io.helidon.nima.webclient.dns.resolver.roundrobin; diff --git a/nima/webclient/dns-resolver/round-robin/src/main/java/module-info.java b/nima/webclient/dns-resolver/round-robin/src/main/java/module-info.java deleted file mode 100644 index 1f15b014cae..00000000000 --- a/nima/webclient/dns-resolver/round-robin/src/main/java/module-info.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * DNS resolver implementation that cycles through addresses from DNS lookup. - */ -module io.helidon.nima.webclient.dns.resolver.roundrobin { - requires io.helidon.nima.webclient.api; - - exports io.helidon.nima.webclient.dns.resolver.roundrobin; - - provides io.helidon.nima.webclient.spi.DnsResolverProvider - with io.helidon.nima.webclient.dns.resolver.roundrobin.RoundRobinDnsResolverProvider; -} \ No newline at end of file diff --git a/nima/webclient/http1/etc/spotbugs/exclude.xml b/nima/webclient/http1/etc/spotbugs/exclude.xml deleted file mode 100644 index 8b2aef8f37f..00000000000 --- a/nima/webclient/http1/etc/spotbugs/exclude.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - diff --git a/nima/webclient/http1/pom.xml b/nima/webclient/http1/pom.xml deleted file mode 100644 index 78fc8fb1366..00000000000 --- a/nima/webclient/http1/pom.xml +++ /dev/null @@ -1,162 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.webclient - helidon-nima-webclient-project - 4.0.0-SNAPSHOT - ../pom.xml - - - helidon-nima-webclient-http1 - Helidon Níma WebClient HTTP/1.1 - - - etc/spotbugs/exclude.xml - - - - - io.helidon.nima.webclient - helidon-nima-webclient-api - - - io.helidon.common - helidon-common-http - - - io.helidon.common - helidon-common-socket - - - io.helidon.common - helidon-common-key-util - - - io.helidon.nima.common - helidon-nima-common-tls - - - io.helidon.common - helidon-common-config - - - io.helidon.nima.http.media - helidon-nima-http-media - - - io.helidon.nima.http.encoding - helidon-nima-http-encoding - - - io.helidon.common - helidon-common-context - - - io.helidon.common.features - helidon-common-features-api - true - - - io.helidon.config - helidon-config-metadata - true - - - io.helidon.builder - helidon-builder-api - - - io.helidon.inject.configdriven - helidon-inject-configdriven-api - true - - - io.helidon.inject.configdriven - helidon-inject-configdriven-runtime - true - - - org.junit.jupiter - junit-jupiter-api - test - - - junit-jupiter-params - org.junit.jupiter - test - - - org.hamcrest - hamcrest-all - test - - - io.helidon.common.testing - helidon-common-testing-http-junit5 - test - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - io.helidon.builder - helidon-builder-processor - ${helidon.version} - - - io.helidon.inject.configdriven - helidon-inject-configdriven-processor - ${helidon.version} - - - - - - io.helidon.inject.configdriven - helidon-inject-configdriven-processor - ${helidon.version} - - - io.helidon.builder - helidon-builder-processor - ${helidon.version} - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - - - - diff --git a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ProtocolConfigProvider.java b/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ProtocolConfigProvider.java deleted file mode 100644 index 65d48d5a7c4..00000000000 --- a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ProtocolConfigProvider.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.webclient.http1; - -import io.helidon.common.config.Config; -import io.helidon.nima.webclient.spi.ProtocolConfigProvider; - -/** - * Implementation of protocol config provider. - */ -public class Http1ProtocolConfigProvider implements ProtocolConfigProvider { - /** - * Required to be used by {@link java.util.ServiceLoader}. - * @deprecated do not use directly, use Http1ClientProtocol - */ - public Http1ProtocolConfigProvider() { - } - - @Override - public String configKey() { - return Http1ProtocolProvider.CONFIG_KEY; - } - - @Override - public Http1ClientProtocolConfig create(Config config, String name) { - return Http1ClientProtocolConfig.builder() - .config(config) - .name(name) - .build(); - } -} diff --git a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/package-info.java b/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/package-info.java deleted file mode 100644 index b8cb98a86f6..00000000000 --- a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * HTTP/1.1 WebClient. - */ -package io.helidon.nima.webclient.http1; diff --git a/nima/webclient/http1/src/main/java/module-info.java b/nima/webclient/http1/src/main/java/module-info.java deleted file mode 100644 index 79dfbf97a07..00000000000 --- a/nima/webclient/http1/src/main/java/module-info.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.common.features.api.Feature; -import io.helidon.common.features.api.HelidonFlavor; - -/** - * WebClient API and HTTP/1.1 implementation. - */ -@Feature(value = "HTTP/1.1", - description = "Web Client HTTP/1.1 support", - in = HelidonFlavor.SE, - path = {"Web Client", "HTTP/1.1"} -) -module io.helidon.nima.webclient.http1 { - uses io.helidon.nima.webclient.spi.SourceHandlerProvider; - requires static io.helidon.common.features.api; - // @ConfiguredOption etc - requires static io.helidon.config.metadata; - - requires transitive io.helidon.nima.webclient.api; - // @Builder - interfaces are a runtime dependency - requires io.helidon.builder.api; - - exports io.helidon.nima.webclient.http1; - - provides io.helidon.nima.webclient.spi.HttpClientSpiProvider - with io.helidon.nima.webclient.http1.Http1ClientSpiProvider; - provides io.helidon.nima.webclient.spi.ProtocolConfigProvider - with io.helidon.nima.webclient.http1.Http1ProtocolConfigProvider; -} \ No newline at end of file diff --git a/nima/webclient/http1/src/test/java/io/helidon/nima/webclient/http1/Http1ClientTest.java b/nima/webclient/http1/src/test/java/io/helidon/nima/webclient/http1/Http1ClientTest.java deleted file mode 100644 index 0fb203b88aa..00000000000 --- a/nima/webclient/http1/src/test/java/io/helidon/nima/webclient/http1/Http1ClientTest.java +++ /dev/null @@ -1,829 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.webclient.http1; - -import java.io.OutputStream; -import java.net.URI; -import java.nio.charset.StandardCharsets; -import java.time.Duration; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.StringTokenizer; -import java.util.concurrent.ArrayBlockingQueue; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; -import java.util.stream.Stream; - -import io.helidon.common.GenericType; -import io.helidon.common.buffers.BufferData; -import io.helidon.common.buffers.Bytes; -import io.helidon.common.buffers.DataReader; -import io.helidon.common.buffers.DataWriter; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http1HeadersParser; -import io.helidon.common.http.WritableHeaders; -import io.helidon.common.socket.HelidonSocket; -import io.helidon.common.socket.PeerInfo; -import io.helidon.nima.http.media.EntityReader; -import io.helidon.nima.http.media.EntityWriter; -import io.helidon.nima.http.media.MediaContext; -import io.helidon.nima.http.media.MediaContextConfig; -import io.helidon.nima.webclient.api.ClientConnection; -import io.helidon.nima.webclient.api.HttpClientResponse; - -import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.Arguments; -import org.junit.jupiter.params.provider.MethodSource; - -import static io.helidon.common.testing.http.junit5.HttpHeaderMatcher.hasHeader; -import static io.helidon.common.testing.http.junit5.HttpHeaderMatcher.noHeader; -import static org.hamcrest.CoreMatchers.containsString; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.startsWith; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.params.provider.Arguments.arguments; - -class Http1ClientTest { - public static final String VALID_HEADER_VALUE = "Valid-Header-Value"; - public static final String VALID_HEADER_NAME = "Valid-Header-Name"; - public static final String BAD_HEADER_PATH = "/badHeader"; - public static final String HEADER_NAME_VALUE_DELIMETER = "->"; - private static final Http.Header REQ_CHUNKED_HEADER = Http.Headers.create( - Http.HeaderNames.create("X-Req-Chunked"), "true"); - private static final Http.Header REQ_EXPECT_100_HEADER_NAME = Http.Headers.create( - Http.HeaderNames.create("X-Req-Expect100"), "true"); - private static final Http.HeaderName REQ_CONTENT_LENGTH_HEADER_NAME = Http.HeaderNames.create("X-Req-ContentLength"); - private static final long NO_CONTENT_LENGTH = -1L; - private static final Http1Client client = Http1Client.builder() - .sendExpectContinue(false) - .build(); - private static final int dummyPort = 1234; - - @Test - void testMaxHeaderSizeFail() { - Http1Client client = Http1Client.create(builder -> builder.protocolConfig(pc -> pc.maxHeaderSize(15))); - - validateFailedResponse(client, new FakeHttp1ClientConnection(), "Header size exceeded"); - } - - @Test - void testMaxHeaderSizeSuccess() { - Http1Client client = Http1Client.builder() - .protocolConfig(pc -> pc.maxHeaderSize(500)) - .build(); - - validateSuccessfulResponse(client, new FakeHttp1ClientConnection()); - } - - @Test - void testMaxStatusLineLengthFail() { - Http1Client client = Http1Client.builder() - .protocolConfig(it -> it.maxStatusLineLength(1)) - .build(); - validateFailedResponse(client, new FakeHttp1ClientConnection(), "HTTP Response did not contain HTTP status line"); - } - - @Test - void testMaxHeaderLineLengthSuccess() { - Http1Client client = Http1Client.builder() - .protocolConfig(it -> it.maxStatusLineLength(20)) - .build(); - validateSuccessfulResponse(client, new FakeHttp1ClientConnection()); - } - - @Test - void testMediaContext() { - Http1Client client = Http1Client.builder() - .mediaContext(new CustomizedMediaContext()) - .build(); - validateSuccessfulResponse(client, new FakeHttp1ClientConnection()); - } - - @Test - void testChunk() { - String[] requestEntityParts = {"First", "Second", "Third"}; - - Http1ClientRequest request = getHttp1ClientRequest(Http.Method.PUT, "/test"); - request.connection(new FakeHttp1ClientConnection()); - Http1ClientResponse response = getHttp1ClientResponseFromOutputStream(request, requestEntityParts); - - validateChunkTransfer(response, true, NO_CONTENT_LENGTH, String.join("", requestEntityParts)); - } - - @Test - void testNoChunk() { - String[] requestEntityParts = {"First"}; - long contentLength = requestEntityParts[0].length(); - - Http1ClientRequest request = getHttp1ClientRequest(Http.Method.PUT, "/test") - .header(Http.HeaderNames.CONTENT_LENGTH, String.valueOf(contentLength)); - request.connection(new FakeHttp1ClientConnection()); - Http1ClientResponse response = getHttp1ClientResponseFromOutputStream(request, requestEntityParts); - - validateChunkTransfer(response, false, contentLength, requestEntityParts[0]); - } - - @Test - void testForcedChunkNoContentLength() { - String[] requestEntityParts = {"First"}; - - Http1ClientRequest request = getHttp1ClientRequest(Http.Method.PUT, "/test"); - request.connection(new FakeHttp1ClientConnection()); - Http1ClientResponse response = getHttp1ClientResponseFromOutputStream(request, requestEntityParts); - - validateChunkTransfer(response, true, NO_CONTENT_LENGTH, requestEntityParts[0]); - } - - @Test - void testForcedChunkTransferEncodingChunked() { - String[] requestEntityParts = {"First"}; - - Http1ClientRequest request = getHttp1ClientRequest(Http.Method.PUT, "/test") - .header(Http.Headers.TRANSFER_ENCODING_CHUNKED); - request.connection(new FakeHttp1ClientConnection()); - Http1ClientResponse response = getHttp1ClientResponseFromOutputStream(request, requestEntityParts); - - validateChunkTransfer(response, true, NO_CONTENT_LENGTH, requestEntityParts[0]); - } - - @Test - void testExpect100() { - String[] requestEntityParts = {"First", "Second", "Third"}; - - Http1Client client = Http1Client.builder() - .sendExpectContinue(true) - .build(); - Http1ClientRequest request = client.put("http://localhost:" + dummyPort + "/test"); - request.connection(new FakeHttp1ClientConnection()); - - Http1ClientResponse response = getHttp1ClientResponseFromOutputStream(request, requestEntityParts); - - validateChunkTransfer(response, true, NO_CONTENT_LENGTH, String.join("", requestEntityParts)); - assertThat(response.headers(), hasHeader(REQ_EXPECT_100_HEADER_NAME)); - } - - // validates that HEAD is not allowed with entity payload - @Test - void testHeadMethod() { - String url = "http://localhost:" + dummyPort + "/test"; - ClientConnection http1ClientConnection = new FakeHttp1ClientConnection(); - assertThrows(IllegalArgumentException.class, () -> - client.head(url).connection(http1ClientConnection).submit("Foo Bar")); - assertThrows(IllegalArgumentException.class, () -> - client.head(url).connection(http1ClientConnection).outputStream(it -> { - it.write("Foo Bar".getBytes(StandardCharsets.UTF_8)); - it.close(); - })); - client.head(url).connection(http1ClientConnection).request(); - http1ClientConnection.closeResource(); - } - - @Test - void testSkipUrlEncoding() { - //Fill with chars which should be encoded - Http1ClientRequest request = getHttp1ClientRequest(Http.Method.PUT, "/ěščžř") - .queryParam("specialChar+", "someValue,").fragment("someFragment,"); - URI uri = request.resolvedUri().toUri(); - assertThat(uri.getRawPath(), is("/%C4%9B%C5%A1%C4%8D%C5%BE%C5%99")); - assertThat(uri.getRawQuery(), is("specialChar%2B=someValue%2C")); - assertThat(uri.getRawFragment(), is("someFragment%2C")); - - request = request.skipUriEncoding(true); - uri = request.resolvedUri().toUri(); - assertThat(uri.getRawPath(), is("/ěščžř")); - assertThat(uri.getRawQuery(), is("specialChar+=someValue,")); - assertThat(uri.getRawFragment(), is("someFragment,")); - } - - @ParameterizedTest - @MethodSource("relativeUris") - void testRelativeUris(boolean relativeUris, boolean outputStream, String requestUri, String expectedUriStart) { - Http1Client client = Http1Client.builder().relativeUris(relativeUris).build(); - FakeHttp1ClientConnection connection = new FakeHttp1ClientConnection(); - Http1ClientRequest request = client.put(requestUri); - request.connection(connection); - HttpClientResponse response; - if (outputStream) { - response = getHttp1ClientResponseFromOutputStream(request, new String[] {"Sending Something"}); - } else { - response = request.submit("Sending Something"); - } - - assertThat(response.status(), is(Http.Status.OK_200)); - StringTokenizer st = new StringTokenizer(connection.getPrologue(), " "); - // skip method part - st.nextToken(); - // Validate URI part - assertThat(st.nextToken(), startsWith(expectedUriStart)); - } - - @ParameterizedTest - @MethodSource("headerValues") - void testHeaderValues(List headerValues, boolean expectsValid) { - Http1Client clientValidateRequestHeaders = Http1Client.builder() - .protocolConfig(it -> { - it.validateRequestHeaders(true); - it.validateResponseHeaders(false); - }) - .build(); - Http1ClientRequest request = clientValidateRequestHeaders.get("http://localhost:" + dummyPort + "/test"); - request.header(Http.Headers.create("HeaderName", headerValues)); - request.connection(new FakeHttp1ClientConnection()); - if (expectsValid) { - HttpClientResponse response = request.request(); - assertThat(response.status(), is(Http.Status.OK_200)); - } else { - assertThrows(IllegalArgumentException.class, () -> request.request()); - } - } - - @ParameterizedTest - @MethodSource("headers") - void testHeaders(Http.Header header, boolean expectsValid) { - Http1Client clientValidateRequestHeaders = Http1Client.builder() - .protocolConfig(it -> { - it.validateRequestHeaders(true); - it.validateResponseHeaders(false); - }) - .build(); - Http1ClientRequest request = clientValidateRequestHeaders.get("http://localhost:" + dummyPort + "/test"); - request.connection(new FakeHttp1ClientConnection()); - request.header(header); - if (expectsValid) { - HttpClientResponse response = request.request(); - assertThat(response.status(), is(Http.Status.OK_200)); - } else { - assertThrows(IllegalArgumentException.class, () -> request.request()); - } - } - - @ParameterizedTest - @MethodSource("headers") - void testDisableHeaderValidation(Http.Header header, boolean expectsValid) { - Http1Client clientWithDisabledHeaderValidation = Http1Client.builder() - .protocolConfig(it -> { - it.validateRequestHeaders(false); - it.validateResponseHeaders(false); - }) - .build(); - Http1ClientRequest request = clientWithDisabledHeaderValidation.put("http://localhost:" + dummyPort + "/test"); - request.header(header); - request.connection(new FakeHttp1ClientConnection()); - HttpClientResponse response = request.submit("Sending Something"); - if (expectsValid) { - assertThat(response.status(), is(Http.Status.OK_200)); - } else { - assertThat(response.status(), is(Http.Status.BAD_REQUEST_400)); - } - } - - @ParameterizedTest - @MethodSource("responseHeaders") - void testHeadersFromResponse(String headerName, String headerValue, boolean expectsValid) { - Http1Client clientValidateResponseHeaders = Http1Client.builder() - .protocolConfig(it -> { - it.validateRequestHeaders(false); - it.validateResponseHeaders(true); - }) - .build(); - Http1ClientRequest request = clientValidateResponseHeaders.get("http://localhost:" + dummyPort + BAD_HEADER_PATH); - request.connection(new FakeHttp1ClientConnection()); - String headerNameAndValue = headerName + HEADER_NAME_VALUE_DELIMETER + headerValue; - if (expectsValid) { - HttpClientResponse response = request.submit(headerNameAndValue); - assertThat(response.status(), is(Http.Status.OK_200)); - String responseHeaderValue = response.headers().get(Http.HeaderNames.create(headerName)).values(); - assertThat(responseHeaderValue, is(headerValue.trim())); - } else { - assertThrows(IllegalArgumentException.class, () -> request.submit(headerNameAndValue)); - } - } - - @ParameterizedTest - @MethodSource("responseHeadersForDisabledValidation") - void testDisableValidationForHeadersFromResponse(String headerName, String headerValue) { - Http1Client clientWithNoHeaderValidation = Http1Client.builder() - .protocolConfig(it -> { - it.validateRequestHeaders(false); - it.validateResponseHeaders(false); - }) - .build(); - Http1ClientRequest request = clientWithNoHeaderValidation.put("http://localhost:" + dummyPort + BAD_HEADER_PATH); - request.connection(new FakeHttp1ClientConnection()); - Http1ClientResponse response = request.submit(headerName + HEADER_NAME_VALUE_DELIMETER + headerValue); - assertThat(response.status(), is(Http.Status.OK_200)); - String responseHeaderValue = response.headers().get(Http.HeaderNames.create(headerName)).values(); - assertThat(responseHeaderValue, is(headerValue.trim())); - } - - private static void validateSuccessfulResponse(Http1Client client, ClientConnection connection) { - String requestEntity = "Sending Something"; - Http1ClientRequest request = client.put("http://localhost:" + dummyPort + "/test"); - if (connection != null) { - request.connection(connection); - } - Http1ClientResponse response = request.submit(requestEntity); - - assertThat(response.status(), is(Http.Status.OK_200)); - assertThat(response.entity().as(String.class), is(requestEntity)); - } - - private static void validateFailedResponse(Http1Client client, ClientConnection connection, String errorMessage) { - String requestEntity = "Sending Something"; - Http1ClientRequest request = client.put("http://localhost:" + dummyPort + "/test"); - if (connection != null) { - request.connection(connection); - } - IllegalStateException ie = assertThrows(IllegalStateException.class, () -> request.submit(requestEntity)); - if (errorMessage != null) { - assertThat(ie.getMessage(), containsString(errorMessage)); - } - } - - private static void validateChunkTransfer(Http1ClientResponse response, boolean chunked, long contentLength, String entity) { - assertThat(response.status(), is(Http.Status.OK_200)); - if (contentLength == NO_CONTENT_LENGTH) { - assertThat(response.headers(), noHeader(REQ_CONTENT_LENGTH_HEADER_NAME)); - } else { - assertThat(response.headers(), hasHeader(REQ_CONTENT_LENGTH_HEADER_NAME, String.valueOf(contentLength))); - } - if (chunked) { - assertThat(response.headers(), hasHeader(REQ_CHUNKED_HEADER)); - } else { - assertThat(response.headers(), noHeader(REQ_CHUNKED_HEADER.headerName())); - } - String responseEntity = response.entity().as(String.class); - assertThat(responseEntity, is(entity)); - } - - private static Http1ClientRequest getHttp1ClientRequest(Http.Method method, String uriPath) { - return client.method(method).uri("http://localhost:" + dummyPort + uriPath); - } - - private static Http1ClientResponse getHttp1ClientResponseFromOutputStream(Http1ClientRequest request, - String[] requestEntityParts) { - Http1ClientResponse response = request.outputStream(it -> { - for (String r : requestEntityParts) { - it.write(r.getBytes(StandardCharsets.UTF_8)); - } - it.close(); - }); - return response; - } - - private static Stream relativeUris() { - return Stream.of( - // OutputStream (chunk request) - arguments(false, true, "http://www.dummy.com/test", "http://www.dummy.com:80/"), - arguments(false, true, "http://www.dummy.com:1111/test", "http://www.dummy.com:1111/"), - arguments(false, true, "https://www.dummy.com/test", "https://www.dummy.com:443/"), - arguments(false, true, "https://www.dummy.com:1111/test", "https://www.dummy.com:1111/"), - arguments(true, true, "http://www.dummy.com/test", "/test"), - arguments(true, true, "http://www.dummy.com:1111/test", "/test"), - arguments(true, true, "https://www.dummy.com/test", "/test"), - arguments(true, true, "https://www.dummy.com:1111/test", "/test"), - // non-OutputStream (single entity request) - arguments(false, false, "http://www.dummy.com/test", "http://www.dummy.com:80/"), - arguments(false, false, "http://www.dummy.com:1111/test", "http://www.dummy.com:1111/"), - arguments(false, false, "https://www.dummy.com/test", "https://www.dummy.com:443/"), - arguments(false, false, "https://www.dummy.com:1111/test", "https://www.dummy.com:1111/"), - arguments(true, false, "http://www.dummy.com/test", "/test"), - arguments(true, false, "http://www.dummy.com:1111/test", "/test"), - arguments(true, false, "https://www.dummy.com/test", "/test"), - arguments(true, false, "https://www.dummy.com:1111/test", "/test")); - } - - private static Stream headerValues() { - return Stream.of( - // Valid header values - arguments(Arrays.asList("Header Value"), true), - arguments(Arrays.asList("HeaderValue1", "Header\u0080Value\u00ff2"), true), - arguments(Arrays.asList("HeaderName1\u0009", "Header=Value2"), true), - // Invalid header values - arguments(Arrays.asList(" HeaderValue"), false), - arguments(Arrays.asList("HeaderValue1", "Header\u007fValue"), false), - arguments(Arrays.asList("HeaderValue1\r\n", "HeaderValue2"), false) - ); - } - - private static Stream headers() { - return Stream.of( - // Valid headers - arguments(Http.Headers.ACCEPT_RANGES_BYTES, true), - arguments(Http.Headers.CONNECTION_KEEP_ALIVE, true), - arguments(Http.Headers.CONTENT_TYPE_TEXT_PLAIN, true), - arguments(Http.Headers.ACCEPT_TEXT, true), - arguments(Http.Headers.CACHE_NO_CACHE, true), - arguments(Http.Headers.TE_TRAILERS, true), - arguments(Http.Headers.create("!#$Custom~%&\'*Header+^`|", "!Header\tValue~"), true), - arguments(Http.Headers.create("Custom_0-9_a-z_A-Z_Header", - "\u0080Header Value\u00ff"), true), - // Invalid headers - arguments(Http.Headers.create(VALID_HEADER_NAME, "H\u001ceaderValue1"), false), - arguments(Http.Headers.create(VALID_HEADER_NAME, - "HeaderValue1, Header\u007fValue"), false), - arguments(Http.Headers.create(VALID_HEADER_NAME, - "HeaderValue1\u001f, HeaderValue2"), false), - arguments(Http.Headers.create("Header\u001aName", VALID_HEADER_VALUE), false), - arguments(Http.Headers.create("Header\u000EName", VALID_HEADER_VALUE), false), - arguments(Http.Headers.create("HeaderName\r\n", VALID_HEADER_VALUE), false), - arguments(Http.Headers.create("HeaderName\u00FF\u0124", VALID_HEADER_VALUE), false), - arguments(Http.Headers.create("(Header:Name)", VALID_HEADER_VALUE), false), - arguments(Http.Headers.create("", VALID_HEADER_VALUE), false), - arguments(Http.Headers.create("{Header=Name}", VALID_HEADER_VALUE), false), - arguments(Http.Headers.create("\"HeaderName\"", VALID_HEADER_VALUE), false), - arguments(Http.Headers.create("[\\HeaderName]", VALID_HEADER_VALUE), false), - arguments(Http.Headers.create("@Header,Name;", VALID_HEADER_VALUE), false) - ); - } - - private static Stream responseHeaders() { - return Stream.of( - // Invalid header names - arguments("Header\u001aName", VALID_HEADER_VALUE, false), - arguments("Header\u000EName", VALID_HEADER_VALUE, false), - arguments("HeaderName\r\n", VALID_HEADER_VALUE, false), - arguments("(Header:Name)", VALID_HEADER_VALUE, false), - arguments("", VALID_HEADER_VALUE, false), - arguments("{Header=Name}", VALID_HEADER_VALUE, false), - arguments("\"HeaderName\"", VALID_HEADER_VALUE, false), - arguments("[\\HeaderName]", VALID_HEADER_VALUE, false), - arguments("@Header,Name;", VALID_HEADER_VALUE, false), - // Valid header names - arguments("!#$Custom~%&\'*Header+^`|", VALID_HEADER_VALUE, true), - arguments("Custom_0-9_a-z_A-Z_Header", VALID_HEADER_VALUE, true), - // Valid header values - arguments(VALID_HEADER_NAME, "Header Value", true), - arguments(VALID_HEADER_NAME, "HeaderValue1\u0009, Header=Value2", true), - arguments(VALID_HEADER_NAME, "Header\tValue", true), - arguments(VALID_HEADER_NAME, " Header Value ", true), - // Invalid header values - arguments(VALID_HEADER_NAME, "H\u001ceaderValue1", false), - arguments(VALID_HEADER_NAME, "HeaderValue1, Header\u007fValue", false), - arguments(VALID_HEADER_NAME, "HeaderValue1\u001f, HeaderValue2", false) - ); - } - - private static Stream responseHeadersForDisabledValidation() { - return Stream.of( - // Invalid header names - arguments("Header\u001aName", VALID_HEADER_VALUE, false), - arguments("Header\u000EName", VALID_HEADER_VALUE, false), - arguments("{Header=Name}", VALID_HEADER_VALUE, false), - arguments("\"HeaderName\"", VALID_HEADER_VALUE, false), - arguments("[\\HeaderName]", VALID_HEADER_VALUE, false), - arguments("@Header,Name;", VALID_HEADER_VALUE, false), - // Valid header names - arguments("!#$Custom~%&\'*Header+^`|", VALID_HEADER_VALUE, true), - arguments("Custom_0-9_a-z_A-Z_Header", VALID_HEADER_VALUE, true), - // Valid header values - arguments(VALID_HEADER_NAME, "Header Value", true), - arguments(VALID_HEADER_NAME, "HeaderValue1\u0009, Header=Value2", true), - arguments(VALID_HEADER_NAME, "Header\tValue", true), - arguments(VALID_HEADER_NAME, " Header Value ", true), - // Invalid header values - arguments(VALID_HEADER_NAME, "H\u001ceaderValue1", false), - arguments(VALID_HEADER_NAME, "HeaderValue1, Header\u007fValue", false), - arguments(VALID_HEADER_NAME, "HeaderValue1\u001f, HeaderValue2", false) - ); - } - - private static class FakeHttp1ClientConnection implements ClientConnection { - private final DataReader clientReader; - private final DataWriter clientWriter; - private final DataReader serverReader; - private final DataWriter serverWriter; - private Throwable serverException; - private ExecutorService webServerEmulator; - private String prologue; - - FakeHttp1ClientConnection() { - ArrayBlockingQueue serverToClient = new ArrayBlockingQueue<>(1024); - ArrayBlockingQueue clientToServer = new ArrayBlockingQueue<>(1024); - - this.clientReader = reader(serverToClient); - this.clientWriter = writer(clientToServer); - this.serverReader = reader(clientToServer); - this.serverWriter = writer(serverToClient); - } - - @Override - public HelidonSocket helidonSocket() { - return new FakeSocket(); - } - - @Override - public DataReader reader() { - return clientReader; - } - - @Override - public DataWriter writer() { - return clientWriter; - } - - @Override - public void releaseResource() { - } - - @Override - public void closeResource() { - webServerEmulator.shutdownNow(); - } - - @Override - public String channelId() { - return helidonSocket().socketId(); - } - - @Override - public void readTimeout(Duration readTimeout) { - //NOOP - } - - // This will be used for testing the element of Prologue - String getPrologue() { - return prologue; - } - - private DataWriter writer(ArrayBlockingQueue queue) { - return new DataWriter() { - @Override - public void write(BufferData... buffers) { - writeNow(buffers); - } - - @Override - public void write(BufferData buffer) { - writeNow(buffer); - } - - @Override - public void writeNow(BufferData... buffers) { - for (BufferData buffer : buffers) { - writeNow(buffer); - } - } - - @Override - public void writeNow(BufferData buffer) { - if (serverException != null) { - throw new IllegalStateException("Server exception", serverException); - } - if (webServerEmulator == null) { - webServerEmulator = Executors.newFixedThreadPool(1); - webServerEmulator.submit(() -> { - try { - webServerHandle(); - } catch (Throwable t) { - serverException = t; - throw t; - } - }); - } - - byte[] bytes = new byte[buffer.available()]; - buffer.read(bytes); - try { - queue.put(bytes); - } catch (InterruptedException e) { - throw new IllegalStateException("Thread interrupted", e); - } - } - }; - } - - private DataReader reader(ArrayBlockingQueue queue) { - return new DataReader(() -> { - if (serverException != null) { - throw new IllegalStateException("Server exception", serverException); - } - byte[] data; - try { - data = queue.poll(5, TimeUnit.SECONDS); - if (data == null) { - return null; - } - } catch (InterruptedException e) { - throw new IllegalArgumentException("Thread interrupted", e); - } - if (data.length == 0) { - return null; - } - return data; - }); - } - - private void webServerHandle() { - BufferData entity = BufferData.growing(128); - - // Read prologue - int lineLength = serverReader.findNewLine(16384); - if (lineLength > 0) { - prologue = serverReader.readAsciiString(lineLength); - serverReader.skip(2); // skip CRLF - } - - boolean requestFailed = false; - // Read Headers - WritableHeaders reqHeaders = null; - try { - reqHeaders = Http1HeadersParser.readHeaders(serverReader, 16384, false); - for (Iterator it = reqHeaders.iterator(); it.hasNext(); ) { - Http.Header header = it.next(); - header.validate(); - } - } catch (IllegalArgumentException e) { - requestFailed = true; - } - - int entitySize = 0; - if (!requestFailed) { - if (reqHeaders.contains(Http.Headers.TRANSFER_ENCODING_CHUNKED)) { - // Send 100-Continue if requested - if (reqHeaders.contains(Http.Headers.EXPECT_100)) { - serverWriter.write( - BufferData.create("HTTP/1.1 100 Continue\r\n".getBytes(StandardCharsets.UTF_8))); - } - - // Assemble the entity from the chunks - while (true) { - String hex = serverReader.readLine(); - int chunkLength = Integer.parseUnsignedInt(hex, 16); - if (chunkLength == 0) { - serverReader.readLine(); - break; - } - BufferData chunkData = serverReader.readBuffer(chunkLength); - entity.write(chunkData); - serverReader.skip(2); - entitySize += chunkLength; - } - } else if (reqHeaders.contains(Http.HeaderNames.CONTENT_LENGTH)) { - entitySize = reqHeaders.get(Http.HeaderNames.CONTENT_LENGTH).value(int.class); - if (entitySize > 0) { - entity.write(serverReader.getBuffer(entitySize)); - } - } - } - - WritableHeaders resHeaders = WritableHeaders.create(); - resHeaders.add(Http.Headers.CONNECTION_KEEP_ALIVE); - - if (reqHeaders != null) { - // Send headers that can be validated if Expect-100-Continue, Content_Length, and Chunked request headers exist - if (reqHeaders.contains(Http.Headers.EXPECT_100)) { - resHeaders.set(REQ_EXPECT_100_HEADER_NAME); - } - if (reqHeaders.contains(Http.HeaderNames.CONTENT_LENGTH)) { - resHeaders.set(REQ_CONTENT_LENGTH_HEADER_NAME, reqHeaders.get(Http.HeaderNames.CONTENT_LENGTH).value()); - } - if (reqHeaders.contains(Http.Headers.TRANSFER_ENCODING_CHUNKED)) { - resHeaders.set(REQ_CHUNKED_HEADER); - } - } - - // if prologue contains "/badHeader" path, send back the entity (name and value delimited by ->) as a header - if (getPrologue().contains(BAD_HEADER_PATH)) { - String[] header = entity.readString(entitySize, StandardCharsets.US_ASCII).split(HEADER_NAME_VALUE_DELIMETER); - resHeaders.add(Http.Headers.create(header[0], header[1])); - } - - String responseMessage = !requestFailed ? "HTTP/1.1 200 OK\r\n" : "HTTP/1.1 400 Bad Request\r\n"; - serverWriter.write(BufferData.create(responseMessage.getBytes(StandardCharsets.UTF_8))); - - // Send the headers - resHeaders.add(Http.HeaderNames.CONTENT_LENGTH, Integer.toString(entitySize)); - BufferData entityBuffer = BufferData.growing(128); - for (Http.Header header : resHeaders) { - header.writeHttp1Header(entityBuffer); - } - entityBuffer.write(Bytes.CR_BYTE); - entityBuffer.write(Bytes.LF_BYTE); - serverWriter.write(entityBuffer); - - // Send the entity if it exist - if (entitySize > 0) { - serverWriter.write(entity); - } - } - - } - - private static class FakeSocket implements HelidonSocket { - @Override - public void close() { - - } - - @Override - public int read(BufferData buffer) { - return 0; - } - - @Override - public void write(BufferData buffer) { - - } - - @Override - public PeerInfo remotePeer() { - return null; - } - - @Override - public PeerInfo localPeer() { - return null; - } - - @Override - public boolean isSecure() { - return false; - } - - @Override - public String socketId() { - return "fake"; - } - - @Override - public String childSocketId() { - return "fake"; - } - - @Override - public byte[] get() { - return new byte[0]; - } - } - - private static class CustomizedMediaContext implements MediaContext { - private final MediaContext delegated = MediaContext.create(); - - @Override - public MediaContextConfig prototype() { - return delegated.prototype(); - } - - @Override - public EntityReader reader(GenericType type, Headers headers) { - return delegated.reader(type, headers); - } - - @Override - public EntityWriter writer(GenericType type, Headers requestHeaders, WritableHeaders responseHeaders) { - EntityWriter impl = delegated.writer(type, requestHeaders, responseHeaders); - - EntityWriter realWriter = new EntityWriter() { - @Override - public void write(GenericType type, - T object, - OutputStream outputStream, - Headers requestHeaders, - WritableHeaders responseHeaders) { - if (object instanceof String) { - @SuppressWarnings("unchecked") final T maxLen5 = (T) ((String) object).substring(0, 5); - impl.write(type, maxLen5, outputStream, requestHeaders, responseHeaders); - } else { - impl.write(type, object, outputStream, requestHeaders, responseHeaders); - } - } - - @Override - public void write(GenericType type, T object, OutputStream outputStream, WritableHeaders headers) { - impl.write(type, object, outputStream, headers); - } - }; - return realWriter; - } - - @Override - public EntityReader reader(GenericType type, Headers requestHeaders, Headers responseHeaders) { - return delegated.reader(type, requestHeaders, responseHeaders); - } - - @Override - public EntityWriter writer(GenericType type, WritableHeaders requestHeaders) { - return delegated.writer(type, requestHeaders); - } - } -} diff --git a/nima/webclient/metrics/pom.xml b/nima/webclient/metrics/pom.xml deleted file mode 100644 index 34bcbbcfd94..00000000000 --- a/nima/webclient/metrics/pom.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - 4.0.0 - - io.helidon.nima.webclient - helidon-nima-webclient-project - 4.0.0-SNAPSHOT - - - helidon-nima-webclient-metrics - Helidon Níma WebClient Metrics - Metrics support for Níma client - - - io.helidon.nima.webclient - helidon-nima-webclient - - - io.helidon.config - helidon-config - - - org.eclipse.microprofile.metrics - microprofile-metrics-api - - - io.helidon.metrics - helidon-metrics-api - - - io.helidon.common.features - helidon-common-features-api - true - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - - - - io.helidon.common.features - helidon-common-features-api - ${helidon.version} - - - - - - diff --git a/nima/webclient/metrics/src/main/java/io/helidon/nima/webclient/metrics/package-info.java b/nima/webclient/metrics/src/main/java/io/helidon/nima/webclient/metrics/package-info.java deleted file mode 100644 index aca84ba11a3..00000000000 --- a/nima/webclient/metrics/src/main/java/io/helidon/nima/webclient/metrics/package-info.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. - * - * 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. - */ -/** - * Metrics support for Helidon Nima client. - */ -package io.helidon.nima.webclient.metrics; diff --git a/nima/webclient/metrics/src/main/java/module-info.java b/nima/webclient/metrics/src/main/java/module-info.java deleted file mode 100644 index 2ab3dd54eee..00000000000 --- a/nima/webclient/metrics/src/main/java/module-info.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.common.features.api.Feature; -import io.helidon.common.features.api.HelidonFlavor; - -/** - * Helidon WebClient Metrics. - */ -@Feature(value = "Metrics", - description = "Web client support for metrics", - in = HelidonFlavor.SE, - path = {"WebClient", "Metrics"} -) -module io.helidon.nima.webclient.metrics { - requires io.helidon.nima.webclient; - requires microprofile.metrics.api; - requires io.helidon.metrics.api; - requires io.helidon.common.features.api; - provides io.helidon.nima.webclient.spi.WebClientServiceProvider - with io.helidon.nima.webclient.metrics.WebClientMetricsProvider; -} diff --git a/nima/webclient/pom.xml b/nima/webclient/pom.xml deleted file mode 100644 index 019f4283bff..00000000000 --- a/nima/webclient/pom.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - 4.0.0 - - - io.helidon.nima - helidon-nima-project - 4.0.0-SNAPSHOT - ../pom.xml - - - io.helidon.nima.webclient - helidon-nima-webclient-project - Helidon Níma WebClient Project - - pom - - - api - webclient - tracing - security - dns-resolver - http1 - metrics - - - diff --git a/nima/webclient/security/pom.xml b/nima/webclient/security/pom.xml deleted file mode 100644 index d87c4220a5e..00000000000 --- a/nima/webclient/security/pom.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.webclient - helidon-nima-webclient-project - 4.0.0-SNAPSHOT - ../pom.xml - - - helidon-nima-webclient-security - Helidon Níma WebClient Security - - - - io.helidon.nima.webclient - helidon-nima-webclient - - - io.helidon.security - helidon-security - - - io.helidon.security.providers - helidon-security-providers-common - - - io.helidon.common.features - helidon-common-features-api - true - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - - - - io.helidon.common.features - helidon-common-features-api - ${helidon.version} - - - - - - - diff --git a/nima/webclient/security/src/main/java/io/helidon/nima/webclient/security/package-info.java b/nima/webclient/security/src/main/java/io/helidon/nima/webclient/security/package-info.java deleted file mode 100644 index 4b82b2bbe2d..00000000000 --- a/nima/webclient/security/src/main/java/io/helidon/nima/webclient/security/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Security propagation service. - */ -package io.helidon.nima.webclient.security; diff --git a/nima/webclient/security/src/main/java/module-info.java b/nima/webclient/security/src/main/java/module-info.java deleted file mode 100644 index 24731d6ce6d..00000000000 --- a/nima/webclient/security/src/main/java/module-info.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.common.features.api.Feature; -import io.helidon.common.features.api.HelidonFlavor; - -/** - * Helidon WebClient Security. - */ -@Feature(value = "Security", - description = "Web client support for security", - in = HelidonFlavor.SE, - path = {"WebClient", "Security"} -) -module io.helidon.nima.webclient.security { - requires static io.helidon.common.features.api; - - requires io.helidon.nima.webclient; - requires io.helidon.security; - requires io.helidon.security.providers.common; - - exports io.helidon.nima.webclient.security; - - provides io.helidon.nima.webclient.spi.WebClientServiceProvider - with io.helidon.nima.webclient.security.WebClientSecurityProvider; -} \ No newline at end of file diff --git a/nima/webclient/tracing/pom.xml b/nima/webclient/tracing/pom.xml deleted file mode 100644 index fdfb196b5e3..00000000000 --- a/nima/webclient/tracing/pom.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.webclient - helidon-nima-webclient-project - 4.0.0-SNAPSHOT - ../pom.xml - - - helidon-nima-webclient-tracing - Helidon Níma WebClient Tracing - - - - io.helidon.nima.webclient - helidon-nima-webclient - - - io.helidon.tracing - helidon-tracing - - - io.helidon.common.features - helidon-common-features-api - true - - - io.helidon.config - helidon-config-metadata - true - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - io.helidon.common.testing - helidon-common-testing-http-junit5 - test - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - - - - io.helidon.common.features - helidon-common-features-api - ${helidon.version} - - - - - - diff --git a/nima/webclient/tracing/src/main/java/io/helidon/nima/webclient/tracing/package-info.java b/nima/webclient/tracing/src/main/java/io/helidon/nima/webclient/tracing/package-info.java deleted file mode 100644 index f066fa5d274..00000000000 --- a/nima/webclient/tracing/src/main/java/io/helidon/nima/webclient/tracing/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Client tracing propagation service. - */ -package io.helidon.nima.webclient.tracing; diff --git a/nima/webclient/tracing/src/main/java/module-info.java b/nima/webclient/tracing/src/main/java/module-info.java deleted file mode 100644 index 42c0902cc78..00000000000 --- a/nima/webclient/tracing/src/main/java/module-info.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.common.features.api.Feature; -import io.helidon.common.features.api.HelidonFlavor; - -/** - * Helidon WebClient Tracing. - */ -@Feature(value = "Tracing", - description = "Web client support for tracing", - in = HelidonFlavor.SE, - path = {"WebClient", "Tracing"} -) -module io.helidon.nima.webclient.tracing { - requires static io.helidon.common.features.api; - - requires io.helidon.nima.webclient; - requires io.helidon.tracing; - - exports io.helidon.nima.webclient.tracing; - - provides io.helidon.nima.webclient.spi.WebClientServiceProvider - with io.helidon.nima.webclient.tracing.WebClientTracingProvider; -} \ No newline at end of file diff --git a/nima/webclient/webclient/pom.xml b/nima/webclient/webclient/pom.xml deleted file mode 100644 index 776efe47f97..00000000000 --- a/nima/webclient/webclient/pom.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.webclient - helidon-nima-webclient-project - 4.0.0-SNAPSHOT - - - helidon-nima-webclient - Helidon Níma WebClient - - - true - true - true - - - - - io.helidon.nima.webclient - helidon-nima-webclient-api - - - io.helidon.nima.webclient - helidon-nima-webclient-http1 - - - diff --git a/nima/webclient/webclient/src/main/java/module-info.java b/nima/webclient/webclient/src/main/java/module-info.java deleted file mode 100644 index b4874c37a1d..00000000000 --- a/nima/webclient/webclient/src/main/java/module-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * WebClient API and HTTP/1.1 implementation. - */ -module io.helidon.nima.webclient { - requires transitive io.helidon.nima.webclient.api; - requires transitive io.helidon.nima.webclient.http1; -} diff --git a/nima/webserver/access-log/pom.xml b/nima/webserver/access-log/pom.xml deleted file mode 100644 index 9bfcf5f776a..00000000000 --- a/nima/webserver/access-log/pom.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.webserver - helidon-nima-webserver-project - 4.0.0-SNAPSHOT - - - helidon-nima-webserver-access-log - Helidon Níma WebServer Access Log - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.common.features - helidon-common-features-api - true - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - org.mockito - mockito-core - test - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - - - - - diff --git a/nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/package-info.java b/nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/package-info.java deleted file mode 100644 index cdf8d751822..00000000000 --- a/nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/package-info.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Access log support for Helidon Server. - * - * @see io.helidon.nima.webserver.accesslog.AccessLogFeature - */ -package io.helidon.nima.webserver.accesslog; diff --git a/nima/webserver/access-log/src/main/java/module-info.java b/nima/webserver/access-log/src/main/java/module-info.java deleted file mode 100644 index 5b61ce24efa..00000000000 --- a/nima/webserver/access-log/src/main/java/module-info.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.common.features.api.Feature; -import io.helidon.common.features.api.HelidonFlavor; - -/** - * WebServer Access log. - */ -@Feature(value = "Access Log", - description = "Access log support", - in = HelidonFlavor.SE, - path = {"WebServer", "AccessLog"} -) -module io.helidon.nima.webserver.accesslog { - requires static io.helidon.common.features.api; - - requires java.logging; - - requires io.helidon.nima.webserver; - requires io.helidon.common.security; - - exports io.helidon.nima.webserver.accesslog; -} \ No newline at end of file diff --git a/nima/webserver/context/pom.xml b/nima/webserver/context/pom.xml deleted file mode 100644 index f4afa4b8e57..00000000000 --- a/nima/webserver/context/pom.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.webserver - helidon-nima-webserver-project - 4.0.0-SNAPSHOT - - - helidon-nima-webserver-context - Helidon Níma WebServer Context - Integration of Helidon Common Context with Níma WebServer - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.common - helidon-common-context - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - diff --git a/nima/webserver/context/src/main/java/io/helidon/nima/webserver/context/package-info.java b/nima/webserver/context/src/main/java/io/helidon/nima/webserver/context/package-info.java deleted file mode 100644 index 7182ed641c6..00000000000 --- a/nima/webserver/context/src/main/java/io/helidon/nima/webserver/context/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Integration of {@link io.helidon.common.context.Context} with {@link io.helidon.nima.webserver.WebServer}. - * Register {@link io.helidon.nima.webserver.context.ContextFeature} with - * {@link io.helidon.nima.webserver.http.HttpRouting.Builder#addFilter(io.helidon.nima.webserver.http.Filter) routing builder}. - * This will create a request specific context accessible through {@link io.helidon.common.context.Contexts#context()}. - */ -package io.helidon.nima.webserver.context; diff --git a/nima/webserver/context/src/main/java/module-info.java b/nima/webserver/context/src/main/java/module-info.java deleted file mode 100644 index dc5ff1c388d..00000000000 --- a/nima/webserver/context/src/main/java/module-info.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Integration of {@link io.helidon.common.context.Context} with {@link io.helidon.nima.webserver.WebServer}. - * Register {@link io.helidon.nima.webserver.context.ContextFeature} with - * {@link io.helidon.nima.webserver.http.HttpRouting.Builder#addFeature(java.util.function.Supplier)}. - * This will create a request specific context accessible through {@link io.helidon.common.context.Contexts#context()}. - */ -module io.helidon.nima.webserver.context { - requires io.helidon.common.context; - requires io.helidon.common; - requires transitive io.helidon.config; - requires io.helidon.nima.webserver; - - exports io.helidon.nima.webserver.context; -} \ No newline at end of file diff --git a/nima/webserver/cors/pom.xml b/nima/webserver/cors/pom.xml deleted file mode 100644 index c5c38202829..00000000000 --- a/nima/webserver/cors/pom.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.webserver - helidon-nima-webserver-project - 4.0.0-SNAPSHOT - - - helidon-nima-webserver-cors - Helidon Níma Server CORS - Cross-origin resource sharing support - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.config - helidon-config - - - io.helidon.cors - helidon-cors - - - io.helidon.common.features - helidon-common-features-api - true - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - - - - - diff --git a/nima/webserver/cors/src/main/java/io/helidon/nima/webserver/cors/RequestAdapterNima.java b/nima/webserver/cors/src/main/java/io/helidon/nima/webserver/cors/RequestAdapterNima.java deleted file mode 100644 index 49a1851735c..00000000000 --- a/nima/webserver/cors/src/main/java/io/helidon/nima/webserver/cors/RequestAdapterNima.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2020, 2022 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.helidon.nima.webserver.cors; - -import java.util.List; -import java.util.Optional; - -import io.helidon.common.http.Http.HeaderName; -import io.helidon.common.http.ServerRequestHeaders; -import io.helidon.cors.CorsRequestAdapter; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; - -/** - * Helidon Níma implementation of {@link io.helidon.cors.CorsRequestAdapter}. - */ -class RequestAdapterNima implements CorsRequestAdapter { - - private final ServerRequest request; - private final ServerResponse response; - private final ServerRequestHeaders headers; - - RequestAdapterNima(ServerRequest req, ServerResponse res) { - this.request = req; - this.response = res; - this.headers = req.headers(); - } - - @Override - public String authority() { - return request.authority(); - } - - @Override - public String path() { - return request.path().path(); - } - - @Override - public Optional firstHeader(HeaderName key) { - if (headers.contains(key)) { - return Optional.of(headers.get(key).value()); - } - return Optional.empty(); - } - - @Override - public boolean headerContainsKey(HeaderName key) { - return headers.contains(key); - } - - @Override - public List allHeaders(HeaderName key) { - return headers.all(key, List::of); - } - - @Override - public String method() { - return request.prologue().method().text(); - } - - @Override - public void next() { - response.next(); - } - - @Override - public ServerRequest request() { - return request; - } - - @Override - public String toString() { - return String.format("RequestAdapterSe{path=%s, method=%s, headers=%s}", path(), method(), request.headers()); - } -} diff --git a/nima/webserver/cors/src/main/java/io/helidon/nima/webserver/cors/ResponseAdapterNima.java b/nima/webserver/cors/src/main/java/io/helidon/nima/webserver/cors/ResponseAdapterNima.java deleted file mode 100644 index d1c9188e4de..00000000000 --- a/nima/webserver/cors/src/main/java/io/helidon/nima/webserver/cors/ResponseAdapterNima.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2020, 2022 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.helidon.nima.webserver.cors; - -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderName; -import io.helidon.cors.CorsResponseAdapter; -import io.helidon.nima.webserver.http.ServerResponse; - -/** - * SE implementation of {@link CorsResponseAdapter}. - */ -class ResponseAdapterNima implements CorsResponseAdapter { - - private final ServerResponse serverResponse; - - ResponseAdapterNima(ServerResponse serverResponse) { - this.serverResponse = serverResponse; - } - - @Override - public ResponseAdapterNima header(HeaderName key, String value) { - serverResponse.header(key, value); - return this; - } - - @Override - public ResponseAdapterNima header(HeaderName key, Object value) { - serverResponse.header(key, value.toString()); - return this; - } - - @Override - public ServerResponse forbidden(String message) { - serverResponse.status(Http.Status.create(Http.Status.FORBIDDEN_403.code(), message)); - return serverResponse; - } - - @Override - public ServerResponse ok() { - serverResponse.status(Http.Status.OK_200); - return serverResponse; - } - - @Override - public int status() { - return serverResponse.status().code(); - } -} diff --git a/nima/webserver/cors/src/main/java/io/helidon/nima/webserver/cors/package-info.java b/nima/webserver/cors/src/main/java/io/helidon/nima/webserver/cors/package-info.java deleted file mode 100644 index 5eae5e7dccb..00000000000 --- a/nima/webserver/cors/src/main/java/io/helidon/nima/webserver/cors/package-info.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2020, 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - *

    Helidon Níma CORS Support

    - *

    - * Use {@link io.helidon.nima.webserver.cors.CorsSupport} and its {@link io.helidon.nima.webserver.cors.CorsSupport.Builder} to - * add CORS - * handling to resources in your application. - *

    - * Because Níma does not use annotation processing to identify endpoints, you need to provide the CORS information for - * your application another way. You can use Helidon configuration, the Níma CORS API, or a combination. - *

    Configuration

    - *

    Format

    - * CORS configuration looks like this: - *
    - * enabled: true    # the default
    - * allow-origins: ["http://foo.bar", "http://bar.foo"]
    - * allow-methods: ["DELETE", "PUT"]
    - * allow-headers: ["X-bar", "X-foo"]
    - * allow-credentials: true
    - * max-age: -1
    - * 
    - *

    Finding and applying CORS configuration

    - * Although Níma prescribes the CORS config format, you can put it wherever you want in your application's configuration - * file. Your application code will retrieve the CORS config from its location within your configuration and then use that - * config node to prepare CORS support for your app. - * - * For example, if you set up this configuration - *
    - * narrow:
    - *   allow-origins: ["http://foo.bar", "http://bar.foo"]
    - *   allow-methods: ["DELETE", "PUT"]
    - *   allow-headers: ["X-bar", "X-foo"]
    - *   allow-credentials: true
    - *   max-age: -1
    - *
    - * wide:
    - *   enabled: false
    - *   allow-origins: ["*"]
    - *   allow-methods: ["*"]
    - *
    - * just-disabled:
    - *   enabled: false
    - * 
    - *

    - * in a resource called {@code myApp.yaml} then the following code would apply it to your app: - *

    - *
    {@code
    - *         Config myAppConfig = Config.builder().sources(ConfigSources.classpath("myApp.yaml")).build();
    - *         Routing.Builder builder = Routing.builder();
    - *         myAppConfig.get("narrow").ifPresent(c -> builder.any(
    - *                          "/greet", CorsSupport.create(c),
    - *                          (req, resp) -> resp.status(Http.Status.OK_200).send()));
    - *         myAppConfig.get("wide".ifPresent(c -> builder.get(
    - *                          "/greet", CorsSupport.create(c),
    - *                          (req, resp) -> resp.status(Http.Status.OK_200).send("Hello, World!")));
    - *     }
    - * This sets up more restrictive CORS behavior for more sensitive HTTP methods ({@code PUT} for example) and more liberal CORS - * behavior for {@code GET}. - * - *

    The Níma CORS API

    - * You can define your application's CORS behavior programmatically -- together with configuration if you want -- by: - *
      - *
    • creating a {@link io.helidon.cors.CrossOriginConfig.Builder} instance,
    • - *
    • operating on the builder to prepare the CORS set-up you want,
    • - *
    • using the builder's {@code build()} method to create the {@code CrossOriginConfig} instance, and
    • - *
    - *

    - * The next example shows creating CORS information and associating it with the path {@code /cors3} within the app. - *

    - *         CrossOriginConfig corsForCORS3= CrossOriginConfig.builder()
    - *             .allowOrigins("http://foo.bar", "http://bar.foo")
    - *             .allowMethods("DELETE", "PUT")
    - *             .build();
    - *
    - *         Routing.Builder builder = Routing.builder()
    - *                 .register("/myapp",
    - *                           CorsSupport.builder()
    - *                                 .addCrossOrigin("/cors3", corsForCORS3) // links the CORS info with a path within the app
    - *                                 .build(),
    - *                           new MyApp());
    - * 
    - * Notice that you pass two services to the {@code register} method: the {@code CorsSupport} instance and your app - * instance. Níma will process requests to the path you specify with those services in that order. Also, note that you have - * to make sure you use the same path in this API call and in your {@code MyApp} service if you adjust the routing there. - *

    - * Invoke {@code addCrossOrigin} multiple times to link more paths with CORS configuration. You can reuse one {@code - * CrossOriginConfig} object with more than one path if that meets your needs. - *

    - *

    - * Remember that the CORS protocol uses the {@code OPTIONS} HTTP method for preflight requests. If you use the handler-based - * methods on {@code Routing.Builder} be sure to invoke the {@code options} method as well (or {code any}) to set up routing for - * {@code OPTIONS} requests. - *

    - *

    - * Each {@code CorsSupport} instance can be enabled or disabled, either through configuration or using the API. - * By default, when an application creates a new {@code CorsSupport.Builder} instance that builder's {@code build()} method will - * create an enabled {@code CorsSupport} object. Any subsequent explicit setting on the builder, either expressly set by an - * {@code enabled} entry in configuration passed to {@code CorsSupport.Builder.config} or set by invoking - * {@code CorsSupport.Builder.enabled} follows the familiar "latest-wins" approach. - *

    - */ -package io.helidon.nima.webserver.cors; diff --git a/nima/webserver/cors/src/main/java/module-info.java b/nima/webserver/cors/src/main/java/module-info.java deleted file mode 100644 index 652db3f6321..00000000000 --- a/nima/webserver/cors/src/main/java/module-info.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.common.features.api.Feature; -import io.helidon.common.features.api.HelidonFlavor; - -/** - * Helidon WebServer CORS support. - */ -@Feature(value = "CORS", - description = "CORS support for WebServer", - in = HelidonFlavor.SE, - path = {"WebServer", "CORS"} -) -module io.helidon.nima.webserver.cors { - requires static io.helidon.common.features.api; - - requires java.logging; - - requires transitive io.helidon.cors; - requires io.helidon.nima.webserver; - - exports io.helidon.nima.webserver.cors; -} \ No newline at end of file diff --git a/nima/webserver/cors/src/test/java/io/helidon/nima/webserver/cors/TestHandlerRegistration.java b/nima/webserver/cors/src/test/java/io/helidon/nima/webserver/cors/TestHandlerRegistration.java deleted file mode 100644 index a19ec4c6f64..00000000000 --- a/nima/webserver/cors/src/test/java/io/helidon/nima/webserver/cors/TestHandlerRegistration.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.webserver.cors; - -import io.helidon.common.http.Http; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.http1.Http1Client; - -import org.junit.jupiter.api.Test; - -import static io.helidon.common.http.Http.HeaderNames.ACCESS_CONTROL_ALLOW_HEADERS; -import static io.helidon.common.http.Http.HeaderNames.ACCESS_CONTROL_ALLOW_METHODS; -import static io.helidon.common.http.Http.HeaderNames.ACCESS_CONTROL_ALLOW_ORIGIN; -import static io.helidon.common.http.Http.HeaderNames.ACCESS_CONTROL_REQUEST_HEADERS; -import static io.helidon.common.http.Http.HeaderNames.ACCESS_CONTROL_REQUEST_METHOD; -import static io.helidon.common.http.Http.HeaderNames.ORIGIN; -import static io.helidon.common.testing.http.junit5.HttpHeaderMatcher.hasHeader; -import static org.hamcrest.CoreMatchers.containsString; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; - -@ServerTest -class TestHandlerRegistration extends CorsRouting { - - static final String CORS4_CONTEXT_ROOT = "/cors4"; - - private final Http1Client client; - - TestHandlerRegistration(Http1Client client) { - this.client = client; - } - - @Test - void test4PreFlightAllowedHeaders2() { - try (HttpClientResponse response = client.method(Http.Method.OPTIONS) - .uri(CORS4_CONTEXT_ROOT) - .header(ORIGIN, "http://foo.bar") - .header(ACCESS_CONTROL_REQUEST_METHOD, "PUT") - .header(ACCESS_CONTROL_REQUEST_HEADERS, "X-foo, X-bar") - .request()) { - - assertThat(response.status(), is(Http.Status.OK_200)); - assertThat(response.headers(), hasHeader(ACCESS_CONTROL_ALLOW_ORIGIN, "http://foo.bar")); - assertThat(response.headers(), hasHeader(ACCESS_CONTROL_ALLOW_METHODS, "PUT")); - assertThat(response.headers(), hasHeader(ACCESS_CONTROL_ALLOW_HEADERS)); - assertThat(response.headers().get(ACCESS_CONTROL_ALLOW_HEADERS).values(), containsString("X-foo")); - assertThat(response.headers().get(ACCESS_CONTROL_ALLOW_HEADERS).values(), containsString("X-bar")); - } - } -} diff --git a/nima/webserver/cors/src/test/resources/application.yaml b/nima/webserver/cors/src/test/resources/application.yaml deleted file mode 100644 index dc3271ad9d8..00000000000 --- a/nima/webserver/cors/src/test/resources/application.yaml +++ /dev/null @@ -1,34 +0,0 @@ -# -# Copyright (c) 2020, 2022 Oracle and/or its affiliates. -# -# 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. -# -app: - greeting: "Hello" - -client: - follow-redirects: true - max-redirects: 8 - -cors-setup: - paths: - - path-pattern: /cors1 - allow-origins: [ "*" ] - allow-methods: [ "*" ] - - path-pattern: /cors2 - allow-origins: [ "http://foo.bar", "http://bar.foo" ] - allow-methods: [ "DELETE", "PUT" ] - allow-headers: [ "X-bar", "X-foo" ] - allow-credentials: true - max-age: -1 -# info for /cors3 is added programmatically \ No newline at end of file diff --git a/nima/webserver/cors/src/test/resources/logging-test.properties b/nima/webserver/cors/src/test/resources/logging-test.properties deleted file mode 100644 index 2dffea3c355..00000000000 --- a/nima/webserver/cors/src/test/resources/logging-test.properties +++ /dev/null @@ -1,22 +0,0 @@ -# -# Copyright (c) 2022 Oracle and/or its affiliates. -# -# 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. -# -handlers=java.util.logging.ConsoleHandler -java.util.logging.ConsoleHandler.level=FINEST -java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter -# java.util.logging.SimpleFormatter.format = [%1$tc] %5$s %6$s%n -java.util.logging.SimpleFormatter.format=%1$tH:%1$tM:%1$tS %5$s%6$s%n -# Global logging level. Can be overridden by specific loggers -.level=INFO diff --git a/nima/webserver/pom.xml b/nima/webserver/pom.xml deleted file mode 100644 index 227bb0483f0..00000000000 --- a/nima/webserver/pom.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - 4.0.0 - - - io.helidon.nima - helidon-nima-project - 4.0.0-SNAPSHOT - ../pom.xml - - - io.helidon.nima.webserver - helidon-nima-webserver-project - Helidon Níma WebServer Project - - pom - - - webserver - access-log - cors - static-content - tracing - context - - - diff --git a/nima/webserver/static-content/etc/spotbugs/exclude.xml b/nima/webserver/static-content/etc/spotbugs/exclude.xml deleted file mode 100644 index 570e8f9134c..00000000000 --- a/nima/webserver/static-content/etc/spotbugs/exclude.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/nima/webserver/static-content/pom.xml b/nima/webserver/static-content/pom.xml deleted file mode 100644 index 4a95987d00b..00000000000 --- a/nima/webserver/static-content/pom.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.webserver - helidon-nima-webserver-project - 4.0.0-SNAPSHOT - - - helidon-nima-webserver-static-content - Helidon Níma Server Static Content - - - etc/spotbugs/exclude.xml - - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.common.features - helidon-common-features-api - true - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - org.mockito - mockito-core - test - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - - - - - diff --git a/nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/package-info.java b/nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/package-info.java deleted file mode 100644 index c505d3a438a..00000000000 --- a/nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/package-info.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2021, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Static content support for Helidon Níma {@link io.helidon.nima.webserver.WebServer}. - *

    - * The starting point is {@link io.helidon.nima.webserver.staticcontent.StaticContentService}. - */ -package io.helidon.nima.webserver.staticcontent; diff --git a/nima/webserver/static-content/src/main/java/module-info.java b/nima/webserver/static-content/src/main/java/module-info.java deleted file mode 100644 index fce8411d7c6..00000000000 --- a/nima/webserver/static-content/src/main/java/module-info.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.common.features.api.Feature; -import io.helidon.common.features.api.HelidonFlavor; - -/** - * Helidon Níma WebServer static content support. - */ -@Feature(value = "Nima Static Content", - description = "Static content support for WebServer", - in = HelidonFlavor.SE, - path = {"WebServer", "Static Content"} -) -module io.helidon.nima.webserver.staticcontent { - requires static io.helidon.common.features.api; - - requires transitive io.helidon.nima.webserver; - requires transitive io.helidon.common.configurable; - - exports io.helidon.nima.webserver.staticcontent; -} \ No newline at end of file diff --git a/nima/webserver/static-content/src/test/java/io/helidon/nima/webserver/staticcontent/StaticContentTest.java b/nima/webserver/static-content/src/test/java/io/helidon/nima/webserver/staticcontent/StaticContentTest.java deleted file mode 100644 index c98e7238fce..00000000000 --- a/nima/webserver/static-content/src/test/java/io/helidon/nima/webserver/staticcontent/StaticContentTest.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2021, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.webserver.staticcontent; - -import java.nio.file.Files; -import java.nio.file.Path; - -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderNames; -import io.helidon.common.testing.http.junit5.HttpHeaderMatcher; -import io.helidon.nima.testing.junit5.webserver.DirectClient; -import io.helidon.nima.testing.junit5.webserver.RoutingTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.http.HttpRouting; - -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.io.TempDir; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; - -@RoutingTest -class StaticContentTest { - @TempDir - static Path tempDir; - - private final DirectClient testClient; - - StaticContentTest(DirectClient testClient) { - this.testClient = testClient; - } - - @SetUpRoute - static void setupRouting(HttpRouting.Builder builder) throws Exception { - Path nested = tempDir.resolve("nested"); - Files.createDirectories(nested); - - Path resource = tempDir.resolve("resource.txt"); - Path favicon = tempDir.resolve("favicon.ico"); - - Files.writeString(resource, "Content"); - Files.writeString(favicon, "Wrong icon text"); - Files.writeString(nested.resolve("resource.txt"), "Nested content"); - - builder.register("/classpath", StaticContentService.builder("web")) - .register("/singleclasspath", StaticContentService.builder("web/resource.txt")) - .register("/path", StaticContentService.builder(tempDir)) - .register("/singlepath", StaticContentService.builder(resource)); - } - - @Test - void testClasspathFavicon() { - try (Http1ClientResponse response = testClient.get("/classpath/favicon.ico") - .request()) { - - assertThat(response.status(), is(Http.Status.OK_200)); - assertThat(response.headers(), HttpHeaderMatcher.hasHeader(HeaderNames.CONTENT_TYPE, "image/x-icon")); - } - } - - @Test - void testClasspathNested() { - try (Http1ClientResponse response = testClient.get("/classpath/nested/resource.txt") - .request()) { - - assertThat(response.status(), is(Http.Status.OK_200)); - assertThat(response.headers(), HttpHeaderMatcher.hasHeader(HeaderNames.CONTENT_TYPE, "text/plain")); - assertThat(response.as(String.class), is("Nested content")); - } - } - - @Test - void testClasspathSingleFile() { - try (Http1ClientResponse response = testClient.get("/singleclasspath") - .request()) { - - assertThat(response.status(), is(Http.Status.OK_200)); - assertThat(response.headers(), HttpHeaderMatcher.hasHeader(HeaderNames.CONTENT_TYPE, "text/plain")); - assertThat(response.as(String.class), is("Content")); - } - } - - @Test - void testFileSystemFavicon() { - try (Http1ClientResponse response = testClient.get("/path/favicon.ico") - .request()) { - - assertThat(response.status(), is(Http.Status.OK_200)); - assertThat(response.headers(), HttpHeaderMatcher.hasHeader(HeaderNames.CONTENT_TYPE, "image/x-icon")); - } - } - - @Test - void testFileSystemNested() { - try (Http1ClientResponse response = testClient.get("/path/nested/resource.txt") - .request()) { - - assertThat(response.status(), is(Http.Status.OK_200)); - assertThat(response.headers(), HttpHeaderMatcher.hasHeader(HeaderNames.CONTENT_TYPE, "text/plain")); - assertThat(response.as(String.class), is("Nested content")); - } - } - - @Test - void testFileSystemSingleFile() { - try (Http1ClientResponse response = testClient.get("/singlepath") - .request()) { - - assertThat(response.status(), is(Http.Status.OK_200)); - assertThat(response.headers(), HttpHeaderMatcher.hasHeader(HeaderNames.CONTENT_TYPE, "text/plain")); - assertThat(response.as(String.class), is("Content")); - } - } -} diff --git a/nima/webserver/static-content/src/test/resources/web/favicon.ico b/nima/webserver/static-content/src/test/resources/web/favicon.ico deleted file mode 100644 index d91659fdb53..00000000000 Binary files a/nima/webserver/static-content/src/test/resources/web/favicon.ico and /dev/null differ diff --git a/nima/webserver/tracing/pom.xml b/nima/webserver/tracing/pom.xml deleted file mode 100644 index 588821286ee..00000000000 --- a/nima/webserver/tracing/pom.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.webserver - helidon-nima-webserver-project - 4.0.0-SNAPSHOT - - - helidon-nima-webserver-tracing - Helidon Níma WebServer Tracing - Tracing support for Níma server - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.config - helidon-config - - - io.helidon.tracing - helidon-tracing - - - io.helidon.tracing - helidon-tracing-config - - - io.helidon.common.features - helidon-common-features-api - true - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - - - - - diff --git a/nima/webserver/tracing/src/main/java/io/helidon/nima/webserver/tracing/package-info.java b/nima/webserver/tracing/src/main/java/io/helidon/nima/webserver/tracing/package-info.java deleted file mode 100644 index a4e744ae419..00000000000 --- a/nima/webserver/tracing/src/main/java/io/helidon/nima/webserver/tracing/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Níma WebServer tracing support. - */ -package io.helidon.nima.webserver.tracing; diff --git a/nima/webserver/tracing/src/main/java/module-info.java b/nima/webserver/tracing/src/main/java/module-info.java deleted file mode 100644 index 7fa62d37f7f..00000000000 --- a/nima/webserver/tracing/src/main/java/module-info.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.common.features.api.Feature; -import io.helidon.common.features.api.HelidonFlavor; - -/** - * Níma WebServer Tracing support. - */ -@Feature(value = "Tracing", - description = "Tracing", - in = HelidonFlavor.SE -) -module io.helidon.nima.webserver.tracing { - requires static io.helidon.common.features.api; - - requires io.helidon.common.http; - requires io.helidon.nima.webserver; - requires io.helidon.tracing; - requires io.helidon.tracing.config; - - - exports io.helidon.nima.webserver.tracing; -} \ No newline at end of file diff --git a/nima/webserver/webserver/README.md b/nima/webserver/webserver/README.md deleted file mode 100644 index 4387443c5e1..00000000000 --- a/nima/webserver/webserver/README.md +++ /dev/null @@ -1,8 +0,0 @@ -Server ----- - -# Testing - -Most tests are located under `nima/tests/integration/webserver/webserver` -as it is much easier to use the JUnit extension that requires module which depends on server, which would create a circular -dependency if used from here. \ No newline at end of file diff --git a/nima/webserver/webserver/etc/spotbugs/exclude.xml b/nima/webserver/webserver/etc/spotbugs/exclude.xml deleted file mode 100644 index b6fb6235fe5..00000000000 --- a/nima/webserver/webserver/etc/spotbugs/exclude.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/nima/webserver/webserver/pom.xml b/nima/webserver/webserver/pom.xml deleted file mode 100644 index c1b4d247485..00000000000 --- a/nima/webserver/webserver/pom.xml +++ /dev/null @@ -1,224 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.webserver - helidon-nima-webserver-project - 4.0.0-SNAPSHOT - ../pom.xml - - - helidon-nima-webserver - Helidon Níma WebServer - - - etc/spotbugs/exclude.xml - - - - - io.helidon.common - helidon-common-http - - - io.helidon.common - helidon-common-socket - - - io.helidon.common - helidon-common-context - - - io.helidon.common - helidon-common-key-util - - - io.helidon.common - helidon-common-security - - - io.helidon.common - helidon-common-task - - - io.helidon.nima.common - helidon-nima-common-tls - - - io.helidon.nima.http.media - helidon-nima-http-media - - - io.helidon.nima.http.encoding - helidon-nima-http-encoding - - - - io.helidon.inject.configdriven - helidon-inject-configdriven-api - - - io.helidon.common.features - helidon-common-features - - - - io.helidon.inject.configdriven - helidon-inject-configdriven-runtime - true - - - io.helidon.inject - helidon-inject-api - - - io.helidon.inject - helidon-inject-runtime - true - - - io.helidon.inject.configdriven - helidon-inject-configdriven-processor - true - - - jakarta.inject - jakarta.inject-api - true - - - io.helidon.config - helidon-config-metadata - true - - - io.helidon.config - helidon-config-yaml - test - - - - helidon-nima-http-encoding-gzip - io.helidon.nima.http.encoding - test - - - - helidon-nima-http-media-jsonp - io.helidon.nima.http.media - test - - - jakarta.json - jakarta.json-api - test - - - org.junit.jupiter - junit-jupiter-api - test - - - junit-jupiter-params - org.junit.jupiter - test - - - mockito-core - org.mockito - test - - - org.hamcrest - hamcrest-all - test - - - helidon-common-testing-junit5 - io.helidon.common.testing - test - - - io.helidon.inject - helidon-inject-testing - test - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - io.helidon.config - helidon-config-metadata-processor - ${helidon.version} - - - io.helidon.builder - helidon-builder-processor - ${helidon.version} - - - io.helidon.inject.configdriven - helidon-inject-configdriven-processor - ${helidon.version} - - - io.helidon.common.processor - helidon-common-processor-helidon-copyright - ${helidon.version} - - - - - - io.helidon.builder - helidon-builder-processor - ${helidon.version} - - - io.helidon.config - helidon-config-metadata-processor - ${helidon.version} - - - io.helidon.inject.configdriven - helidon-inject-configdriven-processor - ${helidon.version} - - - io.helidon.common.processor - helidon-common-processor-helidon-copyright - ${helidon.version} - - - - - - diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/ConnectionContext.java b/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/ConnectionContext.java deleted file mode 100644 index 747a2e255e1..00000000000 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/ConnectionContext.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.webserver; - -import java.util.concurrent.ExecutorService; - -import io.helidon.common.buffers.DataReader; -import io.helidon.common.buffers.DataWriter; -import io.helidon.common.socket.SocketContext; - -/** - * Server connection context. - */ -public interface ConnectionContext extends SocketContext { - /** - * Context of the listener. Configuration specific to a single listener. - * - * @return listener specific context - */ - ListenerContext listenerContext(); - - /** - * Executor service to submit asynchronous tasks. - * - * @return executor service - */ - ExecutorService executor(); - - /** - * Data writer to write response bytes. - * - * @return data writer - */ - DataWriter dataWriter(); - - /** - * Data reader to read request bytes. - * - * @return data reader - */ - DataReader dataReader(); - - /** - * Router that may contain routings of different types (HTTP, WebSocket, grpc). - * - * @return rouer - */ - Router router(); -} diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/ProtocolConfigs.java b/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/ProtocolConfigs.java deleted file mode 100644 index 2fd554831df..00000000000 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/ProtocolConfigs.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.webserver; - -import java.util.List; -import java.util.Objects; - -import io.helidon.nima.webserver.spi.ProtocolConfig; - -/** - * Protocol configuration to obtain explicitly configured details for the current socket. - */ -public class ProtocolConfigs { - private final List protocolConfigs; - - private ProtocolConfigs(List protocolConfigs) { - this.protocolConfigs = List.copyOf(protocolConfigs); - } - - /** - * Create new protocol configuration handler. - * - * @param protocolConfigs all available protocol configurations. - * @return protocol configuration handler - */ - public static ProtocolConfigs create(List protocolConfigs) { - Objects.requireNonNull(protocolConfigs); - return new ProtocolConfigs(protocolConfigs); - } - - /** - * Get a protocol configuration if defined. - * - * @param protocolType type of the protocol, to distinguish between protocols - * (two protocols may use the same configuration class) - * @param protocolConfigType type of the expected configuration (same protocol type may use different configuration - * class) - - * @return protocol configuration(s) to use, if empty, this protocol should not be used - * @param type of the expected protocol configuration - */ - public List config(String protocolType, - Class protocolConfigType) { - Objects.requireNonNull(protocolType); - Objects.requireNonNull(protocolConfigType); - - return protocolConfigs.stream() - .filter(it -> protocolType.equals(it.type())) - .filter(it -> protocolConfigType.isAssignableFrom(it.getClass())) - .map(protocolConfigType::cast) - .toList(); - } -} diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/Filter.java b/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/Filter.java deleted file mode 100644 index a31d53b0625..00000000000 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/Filter.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.webserver.http; - -import io.helidon.nima.webserver.ServerLifecycle; - -/** - * HTTP filter. - */ -public interface Filter extends ServerLifecycle { - /** - * Handle a request. - * If request processing should be terminated, do not call {@link FilterChain#proceed()}. - * If request processing should continue with next filter, - * call {@link FilterChain#proceed()}. - * {@link io.helidon.nima.webserver.http.FilterChain#proceed()} may throw an exception. The following exceptions - * mean the connection will close (and the request cannot finish): - *

      - *
    • {@link io.helidon.nima.webserver.CloseConnectionException}
    • - *
    • {@link java.io.UncheckedIOException}
    • - *
    - * Filters may throw {@link io.helidon.common.http.HttpException} (or its subclasses), all filters before the current - * filter will not receive such an exception - it will be processed before the method - * {@link io.helidon.nima.webserver.http.FilterChain#proceed()} returns. - * - * @param chain to proceed with further filters (or routing if this is the last filter) - * @param req routing request - * @param res routing response - */ - void filter(FilterChain chain, RoutingRequest req, RoutingResponse res); -} diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/package-info.java b/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/package-info.java deleted file mode 100644 index edaff442744..00000000000 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * WebServer HTTP specific APIs. - */ -package io.helidon.nima.webserver.http; diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/spi/package-info.java b/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/spi/package-info.java deleted file mode 100644 index f080b2345b0..00000000000 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/spi/package-info.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * WebServer HTTP sink SPI. - * - * @see io.helidon.nima.webserver.http.spi.SinkProvider - */ -package io.helidon.nima.webserver.http.spi; diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ProtocolConfigProvider.java b/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ProtocolConfigProvider.java deleted file mode 100644 index 21796a170e7..00000000000 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ProtocolConfigProvider.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.webserver.http1; - -import io.helidon.common.config.Config; -import io.helidon.nima.webserver.spi.ProtocolConfigProvider; - -/** - * Implementation of a service provider interface to create HTTP/1.1 protocol configuration. - */ -public class Http1ProtocolConfigProvider implements ProtocolConfigProvider { - /** - * Required default constructor for {@link java.util.ServiceLoader}. - */ - public Http1ProtocolConfigProvider() { - } - - @Override - public String configKey() { - return Http1ConnectionProvider.CONFIG_NAME; - } - - @Override - public Http1Config create(Config config, String name) { - return Http1Config.builder() - .config(config) - .name(name) - .build(); - } -} diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/package-info.java b/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/package-info.java deleted file mode 100644 index f6ed981e096..00000000000 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * WebServer HTTP/1.1 specific APIs. - */ -package io.helidon.nima.webserver.http1; diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/spi/package-info.java b/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/spi/package-info.java deleted file mode 100644 index 69a1badded1..00000000000 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/spi/package-info.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * WebServer HTTP/1.1 specific SPIs. - * - * @see io.helidon.nima.webserver.http1.spi.Http1UpgradeProvider - */ -package io.helidon.nima.webserver.http1.spi; diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/package-info.java b/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/package-info.java deleted file mode 100644 index c72f0720f12..00000000000 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Níma WebServer module, combining common server API, HTTP API and HTTP/1.1 API to create a server. - */ -package io.helidon.nima.webserver; diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/spi/ProtocolConfig.java b/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/spi/ProtocolConfig.java deleted file mode 100644 index 573e232dc75..00000000000 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/spi/ProtocolConfig.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.webserver.spi; - -import io.helidon.common.config.NamedService; - -/** - * Protocol configuration abstraction, used to setup a protocol. - */ -public interface ProtocolConfig extends NamedService { -} diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/spi/ProtocolConfigProvider.java b/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/spi/ProtocolConfigProvider.java deleted file mode 100644 index cb050df3f54..00000000000 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/spi/ProtocolConfigProvider.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.webserver.spi; - -import io.helidon.common.config.ConfiguredProvider; - -/** - * Provider of protocol configuration. As we use protocols from multiple places (connection selectors, upgrade from HTTP/1), - * we have a single abstraction of their configuration. - * - * @param type of configuration supported by this provider - */ -public interface ProtocolConfigProvider extends ConfiguredProvider { - -} diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/spi/package-info.java b/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/spi/package-info.java deleted file mode 100644 index b7e5ff61d63..00000000000 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/spi/package-info.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * WebServer SPI. - * - * @see io.helidon.nima.webserver.spi.ServerConnectionSelectorProvider - */ -package io.helidon.nima.webserver.spi; diff --git a/nima/webserver/webserver/src/main/java/module-info.java b/nima/webserver/webserver/src/main/java/module-info.java deleted file mode 100644 index d35ccc6a00f..00000000000 --- a/nima/webserver/webserver/src/main/java/module-info.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.common.features.api.Feature; -import io.helidon.common.features.api.HelidonFlavor; - -/** - * Loom based WebServer. - */ -@Feature(value = "WebServer", - description = "Nima Web Server", - invalidIn = HelidonFlavor.SE -) -module io.helidon.nima.webserver { - requires transitive io.helidon.common.buffers; - requires transitive io.helidon.common.socket; - requires transitive io.helidon.nima.http.encoding; - requires transitive io.helidon.nima.http.media; - requires transitive io.helidon.nima.common.tls; - requires transitive io.helidon.config; - requires transitive io.helidon.common.context; - requires transitive io.helidon.common.security; - requires io.helidon.logging.common; - requires io.helidon.builder.api; - requires io.helidon.common.features.api; - requires io.helidon.common.features; - requires io.helidon.common.task; - - requires java.management; - // only used to keep logging active until shutdown hook finishes - requires java.logging; - - requires jakarta.annotation; - requires io.helidon.common.uri; - - requires static io.helidon.config.metadata; - requires static io.helidon.inject.configdriven.runtime; - requires static jakarta.inject; - // to compile @Generated - requires static java.compiler; - - // needed to compile injection generated classes - requires io.helidon.inject.api; - requires static io.helidon.inject.runtime; - - // provides multiple packages due to intentional cyclic dependency - // we want to support HTTP/1.1 by default (we could fully separate it, but the API would be harder to use - // for the basic routes); this would also require 4 modules (API + SPI, HTTP, HTTP/1.1, WebServer) - // and these modules would be used mostly together (both WebSocket and HTTP/2 require HTTP/1.1 to upgrade from) - exports io.helidon.nima.webserver; - exports io.helidon.nima.webserver.spi; - exports io.helidon.nima.webserver.http; - exports io.helidon.nima.webserver.http.spi; - exports io.helidon.nima.webserver.http1; - exports io.helidon.nima.webserver.http1.spi; - - uses io.helidon.nima.webserver.http1.spi.Http1UpgradeProvider; - uses io.helidon.nima.webserver.spi.ServerConnectionSelectorProvider; - uses io.helidon.nima.webserver.http.spi.SinkProvider; - uses io.helidon.nima.webserver.spi.ProtocolConfigProvider; - - provides io.helidon.nima.webserver.spi.ProtocolConfigProvider - with io.helidon.nima.webserver.http1.Http1ProtocolConfigProvider; - provides io.helidon.nima.webserver.spi.ServerConnectionSelectorProvider with io.helidon.nima.webserver.http1.Http1ConnectionProvider; - provides io.helidon.inject.api.ModuleComponent with io.helidon.nima.webserver.Injection$$Module; -} diff --git a/nima/webserver/webserver/src/test/java/io/helidon/nima/webserver/http1/ConnectionConfigTest.java b/nima/webserver/webserver/src/test/java/io/helidon/nima/webserver/http1/ConnectionConfigTest.java deleted file mode 100644 index 084a311d6b6..00000000000 --- a/nima/webserver/webserver/src/test/java/io/helidon/nima/webserver/http1/ConnectionConfigTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.webserver.http1; - -import java.util.Map; - -import io.helidon.config.Config; -import io.helidon.nima.webserver.WebServer; - -import org.junit.jupiter.api.Test; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.hasKey; -import static org.hamcrest.Matchers.not; - -public class ConnectionConfigTest { - - @Test - void testConnectionConfig() { - // This will pick up application.yaml from the classpath as default configuration file - TestConnectionSelectorProvider.reset(); - - Config config = Config.create(); - WebServer.builder().config(config.get("server")).build(); - - Map http1Configs = TestConnectionSelectorProvider.config(); - - assertThat(http1Configs, hasKey("@default")); - assertThat(http1Configs, hasKey("other")); - assertThat("Discover services is disabled for admin port", http1Configs, not(hasKey("admin"))); - - Http1Config http1Config = http1Configs.get("@default"); - assertThat(http1Config.maxPrologueLength(), is(4096)); - assertThat(http1Config.maxHeadersSize(), is(8192)); - assertThat(http1Config.validatePath(), is(true)); - assertThat(http1Config.validateRequestHeaders(), is(true)); - assertThat(http1Config.validateResponseHeaders(), is(false)); - - http1Config = http1Configs.get("other"); - assertThat(http1Config.maxPrologueLength(), is(81)); - assertThat(http1Config.maxHeadersSize(), is(42)); - assertThat(http1Config.validatePath(), is(false)); - assertThat(http1Config.validateRequestHeaders(), is(false)); - assertThat(http1Config.validateResponseHeaders(), is(true)); - } - -} diff --git a/nima/webserver/webserver/src/test/java/io/helidon/nima/webserver/http1/TestConnectionSelectorProvider.java b/nima/webserver/webserver/src/test/java/io/helidon/nima/webserver/http1/TestConnectionSelectorProvider.java deleted file mode 100644 index df2a39b0b10..00000000000 --- a/nima/webserver/webserver/src/test/java/io/helidon/nima/webserver/http1/TestConnectionSelectorProvider.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.webserver.http1; - -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import io.helidon.common.Weight; -import io.helidon.nima.webserver.ProtocolConfigs; -import io.helidon.nima.webserver.spi.ServerConnectionSelector; -import io.helidon.nima.webserver.spi.ServerConnectionSelectorProvider; - -import static org.mockito.Mockito.mock; - -@Weight(10) -public class TestConnectionSelectorProvider implements ServerConnectionSelectorProvider { - - private static final Map CONFIGS = new ConcurrentHashMap<>(); - - static Map config() { - return CONFIGS; - } - - static void reset() { - CONFIGS.clear(); - } - - @Override - public Class protocolConfigType() { - return Http1Config.class; - } - - @Override - public String protocolType() { - return "http_1_1"; - } - - @Override - public ServerConnectionSelector create(String socketName, Http1Config config, ProtocolConfigs configs) { - CONFIGS.put(socketName, config); - return mock(ServerConnectionSelector.class); - } - -} diff --git a/nima/webserver/webserver/src/test/resources/META-INF/services/io.helidon.nima.webserver.spi.ServerConnectionSelectorProvider b/nima/webserver/webserver/src/test/resources/META-INF/services/io.helidon.nima.webserver.spi.ServerConnectionSelectorProvider deleted file mode 100644 index a6b4de8e63a..00000000000 --- a/nima/webserver/webserver/src/test/resources/META-INF/services/io.helidon.nima.webserver.spi.ServerConnectionSelectorProvider +++ /dev/null @@ -1,17 +0,0 @@ -# -# Copyright (c) 2023 Oracle and/or its affiliates. -# -# 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. -# - -io.helidon.nima.webserver.http1.TestConnectionSelectorProvider \ No newline at end of file diff --git a/nima/websocket/client/etc/spotbugs/exclude.xml b/nima/websocket/client/etc/spotbugs/exclude.xml deleted file mode 100644 index 8e078d9d02a..00000000000 --- a/nima/websocket/client/etc/spotbugs/exclude.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/nima/websocket/client/pom.xml b/nima/websocket/client/pom.xml deleted file mode 100644 index 362427e5296..00000000000 --- a/nima/websocket/client/pom.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.websocket - helidon-nima-websocket-project - 4.0.0-SNAPSHOT - - - helidon-nima-websocket-client - Helidon Níma WebSocket Client - - - etc/spotbugs/exclude.xml - - - - - io.helidon.nima.webclient - helidon-nima-webclient - - - io.helidon.common - helidon-common-buffers - - - io.helidon.nima.websocket - helidon-nima-websocket - - - io.helidon.config - helidon-config-metadata - true - - - io.helidon.common.features - helidon-common-features-api - true - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - io.helidon.builder - helidon-builder-processor - ${helidon.version} - - - - - - io.helidon.builder - helidon-builder-processor - ${helidon.version} - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - - - - - diff --git a/nima/websocket/client/src/main/java/io/helidon/nima/websocket/client/WsProtocolConfigProvider.java b/nima/websocket/client/src/main/java/io/helidon/nima/websocket/client/WsProtocolConfigProvider.java deleted file mode 100644 index cb165abd321..00000000000 --- a/nima/websocket/client/src/main/java/io/helidon/nima/websocket/client/WsProtocolConfigProvider.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.websocket.client; - -import io.helidon.common.config.Config; -import io.helidon.nima.webclient.spi.ProtocolConfigProvider; - -/** - * Implementation of protocol config provider. - */ -public class WsProtocolConfigProvider implements ProtocolConfigProvider { - /** - * Required to be used by {@link java.util.ServiceLoader}. - * - * @deprecated do not use directly, use WsClientProtocolConfig - */ - public WsProtocolConfigProvider() { - } - - @Override - public String configKey() { - return WsProtocolProvider.CONFIG_KEY; - } - - @Override - public WsClientProtocolConfig create(Config config, String name) { - return WsClientProtocolConfig.builder() - .config(config) - .name(name) - .build(); - } -} diff --git a/nima/websocket/client/src/main/java/io/helidon/nima/websocket/client/package-info.java b/nima/websocket/client/src/main/java/io/helidon/nima/websocket/client/package-info.java deleted file mode 100644 index db4b2d8026c..00000000000 --- a/nima/websocket/client/src/main/java/io/helidon/nima/websocket/client/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * WebSocket client. - */ -package io.helidon.nima.websocket.client; diff --git a/nima/websocket/client/src/main/java/module-info.java b/nima/websocket/client/src/main/java/module-info.java deleted file mode 100644 index aaa1c38789f..00000000000 --- a/nima/websocket/client/src/main/java/module-info.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.common.features.api.Feature; -import io.helidon.common.features.api.HelidonFlavor; -import io.helidon.nima.webclient.spi.ClientProtocolProvider; - -/** - * WebSocket client. - */ -@Feature(value = "WebSocket Client", - description = "WebSocket Client", - in = HelidonFlavor.SE, - path = {"WebSocket", "Client"} -) -module io.helidon.nima.websocket.client { - requires static io.helidon.common.features.api; - requires static io.helidon.config.metadata; - - requires io.helidon.nima.websocket; - requires io.helidon.nima.webclient; - - exports io.helidon.nima.websocket.client; - - provides ClientProtocolProvider - with io.helidon.nima.websocket.client.WsProtocolProvider; - provides io.helidon.nima.webclient.spi.ProtocolConfigProvider - with io.helidon.nima.websocket.client.WsProtocolConfigProvider; -} \ No newline at end of file diff --git a/nima/websocket/pom.xml b/nima/websocket/pom.xml deleted file mode 100644 index 1408aaf1911..00000000000 --- a/nima/websocket/pom.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - 4.0.0 - - - io.helidon.nima - helidon-nima-project - 4.0.0-SNAPSHOT - ../pom.xml - - - io.helidon.nima.websocket - helidon-nima-websocket-project - Helidon Níma WebSocket Project - - pom - - - websocket - webserver - client - - - diff --git a/nima/websocket/webserver/etc/spotbugs/exclude.xml b/nima/websocket/webserver/etc/spotbugs/exclude.xml deleted file mode 100644 index 640ed701810..00000000000 --- a/nima/websocket/webserver/etc/spotbugs/exclude.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - diff --git a/nima/websocket/webserver/pom.xml b/nima/websocket/webserver/pom.xml deleted file mode 100644 index 6e7db15f5eb..00000000000 --- a/nima/websocket/webserver/pom.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.websocket - helidon-nima-websocket-project - 4.0.0-SNAPSHOT - - - helidon-nima-websocket-webserver - Helidon Níma WebSocket WebServer - - - etc/spotbugs/exclude.xml - - - - - io.helidon.nima.websocket - helidon-nima-websocket - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.common.features - helidon-common-features-api - true - - - io.helidon.config - helidon-config-metadata - true - - - io.helidon.builder - helidon-builder-api - - - io.helidon.config - helidon-config-yaml - test - - - org.junit.jupiter - junit-jupiter-api - test - - - mockito-core - org.mockito - test - - - org.hamcrest - hamcrest-all - test - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - io.helidon.config - helidon-config-metadata-processor - ${helidon.version} - - - io.helidon.builder - helidon-builder-processor - ${helidon.version} - - - io.helidon.common.processor - helidon-common-processor-helidon-copyright - ${helidon.version} - - - - - - io.helidon.builder - helidon-builder-processor - ${helidon.version} - - - io.helidon.config - helidon-config-metadata-processor - ${helidon.version} - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - io.helidon.common.processor - helidon-common-processor-helidon-copyright - ${helidon.version} - - - - - - - diff --git a/nima/websocket/webserver/src/main/java/io/helidon/nima/websocket/webserver/WsProtocolConfigProvider.java b/nima/websocket/webserver/src/main/java/io/helidon/nima/websocket/webserver/WsProtocolConfigProvider.java deleted file mode 100644 index 086fde8f720..00000000000 --- a/nima/websocket/webserver/src/main/java/io/helidon/nima/websocket/webserver/WsProtocolConfigProvider.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.nima.websocket.webserver; - -import io.helidon.common.config.Config; -import io.helidon.nima.webserver.spi.ProtocolConfigProvider; - -/** - * Service provider implementation for WebSocket protocol configuration. - */ -public class WsProtocolConfigProvider implements ProtocolConfigProvider { - @Override - public String configKey() { - return WsUpgradeProvider.CONFIG_NAME; - } - - @Override - public WsConfig create(Config config, String name) { - return WsConfig.builder() - .config(config) - .name(name) - .build(); - } -} diff --git a/nima/websocket/webserver/src/main/java/io/helidon/nima/websocket/webserver/package-info.java b/nima/websocket/webserver/src/main/java/io/helidon/nima/websocket/webserver/package-info.java deleted file mode 100644 index 7f2074f3a09..00000000000 --- a/nima/websocket/webserver/src/main/java/io/helidon/nima/websocket/webserver/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * WebSocket server support. - */ -package io.helidon.nima.websocket.webserver; diff --git a/nima/websocket/webserver/src/main/java/module-info.java b/nima/websocket/webserver/src/main/java/module-info.java deleted file mode 100644 index a49b35f2a99..00000000000 --- a/nima/websocket/webserver/src/main/java/module-info.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.common.features.api.Feature; -import io.helidon.common.features.api.HelidonFlavor; - -/** - * WebSocket server support. - */ -@Feature(value = "WebSocket", - description = "WebSocket server support", - in = HelidonFlavor.SE, - path = {"WebSocket", "WebServer"} -) -module io.helidon.nima.websocket.webserver { - requires static io.helidon.common.features.api; - requires static io.helidon.config.metadata; - - requires io.helidon.common; - requires io.helidon.common.http; - requires io.helidon.common.socket; - requires io.helidon.builder.api; - requires transitive io.helidon.nima.websocket; - requires transitive io.helidon.nima.webserver; - - exports io.helidon.nima.websocket.webserver; - - provides io.helidon.nima.webserver.http1.spi.Http1UpgradeProvider - with io.helidon.nima.websocket.webserver.WsUpgradeProvider; - provides io.helidon.nima.webserver.spi.ProtocolConfigProvider - with io.helidon.nima.websocket.webserver.WsProtocolConfigProvider; -} \ No newline at end of file diff --git a/nima/websocket/websocket/pom.xml b/nima/websocket/websocket/pom.xml deleted file mode 100644 index 2fa64fe4de3..00000000000 --- a/nima/websocket/websocket/pom.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - 4.0.0 - - io.helidon.nima.websocket - helidon-nima-websocket-project - 4.0.0-SNAPSHOT - - - helidon-nima-websocket - Helidon Níma WebSocket - - - - io.helidon.common - helidon-common-buffers - - - io.helidon.common - helidon-common-socket - - - io.helidon.common - helidon-common-http - - - io.helidon.common.features - helidon-common-features-api - true - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - io.helidon.common.features - helidon-common-features-processor - ${helidon.version} - - - - - - - - diff --git a/nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/package-info.java b/nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/package-info.java deleted file mode 100644 index 4a885a4b96b..00000000000 --- a/nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * WebSocket APIs. - */ -package io.helidon.nima.websocket; diff --git a/nima/websocket/websocket/src/main/java/module-info.java b/nima/websocket/websocket/src/main/java/module-info.java deleted file mode 100644 index 9a5fe63bf10..00000000000 --- a/nima/websocket/websocket/src/main/java/module-info.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -import io.helidon.common.features.api.Feature; -import io.helidon.common.features.api.HelidonFlavor; - -/** - * WebSocket APIs. - */ -@Feature(value = "WebSocket", - description = "WebSocket APIs", - in = HelidonFlavor.SE, - path = "WebSocket" -) -module io.helidon.nima.websocket { - requires static io.helidon.common.features.api; - - requires io.helidon.common; - requires transitive io.helidon.common.socket; - requires transitive io.helidon.common.buffers; - requires transitive io.helidon.common.http; - - exports io.helidon.nima.websocket; -} diff --git a/openapi/pom.xml b/openapi/pom.xml index 2c38938729e..e04660e4d68 100644 --- a/openapi/pom.xml +++ b/openapi/pom.xml @@ -26,7 +26,6 @@ io.helidon.openapi helidon-openapi - Helidon OpenAPI @@ -39,8 +38,8 @@ - io.helidon.nima.service-common - helidon-nima-service-common + io.helidon.webserver + helidon-webserver-service-common jakarta.json @@ -64,8 +63,8 @@ helidon-common-media-type - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver io.helidon.config diff --git a/openapi/src/main/java/io/helidon/openapi/OpenApiFeature.java b/openapi/src/main/java/io/helidon/openapi/OpenApiFeature.java index 26eb77c631e..1cb36c58fcf 100644 --- a/openapi/src/main/java/io/helidon/openapi/OpenApiFeature.java +++ b/openapi/src/main/java/io/helidon/openapi/OpenApiFeature.java @@ -33,19 +33,19 @@ import java.util.concurrent.ConcurrentMap; import java.util.stream.Collectors; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpMediaType; -import io.helidon.common.http.ServerRequestHeaders; -import io.helidon.common.http.WritableHeaders; import io.helidon.common.media.type.MediaType; import io.helidon.common.media.type.MediaTypes; import io.helidon.config.Config; import io.helidon.config.metadata.ConfiguredOption; -import io.helidon.nima.servicecommon.HelidonFeatureSupport; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.Http; +import io.helidon.http.HttpMediaType; +import io.helidon.http.ServerRequestHeaders; +import io.helidon.http.WritableHeaders; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; +import io.helidon.webserver.servicecommon.HelidonFeatureSupport; /** * Behavior shared between the SE and MP OpenAPI feature implementations. diff --git a/openapi/src/main/java/io/helidon/openapi/OpenApiUi.java b/openapi/src/main/java/io/helidon/openapi/OpenApiUi.java index 799d441475c..a5018a3ced8 100644 --- a/openapi/src/main/java/io/helidon/openapi/OpenApiUi.java +++ b/openapi/src/main/java/io/helidon/openapi/OpenApiUi.java @@ -18,14 +18,14 @@ import java.util.Map; import java.util.function.Function; -import io.helidon.common.http.HttpMediaType; import io.helidon.common.media.type.MediaType; import io.helidon.config.Config; import io.helidon.config.metadata.Configured; import io.helidon.config.metadata.ConfiguredOption; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.HttpMediaType; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; /** * Behavior for OpenAPI UI implementations. @@ -51,7 +51,7 @@ public interface OpenApiUi extends HttpService { * Indicates the media types the UI implementation itself supports. * * @return the media types the - * {@link #prepareTextResponseFromMainEndpoint(io.helidon.nima.webserver.http.ServerRequest, io.helidon.nima.webserver.http.ServerResponse)} + * {@link #prepareTextResponseFromMainEndpoint(io.helidon.webserver.http.ServerRequest, io.helidon.webserver.http.ServerResponse)} * method responds to */ HttpMediaType[] supportedMediaTypes(); diff --git a/openapi/src/main/java/io/helidon/openapi/OpenApiUiBase.java b/openapi/src/main/java/io/helidon/openapi/OpenApiUiBase.java index 3e2b527161d..a4533b61022 100644 --- a/openapi/src/main/java/io/helidon/openapi/OpenApiUiBase.java +++ b/openapi/src/main/java/io/helidon/openapi/OpenApiUiBase.java @@ -25,13 +25,13 @@ import io.helidon.common.HelidonServiceLoader; import io.helidon.common.LazyValue; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpMediaType; import io.helidon.common.media.type.MediaType; import io.helidon.common.media.type.MediaTypes; import io.helidon.common.uri.UriQuery; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.Http; +import io.helidon.http.HttpMediaType; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; /** * Common base class for implementations of @link OpenApiUi}. diff --git a/openapi/src/main/java/io/helidon/openapi/OpenApiUiNoOp.java b/openapi/src/main/java/io/helidon/openapi/OpenApiUiNoOp.java index a983918807d..08b9b0253a8 100644 --- a/openapi/src/main/java/io/helidon/openapi/OpenApiUiNoOp.java +++ b/openapi/src/main/java/io/helidon/openapi/OpenApiUiNoOp.java @@ -15,10 +15,10 @@ */ package io.helidon.openapi; -import io.helidon.common.http.HttpMediaType; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.HttpMediaType; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; /** * Implementation of {@link io.helidon.openapi.OpenApiUi} which provides no UI support but simply honors the interface. diff --git a/openapi/src/main/java/io/helidon/openapi/package-info.java b/openapi/src/main/java/io/helidon/openapi/package-info.java index ea13ec200bd..28a455c548a 100644 --- a/openapi/src/main/java/io/helidon/openapi/package-info.java +++ b/openapi/src/main/java/io/helidon/openapi/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022 Oracle and/or its affiliates. + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,6 @@ */ /** - * Helidon common OpenAPI classes to be used when integrating with servers (Níma, Reactive, MicroProfile). + * Helidon common OpenAPI classes. */ package io.helidon.openapi; diff --git a/openapi/src/main/java/module-info.java b/openapi/src/main/java/module-info.java index 2564aa66bb9..272b94b5f55 100644 --- a/openapi/src/main/java/module-info.java +++ b/openapi/src/main/java/module-info.java @@ -25,7 +25,7 @@ requires io.helidon.common; requires io.helidon.common.config; requires io.helidon.common.media.type; - requires io.helidon.nima.servicecommon; + requires io.helidon.servicecommon; requires jakarta.json; diff --git a/openapi/src/test/java/io/helidon/openapi/ServerTest.java b/openapi/src/test/java/io/helidon/openapi/ServerTest.java index b7147060321..012b9b5043d 100644 --- a/openapi/src/test/java/io/helidon/openapi/ServerTest.java +++ b/openapi/src/test/java/io/helidon/openapi/ServerTest.java @@ -25,7 +25,7 @@ import io.helidon.common.media.type.MediaTypes; import io.helidon.config.Config; import io.helidon.config.ConfigSources; -import io.helidon.nima.webserver.WebServer; +import io.helidon.webserver.WebServer; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; diff --git a/openapi/src/test/java/io/helidon/openapi/TestUtil.java b/openapi/src/test/java/io/helidon/openapi/TestUtil.java index 5d6f9299813..9216eb0156a 100644 --- a/openapi/src/test/java/io/helidon/openapi/TestUtil.java +++ b/openapi/src/test/java/io/helidon/openapi/TestUtil.java @@ -17,7 +17,6 @@ import java.io.IOException; import java.io.InputStreamReader; -import java.io.Reader; import java.net.HttpURLConnection; import java.net.URL; import java.nio.CharBuffer; @@ -29,14 +28,14 @@ import java.util.logging.Level; import java.util.logging.Logger; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpMediaType; +import io.helidon.http.Http; +import io.helidon.http.HttpMediaType; import io.helidon.common.media.type.MediaType; import io.helidon.common.media.type.MediaTypes; import io.helidon.config.Config; import io.helidon.config.ConfigSources; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.HttpRouting; import jakarta.json.Json; import jakarta.json.JsonReader; diff --git a/pom.xml b/pom.xml index e09115a0c32..2eb8c32d828 100644 --- a/pom.xml +++ b/pom.xml @@ -181,36 +181,39 @@ - parent - dependencies - bom - helidon + inject applications - licensing + bom + builder + bundles common config - security - lra - microprofile - tracing - bundles - metrics - health - openapi - jersey + cors dbclient - integrations - messaging + dependencies + fault-tolerance graphql + health + helidon + http + integrations + jersey + licensing logging + lra + messaging + metrics + microprofile + openapi + parent scheduling - nima - cors - inject - builder + security + tracing + webclient + webserver + websocket - diff --git a/scheduling/src/test/resources/logging.properties b/scheduling/src/test/resources/logging.properties index 29168095a7c..ef8cc886e65 100644 --- a/scheduling/src/test/resources/logging.properties +++ b/scheduling/src/test/resources/logging.properties @@ -27,6 +27,6 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ .level=WARNING io.helidon.level=INFO -io.helidon.nima.faulttolerance.level=INFO +io.helidon.faulttolerance.level=INFO diff --git a/security/integration/nima/pom.xml b/security/integration/nima/pom.xml deleted file mode 100644 index eed2215faa8..00000000000 --- a/security/integration/nima/pom.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - 4.0.0 - - io.helidon.security.integration - helidon-security-integration-project - 4.0.0-SNAPSHOT - ../pom.xml - - helidon-security-integration-nima - Helidon Security Integration Níma - - - - io.helidon.security - helidon-security - - - io.helidon.security.integration - helidon-security-integration-common - - - io.helidon.config - helidon-config - - - io.helidon.nima.webserver - helidon-nima-webserver - provided - - - io.helidon.security - helidon-security-util - - - io.helidon.nima.webserver - helidon-nima-webserver-context - - - io.helidon.config - helidon-config-yaml - test - - - - - io.helidon.security.providers - helidon-security-providers-http-auth - test - - - io.helidon.security.providers - helidon-security-providers-abac - test - - - io.helidon.config - helidon-config-encryption - test - - - io.helidon.bundles - helidon-bundles-config - test - - - io.helidon.nima.webclient - helidon-nima-webclient - test - - - io.helidon.nima.webclient - helidon-nima-webclient-security - test - - - io.helidon.common.testing - helidon-common-testing-junit5 - test - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.mockito - mockito-core - test - - - org.hamcrest - hamcrest-all - test - - - diff --git a/security/integration/nima/src/main/java/io/helidon/security/integration/nima/package-info.java b/security/integration/nima/src/main/java/io/helidon/security/integration/nima/package-info.java deleted file mode 100644 index e92a0fca42e..00000000000 --- a/security/integration/nima/src/main/java/io/helidon/security/integration/nima/package-info.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2018, 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Integration library for RxServer. - *

    - * Example of integration (expects an instance of {@link io.helidon.security.Security}): - *

    - * // Web server routing builder - this is our integration point
    - * {@link io.helidon.nima.webserver.http.HttpRouting} routing = HttpRouting.builder()
    - * // register the WebSecurity to create context (shared by all routes)
    - * .register({@link io.helidon.security.integration.nima.SecurityFeature}.{@link
    - * io.helidon.security.integration.nima.SecurityFeature#create(io.helidon.security.Security) from(security)})
    - * // authenticate all paths under /user and require role "user"
    - * .get("/user[/{*}]", WebSecurity.{@link io.helidon.security.integration.nima.SecurityFeature#authenticate() authenticate()}
    - * .{@link io.helidon.security.integration.nima.SecurityFeature#rolesAllowed(java.lang.String...) rolesAllowed("user")})
    - * // authenticate "/admin" path and require role "admin"
    - * .get("/admin", WebSecurity.rolesAllowed("admin")
    - * .authenticate()
    - * )
    - * // build a routing instance to start {@link io.helidon.nima.webserver.WebServer} with.
    - * .build();
    - * 
    - * - *

    - * The main security methods are duplicate - first as static methods on {@link io.helidon.security.integration.nima.SecurityFeature} and - * then as instance methods on {@link io.helidon.security.integration.nima.SecurityHandler} that is returned by the static methods - * above. This is to provide a single starting point for security integration ({@link io.helidon.security.integration.nima.SecurityFeature}) - * and fluent API to build the "gate" to each route that is protected. - * - * @see io.helidon.security.integration.nima.SecurityFeature#create(io.helidon.security.Security) - * @see io.helidon.security.integration.nima.SecurityFeature#create(io.helidon.config.Config) - * @see io.helidon.security.integration.nima.SecurityFeature#create(io.helidon.security.Security, io.helidon.config.Config) - */ -package io.helidon.security.integration.nima; diff --git a/security/integration/nima/src/main/java/module-info.java b/security/integration/nima/src/main/java/module-info.java deleted file mode 100644 index a022f314e1a..00000000000 --- a/security/integration/nima/src/main/java/module-info.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Security integration with Helidon Níma Webserver. - */ -module io.helidon.security.integration.nima { - requires java.logging; - requires jakarta.annotation; - - requires transitive io.helidon.security; - requires transitive io.helidon.security.util; - requires io.helidon.common.context; - requires io.helidon.nima.webserver; - requires io.helidon.security.integration.common; - - exports io.helidon.security.integration.nima; -} diff --git a/security/integration/nima/src/test/resources/application.yaml b/security/integration/nima/src/test/resources/application.yaml deleted file mode 100644 index 9d15f338ddf..00000000000 --- a/security/integration/nima/src/test/resources/application.yaml +++ /dev/null @@ -1,68 +0,0 @@ -# -# Copyright (c) 2016, 2022 Oracle and/or its affiliates. -# -# 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. -# - - -security: - config: - # Configuration of secured config (encryption of passwords in property files) - # Set to true for production - if set to true, clear text passwords will cause failure - require-encryption: false - providers: - - http-basic-auth: - realm: "mic" - users: - - login: "jack" - password: "${CLEAR=jackIsGreat}" - roles: ["user", "admin"] - - login: "jill" - password: "${CLEAR=password}" - roles: ["user"] - - login: "john" - password: "${CLEAR=password}" - - abac: - web-server: - defaults: - query-params: - - name: "jwt" - header: "BEARER_TOKEN" - # looking for first matching group - token-regexp: "bearer (.*)" - # optional alternative - using a prefix - # prefix: "bearer " - - name: "name" - header: "NAME_FROM_REQUEST" - paths: - - path: "/query" - audit: true - - path: "/noRoles" - methods: ["get"] - authenticate: true - - path: "/user[/{*}]" - methods: ["get"] - # implies authentication and authorization - roles-allowed: ["user"] - - path: "/admin" - methods: ["get"] - roles-allowed: ["admin"] - - path: "/deny" - methods: ["get"] - roles-allowed: ["deny"] - - path: "/auditOnly" - # method - any - # audit all methods (by default GET and HEAD are not audited) - audit: true - audit-event-type: "unit_test" - audit-message-format: "Unit test message format" diff --git a/security/integration/pom.xml b/security/integration/pom.xml index f90024efca2..b7b3ae5a485 100644 --- a/security/integration/pom.xml +++ b/security/integration/pom.xml @@ -34,6 +34,5 @@ common - nima diff --git a/security/providers/google-login/src/test/java/io/helidon/security/providers/google/login/GoogleTokenProviderTest.java b/security/providers/google-login/src/test/java/io/helidon/security/providers/google/login/GoogleTokenProviderTest.java index abb0cc35089..d2e3144c609 100644 --- a/security/providers/google-login/src/test/java/io/helidon/security/providers/google/login/GoogleTokenProviderTest.java +++ b/security/providers/google-login/src/test/java/io/helidon/security/providers/google/login/GoogleTokenProviderTest.java @@ -23,8 +23,6 @@ import java.util.List; import java.util.Locale; import java.util.Optional; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ForkJoinPool; import java.util.function.BiFunction; import io.helidon.security.AuthenticationResponse; @@ -118,7 +116,7 @@ public void testInbound() { } @Test - public void testInboundIncorrectToken() throws ExecutionException, InterruptedException { + public void testInboundIncorrectToken() { ProviderRequest inboundRequest = createInboundRequest("Authorization", "tearer " + TOKEN_VALUE); AuthenticationResponse response = provider.authenticate(inboundRequest); @@ -128,7 +126,7 @@ public void testInboundIncorrectToken() throws ExecutionException, InterruptedEx } @Test - public void testInboundMissingToken() throws ExecutionException, InterruptedException { + public void testInboundMissingToken() { ProviderRequest inboundRequest = createInboundRequest("OtherHeader", "tearer " + TOKEN_VALUE); AuthenticationResponse response = provider.authenticate(inboundRequest); @@ -138,7 +136,7 @@ public void testInboundMissingToken() throws ExecutionException, InterruptedExce } @Test - public void testInboundInvalidToken() throws ExecutionException, InterruptedException, GeneralSecurityException, IOException { + public void testInboundInvalidToken() throws GeneralSecurityException, IOException { GoogleIdTokenVerifier verifier = mock(GoogleIdTokenVerifier.class); when(verifier.verify(TOKEN_VALUE)).thenReturn(null); GoogleTokenProvider provider = GoogleTokenProvider.builder().clientId("clientId").verifier(verifier).build(); @@ -152,8 +150,7 @@ public void testInboundInvalidToken() throws ExecutionException, InterruptedExce } @Test - public void testInboundVerificationException() - throws ExecutionException, InterruptedException, GeneralSecurityException, IOException { + public void testInboundVerificationException() throws GeneralSecurityException, IOException { GoogleIdTokenVerifier verifier = mock(GoogleIdTokenVerifier.class); when(verifier.verify(TOKEN_VALUE)).thenThrow(new IOException("Failed to verify token")); GoogleTokenProvider provider = GoogleTokenProvider.builder().clientId("clientId").verifier(verifier).build(); diff --git a/security/providers/http-auth/pom.xml b/security/providers/http-auth/pom.xml index fb9d8a9ddf3..92ba736e536 100644 --- a/security/providers/http-auth/pom.xml +++ b/security/providers/http-auth/pom.xml @@ -82,13 +82,13 @@ test - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver test - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test diff --git a/security/providers/http-sign/src/test/java/io/helidon/security/providers/httpsign/CurrentHttpSignProviderTest.java b/security/providers/http-sign/src/test/java/io/helidon/security/providers/httpsign/CurrentHttpSignProviderTest.java index 1f7942ebac2..b17e053758c 100644 --- a/security/providers/http-sign/src/test/java/io/helidon/security/providers/httpsign/CurrentHttpSignProviderTest.java +++ b/security/providers/http-sign/src/test/java/io/helidon/security/providers/httpsign/CurrentHttpSignProviderTest.java @@ -23,10 +23,7 @@ import java.util.Map; import java.util.Optional; import java.util.TreeMap; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ForkJoinPool; -import io.helidon.common.reactive.Single; import io.helidon.security.AuthenticationResponse; import io.helidon.security.EndpointConfig; import io.helidon.security.OutboundSecurityResponse; @@ -50,12 +47,11 @@ * Unit test for {@link HttpSignProvider}. */ abstract class CurrentHttpSignProviderTest { - private static final Duration TIMEOUT = Duration.ofSeconds(5); abstract HttpSignProvider getProvider(); @Test - void testInboundSignatureRsa() throws ExecutionException, InterruptedException { + void testInboundSignatureRsa() { Map> headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); headers.put("Signature", @@ -99,7 +95,7 @@ void testInboundSignatureRsa() throws ExecutionException, InterruptedException { } @Test - void testInboundSignatureHmac() throws InterruptedException, ExecutionException { + void testInboundSignatureHmac() { Map> headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); headers.put("Signature", @@ -139,7 +135,7 @@ void testInboundSignatureHmac() throws InterruptedException, ExecutionException } @Test - void testOutboundSignatureRsa() throws ExecutionException, InterruptedException { + void testOutboundSignatureRsa() { Map> headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); // the generated host contains port as well, so we must explicitly define it here @@ -182,7 +178,7 @@ void testOutboundSignatureRsa() throws ExecutionException, InterruptedException } @Test - void testOutboundSignatureHmac() throws ExecutionException, InterruptedException { + void testOutboundSignatureHmac() { Map> headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); // the generated host contains port as well, so we must explicitly define it here diff --git a/security/providers/http-sign/src/test/java/io/helidon/security/providers/httpsign/OldHttpSignProviderTest.java b/security/providers/http-sign/src/test/java/io/helidon/security/providers/httpsign/OldHttpSignProviderTest.java index 8c106203696..99f7d08ae8a 100644 --- a/security/providers/http-sign/src/test/java/io/helidon/security/providers/httpsign/OldHttpSignProviderTest.java +++ b/security/providers/http-sign/src/test/java/io/helidon/security/providers/httpsign/OldHttpSignProviderTest.java @@ -23,10 +23,7 @@ import java.util.Map; import java.util.Optional; import java.util.TreeMap; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ForkJoinPool; -import io.helidon.common.reactive.Single; import io.helidon.security.AuthenticationResponse; import io.helidon.security.EndpointConfig; import io.helidon.security.OutboundSecurityResponse; @@ -50,12 +47,11 @@ * Unit test for {@link HttpSignProvider}. */ abstract class OldHttpSignProviderTest { - private static final Duration TIMEOUT = Duration.ofSeconds(5); abstract HttpSignProvider getProvider(); @Test - void testInboundSignatureRsa() throws ExecutionException, InterruptedException { + void testInboundSignatureRsa() { Map> headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); headers.put("Signature", @@ -102,7 +98,7 @@ void testInboundSignatureRsa() throws ExecutionException, InterruptedException { } @Test - void testInboundSignatureHmac() throws InterruptedException, ExecutionException { + void testInboundSignatureHmac() { Map> headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); headers.put("Signature", @@ -142,7 +138,7 @@ void testInboundSignatureHmac() throws InterruptedException, ExecutionException } @Test - void testOutboundSignatureRsa() throws ExecutionException, InterruptedException { + void testOutboundSignatureRsa() { Map> headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); // the generated host contains port as well, so we must explicitly define it here @@ -188,7 +184,7 @@ void testOutboundSignatureRsa() throws ExecutionException, InterruptedException } @Test - void testOutboundSignatureHmac() throws ExecutionException, InterruptedException { + void testOutboundSignatureHmac() { Map> headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); // the generated host contains port as well, so we must explicitly define it here diff --git a/security/providers/idcs-mapper/src/main/java/io/helidon/security/providers/idcs/mapper/IdcsMtRoleMapperProvider.java b/security/providers/idcs-mapper/src/main/java/io/helidon/security/providers/idcs/mapper/IdcsMtRoleMapperProvider.java index 4a6dc751912..c9925f2891c 100644 --- a/security/providers/idcs-mapper/src/main/java/io/helidon/security/providers/idcs/mapper/IdcsMtRoleMapperProvider.java +++ b/security/providers/idcs-mapper/src/main/java/io/helidon/security/providers/idcs/mapper/IdcsMtRoleMapperProvider.java @@ -26,12 +26,10 @@ import io.helidon.common.context.Context; import io.helidon.common.context.Contexts; -import io.helidon.common.http.Http; import io.helidon.config.Config; import io.helidon.config.metadata.Configured; import io.helidon.config.metadata.ConfiguredOption; -import io.helidon.nima.webclient.api.HttpClientRequest; -import io.helidon.nima.webclient.api.WebClient; +import io.helidon.http.Http; import io.helidon.security.AuthenticationResponse; import io.helidon.security.Grant; import io.helidon.security.ProviderRequest; @@ -44,6 +42,8 @@ import io.helidon.security.spi.SecurityProvider; import io.helidon.security.spi.SubjectMappingProvider; import io.helidon.security.util.TokenHandler; +import io.helidon.webclient.api.HttpClientRequest; +import io.helidon.webclient.api.WebClient; import jakarta.json.Json; import jakarta.json.JsonArrayBuilder; diff --git a/security/providers/idcs-mapper/src/main/java/io/helidon/security/providers/idcs/mapper/IdcsRoleMapperProvider.java b/security/providers/idcs-mapper/src/main/java/io/helidon/security/providers/idcs/mapper/IdcsRoleMapperProvider.java index 27fbc238334..f4fc9467090 100644 --- a/security/providers/idcs-mapper/src/main/java/io/helidon/security/providers/idcs/mapper/IdcsRoleMapperProvider.java +++ b/security/providers/idcs-mapper/src/main/java/io/helidon/security/providers/idcs/mapper/IdcsRoleMapperProvider.java @@ -23,11 +23,10 @@ import io.helidon.common.context.Context; import io.helidon.common.context.Contexts; -import io.helidon.common.http.Http; import io.helidon.config.Config; import io.helidon.config.metadata.Configured; import io.helidon.config.metadata.ConfiguredOption; -import io.helidon.nima.webclient.api.HttpClientRequest; +import io.helidon.http.Http; import io.helidon.security.AuthenticationResponse; import io.helidon.security.Grant; import io.helidon.security.ProviderRequest; @@ -39,6 +38,7 @@ import io.helidon.security.providers.oidc.common.OidcConfig; import io.helidon.security.spi.SecurityProvider; import io.helidon.security.spi.SubjectMappingProvider; +import io.helidon.webclient.api.HttpClientRequest; import jakarta.json.Json; import jakarta.json.JsonArrayBuilder; diff --git a/security/providers/idcs-mapper/src/main/java/io/helidon/security/providers/idcs/mapper/IdcsRoleMapperProviderBase.java b/security/providers/idcs-mapper/src/main/java/io/helidon/security/providers/idcs/mapper/IdcsRoleMapperProviderBase.java index faac6177cef..58687d7ac90 100644 --- a/security/providers/idcs-mapper/src/main/java/io/helidon/security/providers/idcs/mapper/IdcsRoleMapperProviderBase.java +++ b/security/providers/idcs-mapper/src/main/java/io/helidon/security/providers/idcs/mapper/IdcsRoleMapperProviderBase.java @@ -30,14 +30,11 @@ import io.helidon.common.LazyValue; import io.helidon.common.context.Context; import io.helidon.common.context.Contexts; -import io.helidon.common.http.Http; import io.helidon.common.parameters.Parameters; import io.helidon.config.Config; import io.helidon.config.metadata.Configured; import io.helidon.config.metadata.ConfiguredOption; -import io.helidon.nima.webclient.api.HttpClientRequest; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.api.WebClient; +import io.helidon.http.Http; import io.helidon.security.AuthenticationResponse; import io.helidon.security.Grant; import io.helidon.security.ProviderRequest; @@ -50,12 +47,15 @@ import io.helidon.security.jwt.Validator; import io.helidon.security.providers.oidc.common.OidcConfig; import io.helidon.security.spi.SubjectMappingProvider; +import io.helidon.webclient.api.HttpClientRequest; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.api.WebClient; import jakarta.json.JsonArray; import jakarta.json.JsonObject; /** - * Common functionality for IDCS role mapping using {@link io.helidon.nima.webclient.http1.Http1Client}. + * Common functionality for IDCS role mapping using {@link io.helidon.webclient.http1.Http1Client}. */ public abstract class IdcsRoleMapperProviderBase implements SubjectMappingProvider { /** diff --git a/security/providers/oidc-common/pom.xml b/security/providers/oidc-common/pom.xml index 7792d104e39..2100389c7fd 100644 --- a/security/providers/oidc-common/pom.xml +++ b/security/providers/oidc-common/pom.xml @@ -51,16 +51,16 @@ helidon-cors - io.helidon.nima.webclient - helidon-nima-webclient + io.helidon.webclient + helidon-webclient - io.helidon.nima.webclient - helidon-nima-webclient-tracing + io.helidon.webclient + helidon-webclient-tracing - io.helidon.nima.http.media - helidon-nima-http-media-jsonp + io.helidon.http.media + helidon-http-media-jsonp io.helidon.jersey @@ -90,13 +90,13 @@ test - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver test - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test diff --git a/security/providers/oidc-common/src/main/java/io/helidon/security/providers/oidc/common/IdcsSupport.java b/security/providers/oidc-common/src/main/java/io/helidon/security/providers/oidc/common/IdcsSupport.java index 595e2a49e27..e2954a662f3 100644 --- a/security/providers/oidc-common/src/main/java/io/helidon/security/providers/oidc/common/IdcsSupport.java +++ b/security/providers/oidc-common/src/main/java/io/helidon/security/providers/oidc/common/IdcsSupport.java @@ -19,12 +19,12 @@ import java.net.URI; import java.time.Duration; -import io.helidon.common.http.Http; import io.helidon.common.parameters.Parameters; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.api.WebClient; +import io.helidon.http.Http; import io.helidon.security.SecurityException; import io.helidon.security.jwt.jwk.JwkKeys; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.api.WebClient; import jakarta.json.JsonObject; diff --git a/security/providers/oidc-common/src/main/java/io/helidon/security/providers/oidc/common/OidcConfig.java b/security/providers/oidc-common/src/main/java/io/helidon/security/providers/oidc/common/OidcConfig.java index b778b326743..bdceaa725f1 100644 --- a/security/providers/oidc-common/src/main/java/io/helidon/security/providers/oidc/common/OidcConfig.java +++ b/security/providers/oidc-common/src/main/java/io/helidon/security/providers/oidc/common/OidcConfig.java @@ -27,18 +27,18 @@ import io.helidon.common.Errors; import io.helidon.common.LazyValue; import io.helidon.common.configurable.Resource; -import io.helidon.common.http.SetCookie; import io.helidon.config.Config; import io.helidon.config.metadata.Configured; import io.helidon.config.metadata.ConfiguredOption; import io.helidon.cors.CrossOriginConfig; -import io.helidon.nima.webclient.api.WebClient; -import io.helidon.nima.webclient.api.WebClientConfig; +import io.helidon.http.SetCookie; import io.helidon.security.Security; import io.helidon.security.SecurityException; import io.helidon.security.jwt.jwk.JwkKeys; import io.helidon.security.providers.oidc.common.spi.TenantConfigFinder; import io.helidon.security.util.TokenHandler; +import io.helidon.webclient.api.WebClient; +import io.helidon.webclient.api.WebClientConfig; /** * Configuration of OIDC usable from all resources that utilize OIDC specification, such as security provider, web server diff --git a/security/providers/oidc-common/src/main/java/io/helidon/security/providers/oidc/common/OidcCookieHandler.java b/security/providers/oidc-common/src/main/java/io/helidon/security/providers/oidc/common/OidcCookieHandler.java index d54b212bd16..d85ef42bee3 100644 --- a/security/providers/oidc-common/src/main/java/io/helidon/security/providers/oidc/common/OidcCookieHandler.java +++ b/security/providers/oidc-common/src/main/java/io/helidon/security/providers/oidc/common/OidcCookieHandler.java @@ -28,7 +28,7 @@ import java.util.function.Consumer; import java.util.function.Function; -import io.helidon.common.http.SetCookie; +import io.helidon.http.SetCookie; /** * Handler of cookies used in OIDC. @@ -108,7 +108,7 @@ static Builder builder() { } /** - * {@link io.helidon.common.http.SetCookie} builder to set a new cookie, + * {@link io.helidon.http.SetCookie} builder to set a new cookie, * returns a future, as the value may need to be encrypted using a remote service. * * @param value value of the cookie @@ -128,7 +128,7 @@ public String cookieName() { } /** - * {@link io.helidon.common.http.SetCookie} builder to remove an existing cookie (such as during logout). + * {@link io.helidon.http.SetCookie} builder to remove an existing cookie (such as during logout). * * @return a new builder to configure set cookie configured from OIDC Config with expiration set to epoch begin and * empty value diff --git a/security/providers/oidc-common/src/main/java/io/helidon/security/providers/oidc/common/OidcMetadata.java b/security/providers/oidc-common/src/main/java/io/helidon/security/providers/oidc/common/OidcMetadata.java index 5e05e8fe8ac..680e6694782 100644 --- a/security/providers/oidc-common/src/main/java/io/helidon/security/providers/oidc/common/OidcMetadata.java +++ b/security/providers/oidc-common/src/main/java/io/helidon/security/providers/oidc/common/OidcMetadata.java @@ -21,7 +21,7 @@ import java.util.Optional; import io.helidon.common.Errors; -import io.helidon.nima.webclient.api.WebClient; +import io.helidon.webclient.api.WebClient; import jakarta.json.JsonObject; diff --git a/security/providers/oidc-common/src/main/java/io/helidon/security/providers/oidc/common/OidcUtil.java b/security/providers/oidc-common/src/main/java/io/helidon/security/providers/oidc/common/OidcUtil.java index 39156c31c26..7ea7e17dabf 100644 --- a/security/providers/oidc-common/src/main/java/io/helidon/security/providers/oidc/common/OidcUtil.java +++ b/security/providers/oidc-common/src/main/java/io/helidon/security/providers/oidc/common/OidcUtil.java @@ -22,12 +22,12 @@ import io.helidon.common.Errors; import io.helidon.common.config.Config; import io.helidon.common.socket.SocketOptions; -import io.helidon.nima.http.media.MediaContext; -import io.helidon.nima.http.media.jsonp.JsonpSupport; -import io.helidon.nima.webclient.api.Proxy; -import io.helidon.nima.webclient.api.WebClient; -import io.helidon.nima.webclient.api.WebClientConfig; -import io.helidon.nima.webclient.tracing.WebClientTracing; +import io.helidon.http.media.MediaContext; +import io.helidon.http.media.jsonp.JsonpSupport; +import io.helidon.webclient.api.Proxy; +import io.helidon.webclient.api.WebClient; +import io.helidon.webclient.api.WebClientConfig; +import io.helidon.webclient.tracing.WebClientTracing; final class OidcUtil { private static final System.Logger LOGGER = System.getLogger(OidcUtil.class.getName()); diff --git a/security/providers/oidc-common/src/main/java/io/helidon/security/providers/oidc/common/Tenant.java b/security/providers/oidc-common/src/main/java/io/helidon/security/providers/oidc/common/Tenant.java index c0a7c6b3bf7..3e566a38029 100644 --- a/security/providers/oidc-common/src/main/java/io/helidon/security/providers/oidc/common/Tenant.java +++ b/security/providers/oidc-common/src/main/java/io/helidon/security/providers/oidc/common/Tenant.java @@ -21,15 +21,15 @@ import java.util.Base64; import io.helidon.common.Errors; -import io.helidon.common.http.Http; -import io.helidon.nima.webclient.api.WebClient; -import io.helidon.nima.webclient.api.WebClientConfig; +import io.helidon.http.Http; import io.helidon.security.Security; import io.helidon.security.SecurityException; import io.helidon.security.jwt.jwk.JwkKeys; import io.helidon.security.providers.common.OutboundTarget; import io.helidon.security.providers.httpauth.HttpBasicAuthProvider; import io.helidon.security.providers.httpauth.HttpBasicOutboundConfig; +import io.helidon.webclient.api.WebClient; +import io.helidon.webclient.api.WebClientConfig; import jakarta.json.JsonObject; @@ -121,9 +121,9 @@ public static Tenant create(OidcConfig oidcConfig, TenantConfig tenantConfig) { .addOutboundSecurityProvider(httpBasicAuth) .build(); - //TODO Níma client security? + //TODO client security? // webClientBuilder.addService(WebClientSecurity.create(tokenOutboundSecurity)); - //This is workaround for missing Níma client security. This adds Authorization header to be used in every request. + //This is workaround for missing client security. This adds Authorization header to be used in every request. byte[] byteArray = (tenantConfig.clientId() + ":" + tenantConfig.clientSecret()).getBytes(StandardCharsets.UTF_8); String base64 = Base64.getEncoder().encodeToString(byteArray); webClientBuilder.addHeader(Http.HeaderNames.AUTHORIZATION, "Basic " + base64); diff --git a/security/providers/oidc-common/src/main/java/module-info.java b/security/providers/oidc-common/src/main/java/module-info.java index be109f85add..d31e0724df4 100644 --- a/security/providers/oidc-common/src/main/java/module-info.java +++ b/security/providers/oidc-common/src/main/java/module-info.java @@ -19,7 +19,7 @@ */ module io.helidon.security.providers.oidc.common { - requires transitive io.helidon.nima.webclient; + requires transitive io.helidon.webclient; // EncryptionProvider.EncryptionSupport is part of API requires transitive io.helidon.security; // TokenHandler is part of API @@ -33,8 +33,8 @@ requires io.helidon.common.crypto; requires static io.helidon.config.metadata; requires io.helidon.cors; - requires io.helidon.nima.http.media.jsonp; - requires io.helidon.nima.webclient.tracing; + requires io.helidon.http.media.jsonp; + requires io.helidon.webclient.tracing; exports io.helidon.security.providers.oidc.common; exports io.helidon.security.providers.oidc.common.spi; diff --git a/security/providers/oidc-common/src/test/java/io/helidon/security/providers/oidc/common/OidcConfigFromBuilderTest.java b/security/providers/oidc-common/src/test/java/io/helidon/security/providers/oidc/common/OidcConfigFromBuilderTest.java index 8bc00659393..d1243e43153 100644 --- a/security/providers/oidc-common/src/test/java/io/helidon/security/providers/oidc/common/OidcConfigFromBuilderTest.java +++ b/security/providers/oidc-common/src/test/java/io/helidon/security/providers/oidc/common/OidcConfigFromBuilderTest.java @@ -16,10 +16,10 @@ package io.helidon.security.providers.oidc.common; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.config.Config; import io.helidon.config.ConfigSources; -import io.helidon.nima.webserver.WebServer; +import io.helidon.webserver.WebServer; import org.junit.jupiter.api.Test; diff --git a/security/providers/oidc-common/src/test/java/io/helidon/security/providers/oidc/common/OidcCookieHandlerTest.java b/security/providers/oidc-common/src/test/java/io/helidon/security/providers/oidc/common/OidcCookieHandlerTest.java index 5807635740d..5e3cac2eece 100644 --- a/security/providers/oidc-common/src/test/java/io/helidon/security/providers/oidc/common/OidcCookieHandlerTest.java +++ b/security/providers/oidc-common/src/test/java/io/helidon/security/providers/oidc/common/OidcCookieHandlerTest.java @@ -20,8 +20,6 @@ import java.util.Map; import java.util.Optional; -import io.helidon.common.reactive.Single; - import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; diff --git a/security/providers/oidc/pom.xml b/security/providers/oidc/pom.xml index ec48da7e78b..40e3b647686 100644 --- a/security/providers/oidc/pom.xml +++ b/security/providers/oidc/pom.xml @@ -63,18 +63,18 @@ helidon-config - io.helidon.security.integration - helidon-security-integration-nima + io.helidon.webserver + helidon-webserver-security true - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver true - io.helidon.nima.webserver - helidon-nima-webserver-cors + io.helidon.webserver + helidon-webserver-cors true diff --git a/security/providers/oidc/src/main/java/io/helidon/security/providers/oidc/OidcFeature.java b/security/providers/oidc/src/main/java/io/helidon/security/providers/oidc/OidcFeature.java index ce7e0cf6326..280c9a2c6b5 100644 --- a/security/providers/oidc/src/main/java/io/helidon/security/providers/oidc/OidcFeature.java +++ b/security/providers/oidc/src/main/java/io/helidon/security/providers/oidc/OidcFeature.java @@ -35,33 +35,33 @@ import io.helidon.common.configurable.LruCache; import io.helidon.common.context.Context; import io.helidon.common.context.Contexts; -import io.helidon.common.http.Http; -import io.helidon.common.http.ServerRequestHeaders; -import io.helidon.common.http.ServerResponseHeaders; import io.helidon.common.parameters.Parameters; import io.helidon.config.Config; import io.helidon.cors.CrossOriginConfig; -import io.helidon.nima.webclient.api.HttpClientRequest; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.api.WebClient; -import io.helidon.nima.webserver.cors.CorsSupport; -import io.helidon.nima.webserver.http.HttpFeature; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.Http; +import io.helidon.http.ServerRequestHeaders; +import io.helidon.http.ServerResponseHeaders; import io.helidon.security.Security; import io.helidon.security.SecurityException; -import io.helidon.security.integration.nima.SecurityFeature; import io.helidon.security.providers.oidc.common.OidcConfig; import io.helidon.security.providers.oidc.common.OidcCookieHandler; import io.helidon.security.providers.oidc.common.Tenant; import io.helidon.security.providers.oidc.common.TenantConfig; import io.helidon.security.providers.oidc.common.spi.TenantConfigFinder; import io.helidon.security.providers.oidc.common.spi.TenantConfigProvider; +import io.helidon.webclient.api.HttpClientRequest; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.api.WebClient; +import io.helidon.webserver.cors.CorsSupport; +import io.helidon.webserver.http.HttpFeature; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; +import io.helidon.webserver.security.SecurityFeature; import jakarta.json.JsonObject; -import static io.helidon.common.http.Http.HeaderNames.HOST; +import static io.helidon.http.Http.HeaderNames.HOST; import static io.helidon.security.providers.oidc.common.spi.TenantConfigFinder.DEFAULT_TENANT_ID; /** diff --git a/security/providers/oidc/src/main/java/io/helidon/security/providers/oidc/TenantAuthenticationHandler.java b/security/providers/oidc/src/main/java/io/helidon/security/providers/oidc/TenantAuthenticationHandler.java index e0d9eefa596..b73f6fea01d 100644 --- a/security/providers/oidc/src/main/java/io/helidon/security/providers/oidc/TenantAuthenticationHandler.java +++ b/security/providers/oidc/src/main/java/io/helidon/security/providers/oidc/TenantAuthenticationHandler.java @@ -33,11 +33,9 @@ import java.util.stream.Collectors; import io.helidon.common.Errors; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderNames; import io.helidon.common.parameters.Parameters; -import io.helidon.nima.webclient.api.HttpClientRequest; -import io.helidon.nima.webclient.api.HttpClientResponse; +import io.helidon.http.Http; +import io.helidon.http.Http.HeaderNames; import io.helidon.security.AuthenticationResponse; import io.helidon.security.EndpointConfig; import io.helidon.security.Grant; @@ -61,6 +59,8 @@ import io.helidon.security.providers.oidc.common.Tenant; import io.helidon.security.providers.oidc.common.TenantConfig; import io.helidon.security.util.TokenHandler; +import io.helidon.webclient.api.HttpClientRequest; +import io.helidon.webclient.api.HttpClientResponse; import jakarta.json.JsonObject; diff --git a/security/providers/oidc/src/main/java/module-info.java b/security/providers/oidc/src/main/java/module-info.java index aa9492c14a4..e576d9bea6f 100644 --- a/security/providers/oidc/src/main/java/module-info.java +++ b/security/providers/oidc/src/main/java/module-info.java @@ -31,7 +31,7 @@ requires io.helidon.config; requires io.helidon.common; requires io.helidon.common.crypto; - requires io.helidon.nima.webclient; + requires io.helidon.webclient; requires io.helidon.security; requires io.helidon.security.providers.oidc.common; @@ -41,9 +41,9 @@ requires io.helidon.security.jwt; requires io.helidon.cors; - requires static io.helidon.nima.webserver; - requires static io.helidon.nima.webserver.cors; - requires static io.helidon.security.integration.nima; + requires static io.helidon.webserver; + requires static io.helidon.webserver.cors; + requires static io.helidon.webserver.security; requires static io.helidon.config.metadata; diff --git a/security/security/pom.xml b/security/security/pom.xml index a1094d1faaf..e173dbe615e 100644 --- a/security/security/pom.xml +++ b/security/security/pom.xml @@ -46,10 +46,6 @@ io.helidon.common helidon-common-configurable - - io.helidon.common - helidon-common-reactive - io.helidon.common helidon-common-uri diff --git a/security/security/src/main/java/module-info.java b/security/security/src/main/java/module-info.java index e4607dd3964..b998f91730a 100644 --- a/security/security/src/main/java/module-info.java +++ b/security/security/src/main/java/module-info.java @@ -33,7 +33,6 @@ requires transitive io.helidon.common; requires transitive io.helidon.common.security; requires transitive io.helidon.common.configurable; - requires transitive io.helidon.common.reactive; requires transitive io.helidon.config; requires static io.helidon.common.features.api; @@ -50,7 +49,7 @@ exports io.helidon.security.internal to io.helidon.microprofile.security, - io.helidon.security.integration.nima; + io.helidon.webserver.security; // needed for CDI integration opens io.helidon.security to weld.core.impl, io.helidon.microprofile.cdi; diff --git a/security/security/src/test/java/io/helidon/security/CompositePolicyTest.java b/security/security/src/test/java/io/helidon/security/CompositePolicyTest.java index a81a0b1168f..6d17827d415 100644 --- a/security/security/src/test/java/io/helidon/security/CompositePolicyTest.java +++ b/security/security/src/test/java/io/helidon/security/CompositePolicyTest.java @@ -18,7 +18,6 @@ import java.util.List; import java.util.Map; -import java.util.concurrent.ExecutionException; import io.helidon.security.spi.AuthenticationProvider; import io.helidon.security.spi.AuthorizationProvider; @@ -114,7 +113,7 @@ public void testAtz() { } @Test - public void testAtnAllSuccess() throws ExecutionException, InterruptedException { + public void testAtnAllSuccess() { AuthenticationResponse response = getAuthentication().authenticate(context("/jack", "service")); assertThat(response, notNullValue()); assertThat(response.status(), is(SecurityResponse.SecurityStatus.SUCCESS)); @@ -126,7 +125,7 @@ public void testAtnAllSuccess() throws ExecutionException, InterruptedException } @Test - public void testAtnAllSuccessServiceFirst() throws ExecutionException, InterruptedException { + public void testAtnAllSuccessServiceFirst() { AuthenticationResponse response = getAuthentication().authenticate(context("/service", "jack")); assertThat(response, notNullValue()); assertThat(response.status(), is(SecurityResponse.SecurityStatus.SUCCESS)); @@ -137,7 +136,7 @@ public void testAtnAllSuccessServiceFirst() throws ExecutionException, Interrupt } @Test - public void testOutboundSuccess() throws ExecutionException, InterruptedException { + public void testOutboundSuccess() { ProviderRequest context = context("/jack", "service"); assertThat(getOutbound().isOutboundSupported(context, context.env(), context.endpointConfig()), is(true)); diff --git a/security/security/src/test/java/io/helidon/security/SecurityFromConfigTest.java b/security/security/src/test/java/io/helidon/security/SecurityFromConfigTest.java index a5de0197b31..9df2159efb6 100644 --- a/security/security/src/test/java/io/helidon/security/SecurityFromConfigTest.java +++ b/security/security/src/test/java/io/helidon/security/SecurityFromConfigTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021 Oracle and/or its affiliates. + * Copyright (c) 2018, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ import java.net.URI; import java.util.Optional; -import java.util.concurrent.ExecutionException; import io.helidon.config.Config; import io.helidon.config.ConfigSources; @@ -74,7 +73,7 @@ public void testSecurityProviderAuthn() { } @Test - public void testSecurityProviderAuthz() throws ExecutionException, InterruptedException { + public void testSecurityProviderAuthz() { SecurityContext context = security.contextBuilder("unitTest").build(); SecurityEnvironment.Builder envBuilder = context.env() .derive() diff --git a/tests/apps/bookstore/bookstore-mp/pom.xml b/tests/apps/bookstore/bookstore-mp/pom.xml index b72f004a379..83ac4ea28d7 100644 --- a/tests/apps/bookstore/bookstore-mp/pom.xml +++ b/tests/apps/bookstore/bookstore-mp/pom.xml @@ -27,7 +27,7 @@ io.helidon.tests.apps.bookstore.bookstore-mp bookstore-mp - Helidon Test Applications Bookstore MP + Helidon Tests Applications Bookstore MP io.helidon.tests.apps.bookstore.mp.Main diff --git a/tests/apps/bookstore/bookstore-mp/src/main/resources/logging.properties b/tests/apps/bookstore/bookstore-mp/src/main/resources/logging.properties index 6b220c932c3..ad189cedd96 100644 --- a/tests/apps/bookstore/bookstore-mp/src/main/resources/logging.properties +++ b/tests/apps/bookstore/bookstore-mp/src/main/resources/logging.properties @@ -27,7 +27,7 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ .level=INFO # Component specific log levels -#io.helidon.nima.webserver.level=INFO +#io.helidon.webserver.level=INFO #io.helidon.config.level=INFO #io.helidon.security.level=INFO #io.helidon.microprofile.level=INFO diff --git a/tests/apps/bookstore/bookstore-nima/src/main/java/io/helidon/tests/apps/bookstore/nima/Main.java b/tests/apps/bookstore/bookstore-nima/src/main/java/io/helidon/tests/apps/bookstore/nima/Main.java deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/apps/bookstore/bookstore-se/pom.xml b/tests/apps/bookstore/bookstore-se/pom.xml index a8881e61b7d..9b17e1a75f8 100644 --- a/tests/apps/bookstore/bookstore-se/pom.xml +++ b/tests/apps/bookstore/bookstore-se/pom.xml @@ -21,13 +21,13 @@ 4.0.0 io.helidon.applications - helidon-nima + helidon-se 4.0.0-SNAPSHOT - ../../../../applications/nima/pom.xml + ../../../../applications/se/pom.xml io.helidon.tests.apps.bookstore.bookstore-se bookstore-se - Helidon Test Applications Bookstore SE + Helidon Tests Applications Bookstore SE io.helidon.tests.apps.bookstore.se.Main @@ -35,40 +35,40 @@ - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.nima.webclient - helidon-nima-webclient + io.helidon.webclient + helidon-webclient - io.helidon.nima.http2 - helidon-nima-http2-webclient + io.helidon.webclient + helidon-webclient-http2 - io.helidon.nima.http2 - helidon-nima-http2-webserver + io.helidon.webserver + helidon-webserver-http2 - io.helidon.nima.http.media - helidon-nima-http-media-jsonp + io.helidon.http.media + helidon-http-media-jsonp - io.helidon.nima.http.media - helidon-nima-http-media-jsonb + io.helidon.http.media + helidon-http-media-jsonb - io.helidon.nima.http.media - helidon-nima-http-media-jackson + io.helidon.http.media + helidon-http-media-jackson - io.helidon.nima.observe - helidon-nima-observe-health + io.helidon.webserver.observe + helidon-webserver-observe-health - io.helidon.nima.observe - helidon-nima-observe-metrics + io.helidon.webserver.observe + helidon-webserver-observe-metrics io.helidon.metrics @@ -92,9 +92,8 @@ ${project.version} - io.helidon.nima.testing.junit5 - - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test diff --git a/tests/apps/bookstore/bookstore-se/src/main/java/io/helidon/tests/apps/bookstore/se/BookService.java b/tests/apps/bookstore/bookstore-se/src/main/java/io/helidon/tests/apps/bookstore/se/BookService.java index bbfe24ee9ee..99ac66da809 100644 --- a/tests/apps/bookstore/bookstore-se/src/main/java/io/helidon/tests/apps/bookstore/se/BookService.java +++ b/tests/apps/bookstore/bookstore-se/src/main/java/io/helidon/tests/apps/bookstore/se/BookService.java @@ -18,12 +18,12 @@ import java.util.Collection; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.config.Config; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import io.helidon.tests.apps.bookstore.common.Book; import io.helidon.tests.apps.bookstore.common.BookMapper; import io.helidon.tests.apps.bookstore.common.BookStore; diff --git a/tests/apps/bookstore/bookstore-se/src/main/java/io/helidon/tests/apps/bookstore/se/Main.java b/tests/apps/bookstore/bookstore-se/src/main/java/io/helidon/tests/apps/bookstore/se/Main.java index 1b32fe6b13f..0c808e47850 100644 --- a/tests/apps/bookstore/bookstore-se/src/main/java/io/helidon/tests/apps/bookstore/se/Main.java +++ b/tests/apps/bookstore/bookstore-se/src/main/java/io/helidon/tests/apps/bookstore/se/Main.java @@ -23,16 +23,16 @@ import io.helidon.health.checks.DiskSpaceHealthCheck; import io.helidon.health.checks.HeapMemoryHealthCheck; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.common.tls.Tls; -import io.helidon.nima.http.media.jackson.JacksonSupport; -import io.helidon.nima.http.media.jsonb.JsonbSupport; -import io.helidon.nima.http.media.jsonp.JsonpSupport; -import io.helidon.nima.observe.health.HealthFeature; -import io.helidon.nima.observe.metrics.MetricsFeature; -import io.helidon.nima.webserver.Routing; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.common.tls.Tls; +import io.helidon.http.media.jackson.JacksonSupport; +import io.helidon.http.media.jsonb.JsonbSupport; +import io.helidon.http.media.jsonp.JsonpSupport; +import io.helidon.webserver.observe.health.HealthFeature; +import io.helidon.webserver.observe.metrics.MetricsFeature; +import io.helidon.webserver.Routing; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.http.HttpRouting; /** * Simple Hello World rest application. diff --git a/tests/apps/bookstore/bookstore-se/src/main/java/module-info.java b/tests/apps/bookstore/bookstore-se/src/main/java/module-info.java index 1e558fd4ac6..df543d35dd1 100644 --- a/tests/apps/bookstore/bookstore-se/src/main/java/module-info.java +++ b/tests/apps/bookstore/bookstore-se/src/main/java/module-info.java @@ -21,16 +21,16 @@ requires java.logging; requires jakarta.json; - requires io.helidon.nima.webserver; + requires io.helidon.webserver; requires io.helidon.config.yaml; requires io.helidon.config; requires io.helidon.health; requires io.helidon.health.checks; - requires io.helidon.nima.observe.metrics; - requires io.helidon.nima.observe.health; - requires io.helidon.nima.http.media.jsonp; - requires io.helidon.nima.http.media.jackson; - requires io.helidon.nima.http.media.jsonb; + requires io.helidon.webserver.observe.metrics; + requires io.helidon.webserver.observe.health; + requires io.helidon.http.media.jsonp; + requires io.helidon.http.media.jackson; + requires io.helidon.http.media.jsonb; requires io.helidon.tests.apps.bookstore.common; requires io.helidon.logging.common; requires io.helidon.logging.jul; diff --git a/tests/apps/bookstore/bookstore-se/src/main/resources/logging.properties b/tests/apps/bookstore/bookstore-se/src/main/resources/logging.properties index fa9c43465ca..8b99314cc1b 100644 --- a/tests/apps/bookstore/bookstore-se/src/main/resources/logging.properties +++ b/tests/apps/bookstore/bookstore-se/src/main/resources/logging.properties @@ -27,8 +27,7 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ .level=INFO # Component specific log levels -#io.helidon.nima.webserver.level=INFO +#io.helidon.webserver.level=INFO #io.helidon.config.level=INFO #io.helidon.security.level=INFO #io.helidon.common.level=INFO -#io.helidon.nima.level=ALL diff --git a/tests/apps/bookstore/bookstore-se/src/test/java/io/helidon/tests/apps/bookstore/se/Http2SslTest.java b/tests/apps/bookstore/bookstore-se/src/test/java/io/helidon/tests/apps/bookstore/se/Http2SslTest.java index e1be9981732..c381692d954 100644 --- a/tests/apps/bookstore/bookstore-se/src/test/java/io/helidon/tests/apps/bookstore/se/Http2SslTest.java +++ b/tests/apps/bookstore/bookstore-se/src/test/java/io/helidon/tests/apps/bookstore/se/Http2SslTest.java @@ -17,10 +17,10 @@ package io.helidon.tests.apps.bookstore.se; import io.helidon.common.configurable.ThreadPoolSupplier; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; import org.junit.jupiter.api.Test; import javax.net.ssl.SSLContext; diff --git a/tests/apps/bookstore/bookstore-se/src/test/java/io/helidon/tests/apps/bookstore/se/MainTest.java b/tests/apps/bookstore/bookstore-se/src/test/java/io/helidon/tests/apps/bookstore/se/MainTest.java index 8a8436bcd32..664c6fe0871 100644 --- a/tests/apps/bookstore/bookstore-se/src/test/java/io/helidon/tests/apps/bookstore/se/MainTest.java +++ b/tests/apps/bookstore/bookstore-se/src/test/java/io/helidon/tests/apps/bookstore/se/MainTest.java @@ -16,10 +16,10 @@ package io.helidon.tests.apps.bookstore.se; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; import jakarta.json.Json; import jakarta.json.JsonObject; import jakarta.json.JsonReader; diff --git a/tests/apps/bookstore/bookstore-se/src/test/java/io/helidon/tests/apps/bookstore/se/SslTest.java b/tests/apps/bookstore/bookstore-se/src/test/java/io/helidon/tests/apps/bookstore/se/SslTest.java index b5fccc81753..002b75633be 100644 --- a/tests/apps/bookstore/bookstore-se/src/test/java/io/helidon/tests/apps/bookstore/se/SslTest.java +++ b/tests/apps/bookstore/bookstore-se/src/test/java/io/helidon/tests/apps/bookstore/se/SslTest.java @@ -16,11 +16,11 @@ package io.helidon.tests.apps.bookstore.se; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webserver.WebServer; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; +import io.helidon.webserver.WebServerConfig; import org.junit.jupiter.api.Test; import javax.net.ssl.SSLContext; diff --git a/tests/apps/bookstore/bookstore-se/src/test/java/io/helidon/tests/apps/bookstore/se/TestServer.java b/tests/apps/bookstore/bookstore-se/src/test/java/io/helidon/tests/apps/bookstore/se/TestServer.java index 1f33945d13b..630da994ec7 100644 --- a/tests/apps/bookstore/bookstore-se/src/test/java/io/helidon/tests/apps/bookstore/se/TestServer.java +++ b/tests/apps/bookstore/bookstore-se/src/test/java/io/helidon/tests/apps/bookstore/se/TestServer.java @@ -16,8 +16,7 @@ package io.helidon.tests.apps.bookstore.se; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webserver.WebServerConfig; +import io.helidon.webserver.WebServerConfig; import javax.net.ssl.*; import java.io.BufferedReader; diff --git a/tests/apps/bookstore/common/pom.xml b/tests/apps/bookstore/common/pom.xml index 30c17032016..dbde3a81ba0 100644 --- a/tests/apps/bookstore/common/pom.xml +++ b/tests/apps/bookstore/common/pom.xml @@ -28,7 +28,7 @@ io.helidon.tests.apps.bookstore.common helidon-tests-apps-bookstore-common - Helidon Test Applications Bookstore Common + Helidon Tests Applications Bookstore Common diff --git a/tests/apps/bookstore/pom.xml b/tests/apps/bookstore/pom.xml index 42aad487fae..44eb343ce34 100644 --- a/tests/apps/bookstore/pom.xml +++ b/tests/apps/bookstore/pom.xml @@ -31,7 +31,7 @@ helidon-tests-apps-bookstore-project pom - Helidon Test Applications Bookstore Project + Helidon Tests Applications Bookstore Project common diff --git a/tests/apps/pom.xml b/tests/apps/pom.xml index c775bb28736..51537f1dded 100644 --- a/tests/apps/pom.xml +++ b/tests/apps/pom.xml @@ -31,7 +31,7 @@ helidon-tests-apps-project pom - Helidon Test Applications Project + Helidon Tests Applications Project bookstore diff --git a/tests/functional/bookstore/pom.xml b/tests/functional/bookstore/pom.xml index cd9ca154908..19b55012827 100644 --- a/tests/functional/bookstore/pom.xml +++ b/tests/functional/bookstore/pom.xml @@ -27,7 +27,7 @@ io.helidon.tests.functional.bookstore helidon-tests-functional-bookstore - Helidon Functional Test: Bookstore + Helidon Tests Functional Bookstore ${project.basedir}/../../apps/bookstore/bookstore-se/target/bookstore-se.jar @@ -65,8 +65,8 @@ test - io.helidon.nima.webclient - helidon-nima-webclient + io.helidon.webclient + helidon-webclient test diff --git a/tests/functional/bookstore/src/test/java/io/helidon/tests/bookstore/MainTest.java b/tests/functional/bookstore/src/test/java/io/helidon/tests/bookstore/MainTest.java index 3dad8ca4569..c683080f0c2 100644 --- a/tests/functional/bookstore/src/test/java/io/helidon/tests/bookstore/MainTest.java +++ b/tests/functional/bookstore/src/test/java/io/helidon/tests/bookstore/MainTest.java @@ -31,10 +31,10 @@ import java.util.Objects; import java.util.Queue; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.common.media.type.MediaTypes; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.api.WebClient; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.api.WebClient; import com.oracle.bedrock.runtime.Application; import com.oracle.bedrock.runtime.LocalPlatform; diff --git a/tests/functional/config-profiles/pom.xml b/tests/functional/config-profiles/pom.xml index 1a0a2cdce40..653cf9c6f6b 100644 --- a/tests/functional/config-profiles/pom.xml +++ b/tests/functional/config-profiles/pom.xml @@ -27,6 +27,7 @@ io.helidon.tests.functional.configprofile helidon-tests-functional-configprofile + Helidon Tests Functional Config Profile io.helidon.tests.configprofile.Main @@ -34,12 +35,12 @@ - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.nima.http.media - helidon-nima-http-media-jsonp + io.helidon.http.media + helidon-http-media-jsonp io.helidon.config @@ -50,18 +51,18 @@ helidon-config-yaml - org.junit.jupiter - junit-jupiter-api + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webclient + helidon-webclient test - io.helidon.nima.webclient - helidon-nima-webclient + org.junit.jupiter + junit-jupiter-api test diff --git a/tests/functional/config-profiles/src/main/java/io/helidon/tests/configprofile/GreetService.java b/tests/functional/config-profiles/src/main/java/io/helidon/tests/configprofile/GreetService.java index e58ca2d2645..333496ef071 100644 --- a/tests/functional/config-profiles/src/main/java/io/helidon/tests/configprofile/GreetService.java +++ b/tests/functional/config-profiles/src/main/java/io/helidon/tests/configprofile/GreetService.java @@ -20,10 +20,10 @@ import java.util.concurrent.atomic.AtomicReference; import io.helidon.config.Config; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import jakarta.json.Json; import jakarta.json.JsonBuilderFactory; diff --git a/tests/functional/config-profiles/src/main/java/io/helidon/tests/configprofile/Main.java b/tests/functional/config-profiles/src/main/java/io/helidon/tests/configprofile/Main.java index dbd212b2088..d1c3c89d2d4 100644 --- a/tests/functional/config-profiles/src/main/java/io/helidon/tests/configprofile/Main.java +++ b/tests/functional/config-profiles/src/main/java/io/helidon/tests/configprofile/Main.java @@ -18,8 +18,8 @@ import io.helidon.config.Config; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.HttpRouting; public final class Main { diff --git a/tests/functional/config-profiles/src/main/resources/logging.properties b/tests/functional/config-profiles/src/main/resources/logging.properties index e303e51fc71..66b4219a921 100644 --- a/tests/functional/config-profiles/src/main/resources/logging.properties +++ b/tests/functional/config-profiles/src/main/resources/logging.properties @@ -27,7 +27,7 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ .level=INFO # Component specific log levels -#io.helidon.nima.webserver.level=INFO +#io.helidon.webserver.level=INFO #io.helidon.config.level=INFO #io.helidon.security.level=INFO #io.helidon.common.level=INFO diff --git a/tests/functional/config-profiles/src/test/java/io/helidon/tests/configprofile/DevTest.java b/tests/functional/config-profiles/src/test/java/io/helidon/tests/configprofile/DevTest.java index bd2ffcfae4f..687ec7c3939 100644 --- a/tests/functional/config-profiles/src/test/java/io/helidon/tests/configprofile/DevTest.java +++ b/tests/functional/config-profiles/src/test/java/io/helidon/tests/configprofile/DevTest.java @@ -16,10 +16,10 @@ package io.helidon.tests.configprofile; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webserver.http.HttpRouting; import jakarta.json.JsonObject; import org.junit.jupiter.api.Test; diff --git a/tests/functional/config-profiles/src/test/java/io/helidon/tests/configprofile/ProdTest.java b/tests/functional/config-profiles/src/test/java/io/helidon/tests/configprofile/ProdTest.java index 636f5490298..3319aa78e93 100644 --- a/tests/functional/config-profiles/src/test/java/io/helidon/tests/configprofile/ProdTest.java +++ b/tests/functional/config-profiles/src/test/java/io/helidon/tests/configprofile/ProdTest.java @@ -16,10 +16,10 @@ package io.helidon.tests.configprofile; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webserver.http.HttpRouting; import jakarta.json.JsonObject; import org.junit.jupiter.api.Test; diff --git a/tests/functional/context-propagation/pom.xml b/tests/functional/context-propagation/pom.xml index 501c078ceef..4e1336c0060 100644 --- a/tests/functional/context-propagation/pom.xml +++ b/tests/functional/context-propagation/pom.xml @@ -26,7 +26,7 @@ helidon-tests-functional-context-propagation - Helidon Functional Test: Helidon Context Propagation + Helidon Tests Functional Helidon Context Propagation diff --git a/tests/functional/context-propagation/src/main/java/io/helidon/tests/functional/context/hello/HelloResource.java b/tests/functional/context-propagation/src/main/java/io/helidon/tests/functional/context/hello/HelloResource.java index ad2a2abc973..18a04b1989c 100644 --- a/tests/functional/context-propagation/src/main/java/io/helidon/tests/functional/context/hello/HelloResource.java +++ b/tests/functional/context-propagation/src/main/java/io/helidon/tests/functional/context/hello/HelloResource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022 Oracle and/or its affiliates. + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ package io.helidon.tests.functional.context.hello; -import io.helidon.nima.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerRequest; import jakarta.inject.Inject; import jakarta.ws.rs.GET; diff --git a/tests/functional/context-propagation/src/main/java/io/helidon/tests/functional/context/hello/ServerRequestSupplier.java b/tests/functional/context-propagation/src/main/java/io/helidon/tests/functional/context/hello/ServerRequestSupplier.java index 3a8b39e102b..469e4e90ca6 100644 --- a/tests/functional/context-propagation/src/main/java/io/helidon/tests/functional/context/hello/ServerRequestSupplier.java +++ b/tests/functional/context-propagation/src/main/java/io/helidon/tests/functional/context/hello/ServerRequestSupplier.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022 Oracle and/or its affiliates. + * Copyright (c) 2020, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ import java.util.function.Supplier; -import io.helidon.nima.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerRequest; import jakarta.enterprise.context.RequestScoped; import jakarta.ws.rs.core.Context; diff --git a/tests/functional/jax-rs-multiple-apps/pom.xml b/tests/functional/jax-rs-multiple-apps/pom.xml index 96fcdd33226..14dc2676eb0 100644 --- a/tests/functional/jax-rs-multiple-apps/pom.xml +++ b/tests/functional/jax-rs-multiple-apps/pom.xml @@ -26,7 +26,7 @@ helidon-tests-functional-jax-rs-multiple-apps - Helidon Functional Test: Injection Manager Sharing Multiple Apps + Helidon Tests Functional Injection Manager Sharing Multiple Apps diff --git a/tests/functional/jax-rs-subresource/pom.xml b/tests/functional/jax-rs-subresource/pom.xml index 3722416e347..4da2a6e91d8 100644 --- a/tests/functional/jax-rs-subresource/pom.xml +++ b/tests/functional/jax-rs-subresource/pom.xml @@ -25,7 +25,7 @@ 4.0.0-SNAPSHOT helidon-tests-functional-jax-rs-subresource - Helidon Functional Test: JAX-RS Subresources + Helidon Tests Functional JAX-RS Subresources diff --git a/tests/functional/mp-compression/pom.xml b/tests/functional/mp-compression/pom.xml index 98dfea5c310..1efb1a5a921 100644 --- a/tests/functional/mp-compression/pom.xml +++ b/tests/functional/mp-compression/pom.xml @@ -25,7 +25,7 @@ 4.0.0-SNAPSHOT helidon-tests-functional-mp-compression - Helidon Functional Test: HTTP compression + Helidon Tests Functional HTTP compression diff --git a/tests/functional/mp-compression/src/test/resources/logging.properties b/tests/functional/mp-compression/src/test/resources/logging.properties index a7883a7c996..caf937f32b1 100644 --- a/tests/functional/mp-compression/src/test/resources/logging.properties +++ b/tests/functional/mp-compression/src/test/resources/logging.properties @@ -25,5 +25,5 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ # Global logging level. Can be overridden by specific loggers .level=INFO -io.helidon.nima.webserver.level=FINE +io.helidon.webserver.level=FINE diff --git a/tests/functional/mp-synthetic-app/pom.xml b/tests/functional/mp-synthetic-app/pom.xml index c81d7139bd2..abd711f1c87 100644 --- a/tests/functional/mp-synthetic-app/pom.xml +++ b/tests/functional/mp-synthetic-app/pom.xml @@ -25,7 +25,7 @@ 4.0.0-SNAPSHOT helidon-tests-functional-mp-synthetic-app - Helidon Functional Test: MP Synthetic Application + Helidon Tests Functional MP Synthetic Application diff --git a/tests/functional/mp-synthetic-app/src/main/resources/logging.properties b/tests/functional/mp-synthetic-app/src/main/resources/logging.properties index e4b91491f7e..2380300a3bc 100644 --- a/tests/functional/mp-synthetic-app/src/main/resources/logging.properties +++ b/tests/functional/mp-synthetic-app/src/main/resources/logging.properties @@ -25,10 +25,10 @@ io.helidon.level=INFO io.helidon.logging.jul.HelidonConsoleHandler.level=ALL java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$s %3$s !thread!: %5$s%6$s%n AUDIT.level=FINEST -io.helidon.nima.webserver.level=WARNING -io.helidon.nima.webserver.accesslog.AccessLogHandler.level=FINEST -io.helidon.nima.webserver.accesslog.AccessLogHandler.pattern=access.log -io.helidon.nima.webserver.accesslog.AccessLogHandler.append=true -io.helidon.nima.webserver.AccessLog.level=INFO -io.helidon.nima.webserver.AccessLog.useParentHandlers=false -io.helidon.nima.webserver.AccessLog.handlers=io.helidon.nima.webserver.accesslog.AccessLogHandler +io.helidon.webserver.level=WARNING +io.helidon.webserver.accesslog.AccessLogHandler.level=FINEST +io.helidon.webserver.accesslog.AccessLogHandler.pattern=access.log +io.helidon.webserver.accesslog.AccessLogHandler.append=true +io.helidon.webserver.AccessLog.level=INFO +io.helidon.webserver.AccessLog.useParentHandlers=false +io.helidon.webserver.AccessLog.handlers=io.helidon.webserver.accesslog.AccessLogHandler diff --git a/tests/functional/multiport/pom.xml b/tests/functional/multiport/pom.xml index 1390b5db19e..1542696eb3a 100644 --- a/tests/functional/multiport/pom.xml +++ b/tests/functional/multiport/pom.xml @@ -25,7 +25,7 @@ 4.0.0-SNAPSHOT helidon-tests-functional-multiport - Helidon Functional Test: Multiport with MP + Helidon Tests Functional Multiport with MP diff --git a/tests/functional/param-converter-provider/pom.xml b/tests/functional/param-converter-provider/pom.xml index a2bc41d16d8..f6554461600 100644 --- a/tests/functional/param-converter-provider/pom.xml +++ b/tests/functional/param-converter-provider/pom.xml @@ -26,7 +26,7 @@ helidon-tests-param-converter-provider - Helidon Functional Test: ParamConverterProviders and injection managers + Helidon Tests Functional ParamConverterProviders and injection managers diff --git a/tests/functional/param-converter-provider/src/main/resources/logging.properties b/tests/functional/param-converter-provider/src/main/resources/logging.properties index 4dec77a43bc..a5a3571d4f5 100644 --- a/tests/functional/param-converter-provider/src/main/resources/logging.properties +++ b/tests/functional/param-converter-provider/src/main/resources/logging.properties @@ -27,7 +27,7 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ org.jboss.level=WARNING # Component specific log levels -#io.helidon.nima.webserver.level=INFO +#io.helidon.webserver.level=INFO #io.helidon.config.level=INFO #io.helidon.security.level=INFO #io.helidon.common.level=INFO diff --git a/tests/functional/pom.xml b/tests/functional/pom.xml index e224578e232..e0fd243498b 100644 --- a/tests/functional/pom.xml +++ b/tests/functional/pom.xml @@ -31,7 +31,7 @@ helidon-tests-functional-project pom - Helidon Functional Tests + Helidon Tests Functional bookstore diff --git a/tests/functional/request-scope-cdi/pom.xml b/tests/functional/request-scope-cdi/pom.xml index 43536e7c0bd..346531d3abd 100644 --- a/tests/functional/request-scope-cdi/pom.xml +++ b/tests/functional/request-scope-cdi/pom.xml @@ -26,7 +26,7 @@ helidon-tests-functional-request-scope-cdi - Helidon Functional Test: CDI Request Scopes and Fault Tolerance + Helidon Tests Functional CDI Request Scopes and Fault Tolerance diff --git a/tests/functional/request-scope-injection/pom.xml b/tests/functional/request-scope-injection/pom.xml index 154d98e8846..5ea95e17fda 100644 --- a/tests/functional/request-scope-injection/pom.xml +++ b/tests/functional/request-scope-injection/pom.xml @@ -26,7 +26,7 @@ helidon-tests-functional-request-scope-injection - Helidon Functional Test: Helidon Request Scope Injection + Helidon Tests Functional Helidon Request Scope Injection diff --git a/tests/functional/request-scope-injection/src/main/java/io/helidon/tests/functional/context/injection/CheckInjectionResource.java b/tests/functional/request-scope-injection/src/main/java/io/helidon/tests/functional/context/injection/CheckInjectionResource.java index d85f9d3abb5..ba34262bc95 100644 --- a/tests/functional/request-scope-injection/src/main/java/io/helidon/tests/functional/context/injection/CheckInjectionResource.java +++ b/tests/functional/request-scope-injection/src/main/java/io/helidon/tests/functional/context/injection/CheckInjectionResource.java @@ -18,8 +18,8 @@ import java.util.Objects; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import jakarta.inject.Inject; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; diff --git a/tests/functional/request-scope/pom.xml b/tests/functional/request-scope/pom.xml index 65432086d49..40cf4d4391a 100644 --- a/tests/functional/request-scope/pom.xml +++ b/tests/functional/request-scope/pom.xml @@ -26,7 +26,7 @@ helidon-tests-functional-request-scope - Helidon Functional Test: Request Scope and Fault Tolerance + Helidon Tests Functional Request Scope and Fault Tolerance diff --git a/tests/functional/request-scope/src/main/java/io/helidon/tests/functional/requestscope/TenantContext.java b/tests/functional/request-scope/src/main/java/io/helidon/tests/functional/requestscope/TenantContext.java index 012de981a1f..46e2cdf785f 100644 --- a/tests/functional/request-scope/src/main/java/io/helidon/tests/functional/requestscope/TenantContext.java +++ b/tests/functional/request-scope/src/main/java/io/helidon/tests/functional/requestscope/TenantContext.java @@ -15,8 +15,8 @@ */ package io.helidon.tests.functional.requestscope; -import io.helidon.common.http.Http; -import io.helidon.nima.webserver.http.ServerRequest; +import io.helidon.http.Http; +import io.helidon.webserver.http.ServerRequest; import jakarta.annotation.PostConstruct; import jakarta.enterprise.context.RequestScoped; diff --git a/tests/functional/request-scope/src/test/java/io/helidon/tests/functional/requestscope/TenantTest.java b/tests/functional/request-scope/src/test/java/io/helidon/tests/functional/requestscope/TenantTest.java index 7634f753f89..799b3b2b784 100644 --- a/tests/functional/request-scope/src/test/java/io/helidon/tests/functional/requestscope/TenantTest.java +++ b/tests/functional/request-scope/src/test/java/io/helidon/tests/functional/requestscope/TenantTest.java @@ -20,7 +20,7 @@ import java.util.function.Supplier; import io.helidon.microprofile.tests.junit5.HelidonTest; -import io.helidon.nima.faulttolerance.Async; +import io.helidon.faulttolerance.Async; import jakarta.inject.Inject; import jakarta.ws.rs.client.WebTarget; diff --git a/tests/integration/config/pom.xml b/tests/integration/config/pom.xml index b8541c0db95..06ee2d19ffb 100644 --- a/tests/integration/config/pom.xml +++ b/tests/integration/config/pom.xml @@ -28,7 +28,7 @@ pom helidon-tests-integration-config - Helidon Integration Tests Config + Helidon Tests Integration Config Config integration tests diff --git a/tests/integration/dbclient/app/pom.xml b/tests/integration/dbclient/app/pom.xml index c5248403ce0..49c012aec36 100644 --- a/tests/integration/dbclient/app/pom.xml +++ b/tests/integration/dbclient/app/pom.xml @@ -27,7 +27,7 @@ io.helidon.tests.integration.dbclient helidon-tests-integration-dbclient-app 4.0.0-SNAPSHOT - Integration Tests: Database Client Application + Helidon Tests Integration Database Client Application io.helidon.tests.integration.dbclient.app.Main @@ -37,16 +37,16 @@ - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.nima.observe - helidon-nima-observe-health + io.helidon.webserver.observe + helidon-webserver-observe-health - io.helidon.nima.observe - helidon-nima-observe-metrics + io.helidon.webserver.observe + helidon-webserver-observe-metrics io.helidon.config @@ -95,8 +95,8 @@ slf4j-jdk14 - io.helidon.nima.webclient - helidon-nima-webclient + io.helidon.webclient + helidon-webclient test diff --git a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/ErrorHandlerImpl.java b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/ErrorHandlerImpl.java index 321cf06248c..f62cb574ff7 100644 --- a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/ErrorHandlerImpl.java +++ b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/ErrorHandlerImpl.java @@ -15,9 +15,9 @@ */ package io.helidon.tests.integration.dbclient.app; -import io.helidon.nima.webserver.http.ErrorHandler; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.ErrorHandler; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import static io.helidon.tests.integration.harness.AppResponse.exceptionStatus; diff --git a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/InitService.java b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/InitService.java index 1848979e24e..9255caf9b96 100644 --- a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/InitService.java +++ b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/InitService.java @@ -27,10 +27,10 @@ import io.helidon.dbclient.health.DbClientHealthCheck; import io.helidon.health.HealthCheck; import io.helidon.health.HealthCheckResponse; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import io.helidon.tests.integration.dbclient.common.model.Pokemon; import io.helidon.tests.integration.dbclient.common.model.Type; diff --git a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/Main.java b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/Main.java index 1541c51a3fe..88a9e93ea5b 100644 --- a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/Main.java +++ b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/Main.java @@ -26,10 +26,10 @@ import io.helidon.dbclient.DbStatementType; import io.helidon.dbclient.health.DbClientHealthCheck; import io.helidon.dbclient.metrics.DbClientMetrics; -import io.helidon.nima.observe.ObserveFeature; -import io.helidon.nima.observe.health.HealthFeature; -import io.helidon.nima.observe.health.HealthObserveProvider; -import io.helidon.nima.webserver.WebServer; +import io.helidon.webserver.observe.ObserveFeature; +import io.helidon.webserver.observe.health.HealthFeature; +import io.helidon.webserver.observe.health.HealthObserveProvider; +import io.helidon.webserver.WebServer; import io.helidon.tests.integration.dbclient.app.tests.HealthCheckService; import io.helidon.tests.integration.dbclient.app.tests.InterceptorService; import io.helidon.tests.integration.dbclient.app.tests.MapperService; diff --git a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/VerifyService.java b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/VerifyService.java index 30c2063cf31..4972a63365f 100644 --- a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/VerifyService.java +++ b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/VerifyService.java @@ -18,10 +18,10 @@ import io.helidon.config.Config; import io.helidon.dbclient.DbClient; import io.helidon.dbclient.DbExecute; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import io.helidon.tests.integration.dbclient.app.tests.AbstractService; import io.helidon.tests.integration.dbclient.app.tools.QueryParams; diff --git a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/AbstractDeleteService.java b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/AbstractDeleteService.java index a8714831b70..c3293d7d758 100644 --- a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/AbstractDeleteService.java +++ b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/AbstractDeleteService.java @@ -18,11 +18,11 @@ import java.lang.System.Logger.Level; import java.util.Map; -import io.helidon.common.http.NotFoundException; +import io.helidon.http.NotFoundException; import io.helidon.dbclient.DbClient; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import io.helidon.tests.integration.dbclient.app.tools.QueryParams; import jakarta.json.Json; diff --git a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/AbstractGetService.java b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/AbstractGetService.java index b0d3468ba58..6e0bd7266f4 100644 --- a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/AbstractGetService.java +++ b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/AbstractGetService.java @@ -15,12 +15,12 @@ */ package io.helidon.tests.integration.dbclient.app.tests; -import io.helidon.common.http.NotFoundException; +import io.helidon.http.NotFoundException; import io.helidon.dbclient.DbClient; import io.helidon.dbclient.DbRow; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import io.helidon.tests.integration.dbclient.app.tools.QueryParams; import jakarta.json.JsonObject; diff --git a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/AbstractInsertService.java b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/AbstractInsertService.java index 787730c787a..2c1a854cb27 100644 --- a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/AbstractInsertService.java +++ b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/AbstractInsertService.java @@ -21,11 +21,11 @@ import java.util.List; import java.util.Map; -import io.helidon.common.http.NotFoundException; +import io.helidon.http.NotFoundException; import io.helidon.dbclient.DbClient; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import io.helidon.tests.integration.dbclient.common.model.Pokemon; import io.helidon.tests.integration.dbclient.common.model.Type; import io.helidon.tests.integration.dbclient.app.tools.QueryParams; diff --git a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/AbstractQueryService.java b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/AbstractQueryService.java index 2b0c0cd4d26..8b80426613a 100644 --- a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/AbstractQueryService.java +++ b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/AbstractQueryService.java @@ -19,12 +19,12 @@ import java.util.List; import java.util.Map; -import io.helidon.common.http.NotFoundException; +import io.helidon.http.NotFoundException; import io.helidon.dbclient.DbClient; import io.helidon.dbclient.DbRow; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import io.helidon.tests.integration.dbclient.app.tools.QueryParams; import jakarta.json.Json; diff --git a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/AbstractService.java b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/AbstractService.java index f8c838178ca..df36d53ad6f 100644 --- a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/AbstractService.java +++ b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/AbstractService.java @@ -18,8 +18,8 @@ import java.util.Map; import io.helidon.dbclient.DbClient; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; import io.helidon.tests.integration.harness.RemoteTestException; /** diff --git a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/AbstractUpdateService.java b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/AbstractUpdateService.java index bba874459d7..5bdef190979 100644 --- a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/AbstractUpdateService.java +++ b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/AbstractUpdateService.java @@ -18,11 +18,11 @@ import java.lang.System.Logger.Level; import java.util.Map; -import io.helidon.common.http.NotFoundException; +import io.helidon.http.NotFoundException; import io.helidon.dbclient.DbClient; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import io.helidon.tests.integration.dbclient.app.tools.QueryParams; import jakarta.json.Json; diff --git a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/FlowControlService.java b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/FlowControlService.java index 86be09acd1e..a193968ff9e 100644 --- a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/FlowControlService.java +++ b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/FlowControlService.java @@ -22,9 +22,9 @@ import io.helidon.dbclient.DbClient; import io.helidon.dbclient.DbRow; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import io.helidon.tests.integration.dbclient.common.model.Type; import io.helidon.tests.integration.harness.RemoteTestException; diff --git a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/HealthCheckService.java b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/HealthCheckService.java index e04777ea8a7..a8e08d3ca6d 100644 --- a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/HealthCheckService.java +++ b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/HealthCheckService.java @@ -23,9 +23,9 @@ import io.helidon.health.HealthCheckResponse; import io.helidon.dbclient.DbClient; import io.helidon.dbclient.health.DbClientHealthCheck; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import io.helidon.tests.integration.dbclient.app.tools.QueryParams; import io.helidon.tests.integration.harness.AppResponse; import io.helidon.tests.integration.harness.RemoteTestException; diff --git a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/InterceptorService.java b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/InterceptorService.java index 5743498f87d..68fe774d516 100644 --- a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/InterceptorService.java +++ b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/InterceptorService.java @@ -20,9 +20,9 @@ import io.helidon.dbclient.DbClient; import io.helidon.dbclient.DbClientService; import io.helidon.dbclient.DbClientServiceContext; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import io.helidon.tests.integration.dbclient.common.model.Pokemon; import io.helidon.tests.integration.harness.AppResponse; import io.helidon.tests.integration.harness.RemoteTestException; diff --git a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/MapperService.java b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/MapperService.java index e4548f103fd..f6ca23e109a 100644 --- a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/MapperService.java +++ b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/MapperService.java @@ -20,12 +20,12 @@ import java.util.function.Function; import java.util.stream.Stream; -import io.helidon.common.http.NotFoundException; +import io.helidon.http.NotFoundException; import io.helidon.dbclient.DbClient; import io.helidon.dbclient.DbRow; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import io.helidon.tests.integration.dbclient.common.model.Pokemon; import io.helidon.tests.integration.dbclient.app.tools.QueryParams; diff --git a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/StatementDmlService.java b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/StatementDmlService.java index 2edc96758ea..137bce519d5 100644 --- a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/StatementDmlService.java +++ b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/StatementDmlService.java @@ -19,11 +19,11 @@ import java.util.List; import java.util.Map; -import io.helidon.common.http.NotFoundException; +import io.helidon.http.NotFoundException; import io.helidon.dbclient.DbClient; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import io.helidon.tests.integration.dbclient.common.model.Pokemon; import io.helidon.tests.integration.dbclient.app.tools.QueryParams; diff --git a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/StatementGetService.java b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/StatementGetService.java index 067228aed97..de08450d2de 100644 --- a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/StatementGetService.java +++ b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/StatementGetService.java @@ -20,12 +20,12 @@ import java.util.Map; import java.util.Optional; -import io.helidon.common.http.NotFoundException; +import io.helidon.http.NotFoundException; import io.helidon.dbclient.DbClient; import io.helidon.dbclient.DbRow; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import io.helidon.tests.integration.dbclient.common.model.RangePoJo; import io.helidon.tests.integration.dbclient.app.tools.QueryParams; diff --git a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/StatementQueryService.java b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/StatementQueryService.java index a2dea6d12c6..a1eabc1563a 100644 --- a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/StatementQueryService.java +++ b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tests/StatementQueryService.java @@ -20,12 +20,12 @@ import java.util.Map; import java.util.stream.Stream; -import io.helidon.common.http.NotFoundException; +import io.helidon.http.NotFoundException; import io.helidon.dbclient.DbClient; import io.helidon.dbclient.DbRow; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import io.helidon.tests.integration.dbclient.common.model.RangePoJo; import io.helidon.tests.integration.dbclient.app.tools.QueryParams; diff --git a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tools/ExitService.java b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tools/ExitService.java index 9a1295ebda7..01171894c25 100644 --- a/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tools/ExitService.java +++ b/tests/integration/dbclient/app/src/main/java/io/helidon/tests/integration/dbclient/app/tools/ExitService.java @@ -16,11 +16,11 @@ package io.helidon.tests.integration.dbclient.app.tools; import io.helidon.common.media.type.MediaTypes; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; /** * Service to terminate web server. diff --git a/tests/integration/dbclient/app/src/main/resources/logging.properties b/tests/integration/dbclient/app/src/main/resources/logging.properties index e1a9d6b585e..ddc7abe5e70 100644 --- a/tests/integration/dbclient/app/src/main/resources/logging.properties +++ b/tests/integration/dbclient/app/src/main/resources/logging.properties @@ -21,5 +21,5 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ .level=WARNING io.helidon.level=INFO io.helidon.config.level=INFO -io.helidon.nima.webserver.http.level=WARNING +io.helidon.webserver.http.level=WARNING io.helidon.tests.integration.dbclient.app.level=ALL diff --git a/tests/integration/dbclient/app/src/test/java/io/helidon/tests/integration/dbclient/app/SuiteIT.java b/tests/integration/dbclient/app/src/test/java/io/helidon/tests/integration/dbclient/app/SuiteIT.java index 73809f4226f..bffd7cbd1be 100644 --- a/tests/integration/dbclient/app/src/test/java/io/helidon/tests/integration/dbclient/app/SuiteIT.java +++ b/tests/integration/dbclient/app/src/test/java/io/helidon/tests/integration/dbclient/app/SuiteIT.java @@ -21,9 +21,9 @@ import java.util.Map; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.WebServer; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.WebServer; import io.helidon.tests.integration.harness.AfterSuite; import io.helidon.tests.integration.harness.BeforeSuite; import io.helidon.tests.integration.harness.HelidonProcessRunner; diff --git a/tests/integration/dbclient/app/src/test/resources/logging.properties b/tests/integration/dbclient/app/src/test/resources/logging.properties index 055e796abf9..83280953b85 100644 --- a/tests/integration/dbclient/app/src/test/resources/logging.properties +++ b/tests/integration/dbclient/app/src/test/resources/logging.properties @@ -25,5 +25,5 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ .level=WARNING io.helidon.level=INFO io.helidon.config.level=INFO -io.helidon.nima.webserver.http.level=WARNING +io.helidon.webserver.http.level=WARNING io.helidon.tests.integration.dbclient.app.level=ALL diff --git a/tests/integration/dbclient/common/pom.xml b/tests/integration/dbclient/common/pom.xml index efee8805c0d..57df37f3cde 100644 --- a/tests/integration/dbclient/common/pom.xml +++ b/tests/integration/dbclient/common/pom.xml @@ -27,7 +27,7 @@ ../pom.xml helidon-tests-integration-dbclient-common - Integration Tests: Database Client Common + Helidon Tests Integration Database Client Common @@ -68,16 +68,16 @@ hamcrest-all - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.nima.observe - helidon-nima-observe-metrics + io.helidon.webserver.observe + helidon-webserver-observe-metrics - io.helidon.nima.observe - helidon-nima-observe-health + io.helidon.webserver.observe + helidon-webserver-observe-health io.micrometer diff --git a/tests/integration/dbclient/common/src/main/java/io/helidon/tests/integration/dbclient/common/tests/ServerHealthCheckIT.java b/tests/integration/dbclient/common/src/main/java/io/helidon/tests/integration/dbclient/common/tests/ServerHealthCheckIT.java index 44c8e1b3bfa..16e047ba36b 100644 --- a/tests/integration/dbclient/common/src/main/java/io/helidon/tests/integration/dbclient/common/tests/ServerHealthCheckIT.java +++ b/tests/integration/dbclient/common/src/main/java/io/helidon/tests/integration/dbclient/common/tests/ServerHealthCheckIT.java @@ -27,10 +27,10 @@ import io.helidon.dbclient.DbClient; import io.helidon.health.HealthCheck; import io.helidon.dbclient.health.DbClientHealthCheck; -import io.helidon.nima.observe.ObserveFeature; -import io.helidon.nima.observe.health.HealthFeature; -import io.helidon.nima.observe.health.HealthObserveProvider; -import io.helidon.nima.webserver.WebServer; +import io.helidon.webserver.observe.ObserveFeature; +import io.helidon.webserver.observe.health.HealthFeature; +import io.helidon.webserver.observe.health.HealthObserveProvider; +import io.helidon.webserver.WebServer; import io.helidon.tests.integration.harness.SetUp; import jakarta.json.Json; diff --git a/tests/integration/dbclient/common/src/main/java/io/helidon/tests/integration/dbclient/common/tests/ServerMetricsCheckIT.java b/tests/integration/dbclient/common/src/main/java/io/helidon/tests/integration/dbclient/common/tests/ServerMetricsCheckIT.java index 6c7474f93f0..8b2c10472f3 100644 --- a/tests/integration/dbclient/common/src/main/java/io/helidon/tests/integration/dbclient/common/tests/ServerMetricsCheckIT.java +++ b/tests/integration/dbclient/common/src/main/java/io/helidon/tests/integration/dbclient/common/tests/ServerMetricsCheckIT.java @@ -27,8 +27,8 @@ import io.helidon.dbclient.DbClient; import io.helidon.dbclient.DbStatementType; import io.helidon.dbclient.metrics.DbClientMetrics; -import io.helidon.nima.observe.ObserveFeature; -import io.helidon.nima.webserver.WebServer; +import io.helidon.webserver.observe.ObserveFeature; +import io.helidon.webserver.WebServer; import io.helidon.tests.integration.dbclient.common.model.Pokemon; import io.helidon.tests.integration.harness.SetUp; diff --git a/tests/integration/dbclient/h2/pom.xml b/tests/integration/dbclient/h2/pom.xml index d34f8e68b92..3406a1f194a 100644 --- a/tests/integration/dbclient/h2/pom.xml +++ b/tests/integration/dbclient/h2/pom.xml @@ -26,7 +26,7 @@ ../pom.xml helidon-tests-integration-dbclient-h2 - Integration Tests: Database Client H2 + Helidon Tests Integration Database Client H2 true diff --git a/tests/integration/dbclient/mongodb/pom.xml b/tests/integration/dbclient/mongodb/pom.xml index eb3d9a270a2..ef4a71c4596 100644 --- a/tests/integration/dbclient/mongodb/pom.xml +++ b/tests/integration/dbclient/mongodb/pom.xml @@ -26,7 +26,7 @@ ../pom.xml helidon-tests-integration-dbclient-mongodb - Integration Tests: Database Client MongoDB + Helidon Tests Integration Database Client MongoDB 27017 diff --git a/tests/integration/dbclient/pom.xml b/tests/integration/dbclient/pom.xml index 69b27486d81..52535fe4a42 100644 --- a/tests/integration/dbclient/pom.xml +++ b/tests/integration/dbclient/pom.xml @@ -29,7 +29,7 @@ io.helidon.tests.integration.dbclient helidon-tests-integration-dbclient-project pom - Integration Tests: Database Client + Helidon Tests Integration Database Client A set of tests that validate Database Client diff --git a/tests/integration/gh-5792/README.md b/tests/integration/gh-5792/README.md index 53774c7f8fc..5c31899c843 100644 --- a/tests/integration/gh-5792/README.md +++ b/tests/integration/gh-5792/README.md @@ -1,7 +1,7 @@ # helidon-tests-integration-yaml-parsing -Sample Helidon Níma project to make sure that we can build and run using an older release of SnakeYAML in case users need to fall back. +Sample Helidon WebServer project to make sure that we can build and run using an older release of SnakeYAML in case users need to fall back. Note that the static OpenAPI document packaged into the application JAR file intentionally _does not_ describe the API for this service. It contains a much richer definition to exercise YAML parsing a bit more. diff --git a/tests/integration/gh-5792/pom.xml b/tests/integration/gh-5792/pom.xml index 4a1a5b4106b..f5126343e62 100644 --- a/tests/integration/gh-5792/pom.xml +++ b/tests/integration/gh-5792/pom.xml @@ -23,15 +23,15 @@ 4.0.0 io.helidon.applications - helidon-nima + helidon-se 4.0.0-SNAPSHOT - ../../../applications/nima/pom.xml + ../../../applications/se/pom.xml io.helidon.tests.integration - helidon-tests-integration-yaml-parsing-nima + helidon-tests-integration-yaml-parsing 4.0.0-SNAPSHOT - Helidon SnakeYAML Earlier Version Test + Helidon Tests Integration GH-5792 io.helidon.tests.integration.yamlparsing.Main @@ -52,16 +52,16 @@ - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.nima.webclient - helidon-nima-webclient + io.helidon.webclient + helidon-webclient - io.helidon.nima.http.media - helidon-nima-http-media-jsonp + io.helidon.http.media + helidon-http-media-jsonp io.helidon.openapi @@ -76,8 +76,8 @@ jakarta.json-api - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test diff --git a/tests/integration/gh-5792/src/main/java/io/helidon/tests/integration/yamlparsing/GreetClientHttp.java b/tests/integration/gh-5792/src/main/java/io/helidon/tests/integration/yamlparsing/GreetClientHttp.java index 5ff69ce1c5b..7d80eee3021 100644 --- a/tests/integration/gh-5792/src/main/java/io/helidon/tests/integration/yamlparsing/GreetClientHttp.java +++ b/tests/integration/gh-5792/src/main/java/io/helidon/tests/integration/yamlparsing/GreetClientHttp.java @@ -15,8 +15,8 @@ */ package io.helidon.tests.integration.yamlparsing; -import io.helidon.common.http.Http; -import io.helidon.nima.webclient.api.WebClient; +import io.helidon.http.Http; +import io.helidon.webclient.api.WebClient; /** * Executable class that invokes HTTP/1 requests against the server. @@ -40,7 +40,7 @@ public static void main(String[] args) { System.out.println(response); - response = client.get("Nima") + response = client.get("Frank") .requestEntity(String.class); System.out.println(response); diff --git a/tests/integration/gh-5792/src/main/java/io/helidon/tests/integration/yamlparsing/GreetService.java b/tests/integration/gh-5792/src/main/java/io/helidon/tests/integration/yamlparsing/GreetService.java index c697910278f..9070e0096b7 100644 --- a/tests/integration/gh-5792/src/main/java/io/helidon/tests/integration/yamlparsing/GreetService.java +++ b/tests/integration/gh-5792/src/main/java/io/helidon/tests/integration/yamlparsing/GreetService.java @@ -18,11 +18,11 @@ import java.util.Collections; import java.util.concurrent.atomic.AtomicReference; -import io.helidon.common.http.Http; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.Http; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import jakarta.json.Json; import jakarta.json.JsonBuilderFactory; diff --git a/tests/integration/gh-5792/src/main/java/io/helidon/tests/integration/yamlparsing/Main.java b/tests/integration/gh-5792/src/main/java/io/helidon/tests/integration/yamlparsing/Main.java index d84de05b71b..69b333b18ba 100644 --- a/tests/integration/gh-5792/src/main/java/io/helidon/tests/integration/yamlparsing/Main.java +++ b/tests/integration/gh-5792/src/main/java/io/helidon/tests/integration/yamlparsing/Main.java @@ -16,8 +16,8 @@ package io.helidon.tests.integration.yamlparsing; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.HttpRouting; import io.helidon.openapi.OpenApiFeature; /** diff --git a/tests/integration/gh-5792/src/main/resources/logging.properties b/tests/integration/gh-5792/src/main/resources/logging.properties index e70b8888d96..0db74b78313 100644 --- a/tests/integration/gh-5792/src/main/resources/logging.properties +++ b/tests/integration/gh-5792/src/main/resources/logging.properties @@ -16,4 +16,4 @@ handlers=java.util.logging.ConsoleHandler java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS.%1$tL %5$s%6$s%n # Global logging level. Can be overridden by specific loggers .level=INFO -io.helidon.nima.level=INFO +io.helidon.webserver.level=INFO diff --git a/tests/integration/gh-5792/src/test/java/io/helidon/tests/integration/yamlparsing/AbstractMainTest.java b/tests/integration/gh-5792/src/test/java/io/helidon/tests/integration/yamlparsing/AbstractMainTest.java index 02b35a86357..66ffc3e2f1e 100644 --- a/tests/integration/gh-5792/src/test/java/io/helidon/tests/integration/yamlparsing/AbstractMainTest.java +++ b/tests/integration/gh-5792/src/test/java/io/helidon/tests/integration/yamlparsing/AbstractMainTest.java @@ -16,11 +16,11 @@ package io.helidon.tests.integration.yamlparsing; -import io.helidon.common.http.Http; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.http.Http; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.http.HttpRouting; import org.junit.jupiter.api.Test; import jakarta.json.JsonObject; diff --git a/tests/integration/gh-5792/src/test/java/io/helidon/tests/integration/yamlparsing/MainIT.java b/tests/integration/gh-5792/src/test/java/io/helidon/tests/integration/yamlparsing/MainIT.java index 118db47f204..8d601809b59 100644 --- a/tests/integration/gh-5792/src/test/java/io/helidon/tests/integration/yamlparsing/MainIT.java +++ b/tests/integration/gh-5792/src/test/java/io/helidon/tests/integration/yamlparsing/MainIT.java @@ -15,8 +15,8 @@ */ package io.helidon.tests.integration.yamlparsing; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.webclient.http1.Http1Client; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webclient.http1.Http1Client; import org.junit.jupiter.api.Disabled; @ServerTest diff --git a/tests/integration/gh-5792/src/test/java/io/helidon/tests/integration/yamlparsing/MainTest.java b/tests/integration/gh-5792/src/test/java/io/helidon/tests/integration/yamlparsing/MainTest.java index 0dc6d34b9da..0395ecdfae8 100644 --- a/tests/integration/gh-5792/src/test/java/io/helidon/tests/integration/yamlparsing/MainTest.java +++ b/tests/integration/gh-5792/src/test/java/io/helidon/tests/integration/yamlparsing/MainTest.java @@ -15,8 +15,8 @@ */ package io.helidon.tests.integration.yamlparsing; -import io.helidon.nima.testing.junit5.webserver.DirectClient; -import io.helidon.nima.testing.junit5.webserver.RoutingTest; +import io.helidon.webserver.testing.junit5.DirectClient; +import io.helidon.webserver.testing.junit5.RoutingTest; import org.junit.jupiter.api.Disabled; @RoutingTest diff --git a/tests/integration/harness/pom.xml b/tests/integration/harness/pom.xml index ea8080ccb3b..12156ab1958 100644 --- a/tests/integration/harness/pom.xml +++ b/tests/integration/harness/pom.xml @@ -24,16 +24,16 @@ 4.0.0 helidon-tests-integration-harness - Helidon Integration Tests Harness + Helidon Tests Integration Harness - io.helidon.nima.webclient - helidon-nima-webclient + io.helidon.webclient + helidon-webclient - io.helidon.nima.http.media - helidon-nima-http-media-jsonp + io.helidon.http.media + helidon-http-media-jsonp jakarta.json diff --git a/tests/integration/harness/src/main/java/io/helidon/tests/integration/harness/TestClient.java b/tests/integration/harness/src/main/java/io/helidon/tests/integration/harness/TestClient.java index 8e68e2bf5c3..aa96b08b3c7 100644 --- a/tests/integration/harness/src/main/java/io/helidon/tests/integration/harness/TestClient.java +++ b/tests/integration/harness/src/main/java/io/helidon/tests/integration/harness/TestClient.java @@ -27,9 +27,9 @@ import java.util.Objects; import io.helidon.common.media.type.MediaTypes; -import io.helidon.nima.http.media.jsonp.JsonpSupport; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientRequest; +import io.helidon.http.media.jsonp.JsonpSupport; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientRequest; import jakarta.json.Json; import jakarta.json.JsonArray; diff --git a/tests/integration/harness/src/main/java/io/helidon/tests/integration/harness/TestServiceClient.java b/tests/integration/harness/src/main/java/io/helidon/tests/integration/harness/TestServiceClient.java index 728740f9d89..c81d0d3358c 100644 --- a/tests/integration/harness/src/main/java/io/helidon/tests/integration/harness/TestServiceClient.java +++ b/tests/integration/harness/src/main/java/io/helidon/tests/integration/harness/TestServiceClient.java @@ -17,8 +17,8 @@ import java.util.Map; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientRequest; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientRequest; import jakarta.json.JsonValue; diff --git a/tests/integration/health/mp-disabled/pom.xml b/tests/integration/health/mp-disabled/pom.xml index e9ea3fbbd6c..32957c1cbeb 100644 --- a/tests/integration/health/mp-disabled/pom.xml +++ b/tests/integration/health/mp-disabled/pom.xml @@ -27,7 +27,7 @@ io.helidon.tests.integration.health helidon-tests-integration-health-disabled - Helidon Integration Test Health Disabled + Helidon Tests Integration Health Disabled diff --git a/tests/integration/jep290/server_and_custom/pom.xml b/tests/integration/jep290/server_and_custom/pom.xml index 45326e6fe60..81fff329149 100644 --- a/tests/integration/jep290/server_and_custom/pom.xml +++ b/tests/integration/jep290/server_and_custom/pom.xml @@ -19,7 +19,6 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - io.helidon.tests.integration.jep290 helidon-tests-integration-jep290-project @@ -39,12 +38,12 @@ helidon-common - io.helidon.nima.webserver - helidon-nima-webserver + io.helidon.webserver + helidon-webserver - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test diff --git a/tests/integration/jep290/server_and_custom/src/test/java/io/helidon/tests/integration/jep290/serverandcustom/CustomConfigTest.java b/tests/integration/jep290/server_and_custom/src/test/java/io/helidon/tests/integration/jep290/serverandcustom/CustomConfigTest.java index f654ce3bbbe..084d1d536f8 100644 --- a/tests/integration/jep290/server_and_custom/src/test/java/io/helidon/tests/integration/jep290/serverandcustom/CustomConfigTest.java +++ b/tests/integration/jep290/server_and_custom/src/test/java/io/helidon/tests/integration/jep290/serverandcustom/CustomConfigTest.java @@ -25,9 +25,9 @@ import java.util.Random; import io.helidon.common.SerializationConfig; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webserver.WebServerConfig; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webserver.WebServerConfig; import org.hamcrest.CoreMatchers; import org.junit.jupiter.api.Test; diff --git a/tests/integration/jersey-connector/pom.xml b/tests/integration/jersey-connector/pom.xml deleted file mode 100644 index 9c21d3d8c1c..00000000000 --- a/tests/integration/jersey-connector/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - 4.0.0 - - io.helidon.tests.integration - helidon-tests-integration - 4.0.0-SNAPSHOT - - - helidon-nima-tests-integration-jersey-connector - Helidon Níma Tests Integration Jersey Connector - - - - org.glassfish.jersey.core - jersey-client - test - - - io.helidon.jersey - helidon-jersey-connector - test - - - io.helidon.nima.webserver - helidon-nima-webserver - test - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - io.helidon.common.testing - helidon-common-testing-http-junit5 - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - diff --git a/tests/integration/jersey-connector/src/test/resources/logging-test.properties b/tests/integration/jersey-connector/src/test/resources/logging-test.properties deleted file mode 100644 index 275831c1cdc..00000000000 --- a/tests/integration/jersey-connector/src/test/resources/logging-test.properties +++ /dev/null @@ -1,25 +0,0 @@ -# -# Copyright (c) 2023 Oracle and/or its affiliates. -# -# 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. -# -handlers=java.util.logging.ConsoleHandler -java.util.logging.ConsoleHandler.level=INFO -java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter -java.util.logging.SimpleFormatter.format=%1$tH:%1$tM:%1$tS %4$s %3$s %5$s%6$s%n -# Global logging level. Can be overridden by specific loggers -.level=INFO -io.helidon.nima.level=INFO -io.helidon.nima.webclient.http1.ClientRequestImpl.level=INFO -io.helidon.nima.webclient.http1.Http1ClientConnection.level=INFO -io.helidon.common.testing.http.junit5.level=INFO diff --git a/tests/integration/jms/pom.xml b/tests/integration/jms/pom.xml index c3260d0825c..1ab9f05e63c 100644 --- a/tests/integration/jms/pom.xml +++ b/tests/integration/jms/pom.xml @@ -27,7 +27,7 @@ io.helidon.tests.integration.jms helidon-tests-integration-jms - Helidon Tests Integrations JMS + Helidon Tests Integration JMS diff --git a/tests/integration/jpa/appl/pom.xml b/tests/integration/jpa/appl/pom.xml index 89aa18e0ae8..41110515a97 100644 --- a/tests/integration/jpa/appl/pom.xml +++ b/tests/integration/jpa/appl/pom.xml @@ -29,7 +29,7 @@ io.helidon.tests.integration.jpa helidon-tests-integration-jpa-appl - Integration Tests: JPA MP Application + Helidon Tests Integration JPA MP Application io.helidon.microprofile.cdi.Main @@ -316,7 +316,7 @@ - + diff --git a/tests/integration/jpa/appl/src/main/resources/logging.properties b/tests/integration/jpa/appl/src/main/resources/logging.properties index 60e548c3790..2d270fc6875 100644 --- a/tests/integration/jpa/appl/src/main/resources/logging.properties +++ b/tests/integration/jpa/appl/src/main/resources/logging.properties @@ -25,4 +25,4 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ .level=WARNING io.helidon.level=INFO io.helidon.config.level=INFO -io.helidon.nima.webserver.level=WARNING +io.helidon.webserver.level=WARNING diff --git a/tests/integration/jpa/appl/src/test/resources/logging.properties b/tests/integration/jpa/appl/src/test/resources/logging.properties index b2f7f344304..4e59ca90ef4 100644 --- a/tests/integration/jpa/appl/src/test/resources/logging.properties +++ b/tests/integration/jpa/appl/src/test/resources/logging.properties @@ -28,5 +28,5 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ io.helidon.level=INFO io.helidon.config.level=INFO -io.helidon.nima.webserver.level=WARNING +io.helidon.webserver.level=WARNING io.helidon.tests.integration.jpa.appl.test.level=INFO diff --git a/tests/integration/jpa/model/pom.xml b/tests/integration/jpa/model/pom.xml index 9e875fb3b04..354d0423be3 100644 --- a/tests/integration/jpa/model/pom.xml +++ b/tests/integration/jpa/model/pom.xml @@ -29,7 +29,7 @@ io.helidon.tests.integration.jpa helidon-tests-integration-jpa-model - Integration Tests: JPA Model + Helidon Tests Integration JPA Model diff --git a/tests/integration/jpa/pom.xml b/tests/integration/jpa/pom.xml index 0db932d3579..e74094970e5 100644 --- a/tests/integration/jpa/pom.xml +++ b/tests/integration/jpa/pom.xml @@ -31,7 +31,7 @@ io.helidon.tests.integration.jpa helidon-tests-integration-jpa-project - Integration Tests: JPA + Helidon Tests Integration JPA A set of tests that validate JPA API implementation diff --git a/tests/integration/jpa/simple/pom.xml b/tests/integration/jpa/simple/pom.xml index 6bb973af537..f48049da101 100644 --- a/tests/integration/jpa/simple/pom.xml +++ b/tests/integration/jpa/simple/pom.xml @@ -28,7 +28,7 @@ helidon-tests-integration-jpa-simple - Integration Tests: JPA Simple Tests + Helidon Tests Integration JPA Simple Tests diff --git a/tests/integration/kafka/pom.xml b/tests/integration/kafka/pom.xml index 24bf0c35ad6..1fe3055bf51 100644 --- a/tests/integration/kafka/pom.xml +++ b/tests/integration/kafka/pom.xml @@ -27,7 +27,7 @@ io.helidon.tests.integration.kafka helidon-tests-integration-kafka - Helidon Tests Integrations Kafka + Helidon Tests Integration Kafka diff --git a/tests/integration/mp-bean-validation/pom.xml b/tests/integration/mp-bean-validation/pom.xml index d53dab09f61..fd478413a3e 100644 --- a/tests/integration/mp-bean-validation/pom.xml +++ b/tests/integration/mp-bean-validation/pom.xml @@ -29,7 +29,7 @@ io.helidon.tests.integration io-helidon-tests-integration-bean-validation - Helidon Bean Validation Integration Tests + Helidon Tests Integration Bean Validation diff --git a/tests/integration/mp-gh-3246/src/test/java/io/helidon/tests/integration/gh3246/Gh3246Test.java b/tests/integration/mp-gh-3246/src/test/java/io/helidon/tests/integration/gh3246/Gh3246Test.java index e3756362e70..e58ac1d6b95 100644 --- a/tests/integration/mp-gh-3246/src/test/java/io/helidon/tests/integration/gh3246/Gh3246Test.java +++ b/tests/integration/mp-gh-3246/src/test/java/io/helidon/tests/integration/gh3246/Gh3246Test.java @@ -19,7 +19,7 @@ import java.time.Instant; import io.helidon.common.configurable.Resource; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.microprofile.tests.junit5.AddBean; import io.helidon.microprofile.tests.junit5.HelidonTest; import io.helidon.security.jwt.Jwt; diff --git a/tests/integration/mp-gh-5328/pom.xml b/tests/integration/mp-gh-5328/pom.xml index d903e709f8c..17adc1cbd68 100644 --- a/tests/integration/mp-gh-5328/pom.xml +++ b/tests/integration/mp-gh-5328/pom.xml @@ -44,12 +44,17 @@ helidon-tracing-providers-jaeger - io.helidon.nima.webclient - helidon-nima-webclient + io.helidon.webclient + helidon-webclient - io.helidon.nima.webclient - helidon-nima-webclient-tracing + io.helidon.webclient + helidon-webclient-tracing + + + io.helidon.microprofile.tests + helidon-microprofile-tests-junit5 + test org.junit.jupiter @@ -66,10 +71,5 @@ hamcrest-all test - - io.helidon.microprofile.tests - helidon-microprofile-tests-junit5 - test - \ No newline at end of file diff --git a/tests/integration/mp-gh-5328/src/main/java/io/helidon/tests/integration/gh5328/OffendingExtension.java b/tests/integration/mp-gh-5328/src/main/java/io/helidon/tests/integration/gh5328/OffendingExtension.java index 28bef1a4674..203992febdb 100644 --- a/tests/integration/mp-gh-5328/src/main/java/io/helidon/tests/integration/gh5328/OffendingExtension.java +++ b/tests/integration/mp-gh-5328/src/main/java/io/helidon/tests/integration/gh5328/OffendingExtension.java @@ -20,9 +20,9 @@ import io.helidon.config.Config; import io.helidon.microprofile.cdi.RuntimeStart; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.tracing.WebClientTracing; -import io.helidon.nima.webserver.WebServer; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.tracing.WebClientTracing; +import io.helidon.webserver.WebServer; import jakarta.annotation.Priority; import jakarta.enterprise.event.Observes; diff --git a/tests/integration/mp-graphql/pom.xml b/tests/integration/mp-graphql/pom.xml index 2dae07d6804..8e282637e11 100644 --- a/tests/integration/mp-graphql/pom.xml +++ b/tests/integration/mp-graphql/pom.xml @@ -26,7 +26,7 @@ helidon-tests-integration-mp-graphql - Helidon Integration Test MP GraphQL + Helidon Tests Integration MP GraphQL diff --git a/tests/integration/mp-security-client/pom.xml b/tests/integration/mp-security-client/pom.xml index aadd12be8b3..03467a3e4c1 100644 --- a/tests/integration/mp-security-client/pom.xml +++ b/tests/integration/mp-security-client/pom.xml @@ -27,7 +27,7 @@ io.helidon.tests.integration helidon-tests-integration-mp-security-client - Helidon Integration Test MP Security with client + Helidon Tests Integration MP Security with client diff --git a/tests/integration/mp-security-client/src/test/java/io/helidon/tests/integration/mp/security/client/MpSecurityClientTest.java b/tests/integration/mp-security-client/src/test/java/io/helidon/tests/integration/mp/security/client/MpSecurityClientTest.java index a3687424dd9..9fbbbedd3bd 100644 --- a/tests/integration/mp-security-client/src/test/java/io/helidon/tests/integration/mp/security/client/MpSecurityClientTest.java +++ b/tests/integration/mp-security-client/src/test/java/io/helidon/tests/integration/mp/security/client/MpSecurityClientTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021 Oracle and/or its affiliates. + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ import java.nio.charset.StandardCharsets; import java.util.Base64; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.microprofile.server.Server; import jakarta.json.Json; diff --git a/tests/integration/mp-ws-services/pom.xml b/tests/integration/mp-ws-services/pom.xml index a59389b2500..e7262c6db1d 100644 --- a/tests/integration/mp-ws-services/pom.xml +++ b/tests/integration/mp-ws-services/pom.xml @@ -27,7 +27,7 @@ io.helidon.tests.integration helidon-tests-integration-mp-ws-services - Helidon Integration Test MP WebServer services + Helidon Tests Integration MP WebServer services diff --git a/tests/integration/mp-ws-services/src/main/java/io/helidon/tests/integration/mp/ws/services/AdminService.java b/tests/integration/mp-ws-services/src/main/java/io/helidon/tests/integration/mp/ws/services/AdminService.java index a1b72bb17fb..4d81e571462 100644 --- a/tests/integration/mp-ws-services/src/main/java/io/helidon/tests/integration/mp/ws/services/AdminService.java +++ b/tests/integration/mp-ws-services/src/main/java/io/helidon/tests/integration/mp/ws/services/AdminService.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022 Oracle and/or its affiliates. + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,8 +17,8 @@ import io.helidon.microprofile.server.RoutingName; import io.helidon.microprofile.server.RoutingPath; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; import jakarta.annotation.Priority; import jakarta.enterprise.context.ApplicationScoped; diff --git a/tests/integration/mp-ws-services/src/main/java/io/helidon/tests/integration/mp/ws/services/Service1.java b/tests/integration/mp-ws-services/src/main/java/io/helidon/tests/integration/mp/ws/services/Service1.java index 468df629845..a97f5df2223 100644 --- a/tests/integration/mp-ws-services/src/main/java/io/helidon/tests/integration/mp/ws/services/Service1.java +++ b/tests/integration/mp-ws-services/src/main/java/io/helidon/tests/integration/mp/ws/services/Service1.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022 Oracle and/or its affiliates. + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,8 +17,8 @@ import io.helidon.microprofile.server.RoutingName; import io.helidon.microprofile.server.RoutingPath; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; import jakarta.annotation.Priority; import jakarta.enterprise.context.ApplicationScoped; diff --git a/tests/integration/mp-ws-services/src/main/java/io/helidon/tests/integration/mp/ws/services/Service2.java b/tests/integration/mp-ws-services/src/main/java/io/helidon/tests/integration/mp/ws/services/Service2.java index 70c689abd29..fe7fd62edca 100644 --- a/tests/integration/mp-ws-services/src/main/java/io/helidon/tests/integration/mp/ws/services/Service2.java +++ b/tests/integration/mp-ws-services/src/main/java/io/helidon/tests/integration/mp/ws/services/Service2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022 Oracle and/or its affiliates. + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,8 @@ package io.helidon.tests.integration.mp.ws.services; import io.helidon.microprofile.server.RoutingPath; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; import jakarta.annotation.Priority; import jakarta.enterprise.context.ApplicationScoped; diff --git a/tests/integration/mp-ws-services/src/main/java/io/helidon/tests/integration/mp/ws/services/Service3.java b/tests/integration/mp-ws-services/src/main/java/io/helidon/tests/integration/mp/ws/services/Service3.java index 56654256f73..6a226110e85 100644 --- a/tests/integration/mp-ws-services/src/main/java/io/helidon/tests/integration/mp/ws/services/Service3.java +++ b/tests/integration/mp-ws-services/src/main/java/io/helidon/tests/integration/mp/ws/services/Service3.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022 Oracle and/or its affiliates. + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,8 @@ package io.helidon.tests.integration.mp.ws.services; import io.helidon.microprofile.server.RoutingPath; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; import jakarta.annotation.Priority; import jakarta.enterprise.context.ApplicationScoped; diff --git a/tests/integration/mp-ws-services/src/test/java/io/helidon/tests/integration/mp/ws/services/MpServicesTest.java b/tests/integration/mp-ws-services/src/test/java/io/helidon/tests/integration/mp/ws/services/MpServicesTest.java index dd531dc7951..3889f866fbb 100644 --- a/tests/integration/mp-ws-services/src/test/java/io/helidon/tests/integration/mp/ws/services/MpServicesTest.java +++ b/tests/integration/mp-ws-services/src/test/java/io/helidon/tests/integration/mp/ws/services/MpServicesTest.java @@ -23,7 +23,7 @@ import java.net.URL; import java.nio.charset.StandardCharsets; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.microprofile.server.Server; import org.junit.jupiter.api.AfterAll; diff --git a/tests/integration/native-image/mp-1/logging.properties b/tests/integration/native-image/mp-1/logging.properties index 7fbe86fdd4a..bf0c057c7fe 100644 --- a/tests/integration/native-image/mp-1/logging.properties +++ b/tests/integration/native-image/mp-1/logging.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2018, 2022 Oracle and/or its affiliates. +# Copyright (c) 2018, 2023 Oracle and/or its affiliates. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -35,10 +35,10 @@ io.helidon.logging.jul.HelidonConsoleHandler.level=ALL java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$s %3$s !thread!: %5$s%6$s%n AUDIT.level=FINEST -io.helidon.nima.webserver.accesslog.AccessLogHandler.level=FINEST -io.helidon.nima.webserver.accesslog.AccessLogHandler.pattern=access.log -io.helidon.nima.webserver.accesslog.AccessLogHandler.append=true +io.helidon.webserver.accesslog.AccessLogHandler.level=FINEST +io.helidon.webserver.accesslog.AccessLogHandler.pattern=access.log +io.helidon.webserver.accesslog.AccessLogHandler.append=true -io.helidon.nima.webserver.AccessLog.level=INFO -io.helidon.nima.webserver.AccessLog.useParentHandlers=false -io.helidon.nima.webserver.AccessLog.handlers=io.helidon.nima.webserver.accesslog.AccessLogHandler +io.helidon.webserver.AccessLog.level=INFO +io.helidon.webserver.AccessLog.useParentHandlers=false +io.helidon.webserver.AccessLog.handlers=io.helidon.webserver.accesslog.AccessLogHandler diff --git a/tests/integration/native-image/mp-1/pom.xml b/tests/integration/native-image/mp-1/pom.xml index 81b4c8e1d2c..e10dc91d914 100644 --- a/tests/integration/native-image/mp-1/pom.xml +++ b/tests/integration/native-image/mp-1/pom.xml @@ -27,7 +27,7 @@ io.helidon.tests.integration helidon-tests-native-image-mp-1 - Helidon Integration Tests GraalVM Native image MP1 + Helidon Tests Integration GraalVM Native image MP1 This test makes sure the following helidon modules can be compiled into native image: diff --git a/tests/integration/native-image/mp-1/src/main/java/io/helidon/tests/integration/nativeimage/mp1/Mp1Main.java b/tests/integration/native-image/mp-1/src/main/java/io/helidon/tests/integration/nativeimage/mp1/Mp1Main.java index d4e6541c9fd..bbed65685ac 100644 --- a/tests/integration/native-image/mp-1/src/main/java/io/helidon/tests/integration/nativeimage/mp1/Mp1Main.java +++ b/tests/integration/native-image/mp-1/src/main/java/io/helidon/tests/integration/nativeimage/mp1/Mp1Main.java @@ -55,9 +55,9 @@ import jakarta.ws.rs.core.Response; import org.eclipse.microprofile.faulttolerance.exceptions.TimeoutException; -import static io.helidon.common.http.Http.Status.FORBIDDEN_403; -import static io.helidon.common.http.Http.Status.OK_200; -import static io.helidon.common.http.Http.Status.UNAUTHORIZED_401; +import static io.helidon.http.Http.Status.FORBIDDEN_403; +import static io.helidon.http.Http.Status.OK_200; +import static io.helidon.http.Http.Status.UNAUTHORIZED_401; /** * Main class of this integration test. @@ -233,7 +233,7 @@ private static void testBean(int port, String jwtToken) { validateMetrics(collector, target); // Access Log - vaidateAccessLog(collector); + validateAccessLog(collector); // Tracing validateTracing(collector); @@ -575,7 +575,7 @@ private static void validateMetrics(Errors.Collector collector, WebTarget target } } - private static void vaidateAccessLog(Errors.Collector collector) { + private static void validateAccessLog(Errors.Collector collector) { Path path = Paths.get("access.log"); // 1. File access.log must be present on filesystem (in current dir) if (Files.exists(path)) { diff --git a/tests/integration/native-image/mp-1/src/main/resources/logging.properties b/tests/integration/native-image/mp-1/src/main/resources/logging.properties index 85e33bb0464..9c31df101c2 100644 --- a/tests/integration/native-image/mp-1/src/main/resources/logging.properties +++ b/tests/integration/native-image/mp-1/src/main/resources/logging.properties @@ -28,6 +28,6 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ io.helidon.level=FINER io.helidon.config.level=FINEST -io.helidon.nima.webserver.level=WARNING +io.helidon.webserver.level=WARNING diff --git a/tests/integration/native-image/mp-2/pom.xml b/tests/integration/native-image/mp-2/pom.xml index a2ad1dc569d..67f627a35f5 100644 --- a/tests/integration/native-image/mp-2/pom.xml +++ b/tests/integration/native-image/mp-2/pom.xml @@ -27,7 +27,7 @@ io.helidon.tests.integration helidon-tests-native-image-mp-2 - Helidon Integration Tests GraalVM Native image MP2 + Helidon Tests Integration GraalVM Native image MP2 This test makes sure the following helidon modules can be compiled into native image: - JPA in MicroProfile app - JTA in diff --git a/tests/integration/native-image/mp-2/src/main/java/io/helidon/tests/integration/nativeimage/mp2/Mp2Main.java b/tests/integration/native-image/mp-2/src/main/java/io/helidon/tests/integration/nativeimage/mp2/Mp2Main.java index e1858c439ad..36342329b3f 100644 --- a/tests/integration/native-image/mp-2/src/main/java/io/helidon/tests/integration/nativeimage/mp2/Mp2Main.java +++ b/tests/integration/native-image/mp-2/src/main/java/io/helidon/tests/integration/nativeimage/mp2/Mp2Main.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021 Oracle and/or its affiliates. + * Copyright (c) 2020, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ import io.helidon.common.Errors; import io.helidon.microprofile.cdi.Main; -import static io.helidon.common.http.Http.Status.OK_200; +import static io.helidon.http.Http.Status.OK_200; /** * Main class of this integration test. diff --git a/tests/integration/native-image/mp-2/src/main/resources/logging.properties b/tests/integration/native-image/mp-2/src/main/resources/logging.properties index 58deb6851bd..6a91a5713fd 100644 --- a/tests/integration/native-image/mp-2/src/main/resources/logging.properties +++ b/tests/integration/native-image/mp-2/src/main/resources/logging.properties @@ -24,6 +24,6 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ .level=WARNING io.helidon.level=INFO io.helidon.config.level=INFO -io.helidon.nima.webserver.level=WARNING +io.helidon.webserver.level=WARNING diff --git a/tests/integration/native-image/mp-3/pom.xml b/tests/integration/native-image/mp-3/pom.xml index 97010f74bca..7bce153384a 100644 --- a/tests/integration/native-image/mp-3/pom.xml +++ b/tests/integration/native-image/mp-3/pom.xml @@ -27,7 +27,7 @@ io.helidon.tests.integration helidon-tests-native-image-mp-3 - Helidon Integration Tests GraalVM Native image MP3 + Helidon Tests Integration GraalVM Native image MP3 This test uses quickstart application with minimal number of changes diff --git a/tests/integration/native-image/mp-3/src/main/java/io/helidon/tests/integration/nativeimage/mp3/NimaService.java b/tests/integration/native-image/mp-3/src/main/java/io/helidon/tests/integration/nativeimage/mp3/NimaService.java deleted file mode 100644 index 7e2113d4fa7..00000000000 --- a/tests/integration/native-image/mp-3/src/main/java/io/helidon/tests/integration/nativeimage/mp3/NimaService.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2019, 2022 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.helidon.tests.integration.nativeimage.mp3; - -import io.helidon.microprofile.server.RoutingPath; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.security.Security; - -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; - -/** - * Reactive webserver service. - * Supports only injection of {@link jakarta.enterprise.context.ApplicationScoped} beans. - */ -@ApplicationScoped -@RoutingPath("/reactive") -public class NimaService implements HttpService { - private Security security; - @Inject - public NimaService(Security security) { - this.security = security; - } - - @Override - public void routing(HttpRules rules) { - rules.get("/", (req, res) -> res.send("Security: " + security)); - } -} diff --git a/tests/integration/native-image/mp-3/src/main/java/io/helidon/tests/integration/nativeimage/mp3/RoutingService.java b/tests/integration/native-image/mp-3/src/main/java/io/helidon/tests/integration/nativeimage/mp3/RoutingService.java new file mode 100644 index 00000000000..1aaaf910b79 --- /dev/null +++ b/tests/integration/native-image/mp-3/src/main/java/io/helidon/tests/integration/nativeimage/mp3/RoutingService.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.helidon.tests.integration.nativeimage.mp3; + +import io.helidon.microprofile.server.RoutingPath; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.security.Security; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; + +/** + * Webserver service. + * Supports only injection of {@link jakarta.enterprise.context.ApplicationScoped} beans. + */ +@ApplicationScoped +@RoutingPath("/routing") +public class RoutingService implements HttpService { + private Security security; + @Inject + public RoutingService(Security security) { + this.security = security; + } + + @Override + public void routing(HttpRules rules) { + rules.get("/", (req, res) -> res.send("Security: " + security)); + } +} diff --git a/tests/integration/native-image/mp-3/src/main/resources/logging.properties b/tests/integration/native-image/mp-3/src/main/resources/logging.properties index 092d0f07df9..36bfa818266 100644 --- a/tests/integration/native-image/mp-3/src/main/resources/logging.properties +++ b/tests/integration/native-image/mp-3/src/main/resources/logging.properties @@ -27,7 +27,7 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ .level=INFO # Component specific log levels -#io.helidon.nima.webserver.level=INFO +#io.helidon.webserver.level=INFO #io.helidon.config.level=INFO #io.helidon.security.level=INFO #io.helidon.microprofile.level=INFO diff --git a/tests/integration/native-image/nima-1/conf/nima.yaml b/tests/integration/native-image/nima-1/conf/nima.yaml deleted file mode 100644 index 4deae0ae1d9..00000000000 --- a/tests/integration/native-image/nima-1/conf/nima.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright (c) 2022 Oracle and/or its affiliates. -# -# 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. -# - -app: - greeting: "Nima Hallo" - diff --git a/tests/integration/native-image/nima-1/pom.xml b/tests/integration/native-image/nima-1/pom.xml deleted file mode 100644 index 5fa66ad8d01..00000000000 --- a/tests/integration/native-image/nima-1/pom.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - - - 4.0.0 - - io.helidon.applications - helidon-se - 4.0.0-SNAPSHOT - ../../../../applications/se/pom.xml - - io.helidon.tests.integration - helidon-tests-native-image-nima-1 - Helidon Integration Tests GraalVM Native image NIMA 1 - - - io.helidon.tests.integration.nativeimage.nima1.Nima1Main - - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.webserver - helidon-nima-webserver-static-content - - - io.helidon.nima.websocket - helidon-nima-websocket-webserver - - - io.helidon.nima.http.media - helidon-nima-http-media-jsonp - - - io.helidon.nima.http.media - helidon-nima-http-media-jsonb - - - io.helidon.config - helidon-config-yaml - - - io.helidon.tracing - helidon-tracing - - - io.helidon.tracing.providers - helidon-tracing-providers-zipkin - - - io.helidon.nima.observe - helidon-nima-observe-health - - - io.helidon.nima.webclient - helidon-nima-webclient - - - io.helidon.common - helidon-common-reactive - - - io.helidon.logging - helidon-logging-common - - - io.helidon.tests.integration - helidon-tests-native-image-static-content - ${project.version} - - - io.helidon.logging - helidon-logging-jul - runtime - - - org.junit.jupiter - junit-jupiter-api - test - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-libs - - - - - - diff --git a/tests/integration/native-image/nima-1/src/main/java/io/helidon/tests/integration/nativeimage/nima1/GreetService.java b/tests/integration/native-image/nima-1/src/main/java/io/helidon/tests/integration/nativeimage/nima1/GreetService.java deleted file mode 100644 index 22ee5268a40..00000000000 --- a/tests/integration/native-image/nima-1/src/main/java/io/helidon/tests/integration/nativeimage/nima1/GreetService.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2022 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.tests.integration.nativeimage.nima1; - -import java.util.Collections; -import java.util.concurrent.atomic.AtomicReference; -import java.util.function.Consumer; - -import io.helidon.common.http.Http; -import io.helidon.config.Config; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; - -import jakarta.json.Json; -import jakarta.json.JsonBuilderFactory; -import jakarta.json.JsonObject; - -/** - * A simple service to greet you. Examples: - * - * Get default greeting message: - * curl -X GET http://localhost:8080/greet - * - * Get greeting message for Joe: - * curl -X GET http://localhost:8080/greet/Joe - * - * Change greeting - * curl -X PUT -H "Content-Type: application/json" -d '{"greeting" : "Howdy"}' http://localhost:8080/greet/greeting - * - * The message is returned as a JSON object - */ - -class GreetService implements HttpService { - - private static final JsonBuilderFactory JSON = Json.createBuilderFactory(Collections.emptyMap()); - /** - * The config value for the key {@code greeting}. - */ - private final AtomicReference greeting = new AtomicReference<>(); - - GreetService(Config config) { - Config greetingConfig = config.get("app.greeting"); - - // initial value - greeting.set(greetingConfig.asString().orElse("Ciao")); - - greetingConfig.onChange((Consumer) cfg -> greeting.set(cfg.asString().orElse("Ciao"))); - } - - @Override - public void routing(HttpRules rules) { - rules - .get("/", this::getDefaultMessageHandler) - // Outbound is commented out, as we want native image to work - //.get("/outbound", this::outbound) - .get("/{name}", this::getMessageHandler) - .put("/greeting", this::updateGreetingHandler); - - } - - /** - * Return a worldly greeting message. - * - * @param request the server request - * @param response the server response - */ - private void getDefaultMessageHandler(ServerRequest request, - ServerResponse response) { - sendResponse(response, "World"); - } - - /** - * Return a greeting message using the name that was provided. - * - * @param request the server request - * @param response the server response - */ - private void getMessageHandler(ServerRequest request, - ServerResponse response) { - String name = request.path().pathParameters().value("name"); - - sendResponse(response, name); - } - - private void sendResponse(ServerResponse response, String name) { - String msg = String.format("%s %s!", greeting.get(), name); - - JsonObject returnObject = JSON.createObjectBuilder() - .add("message", msg) - .build(); - response.send(returnObject); - } - - /** - * Set the greeting to use in future messages. - * - * @param request the server request - * @param response the server response - */ - private void updateGreetingHandler(ServerRequest request, - ServerResponse response) { - JsonObject jo = request.content().as(JsonObject.class); - if (!jo.containsKey("greeting")) { - JsonObject jsonErrorObject = JSON.createObjectBuilder() - .add("error", "No greeting provided") - .build(); - response.status(Http.Status.BAD_REQUEST_400) - .send(jsonErrorObject); - return; - } - - greeting.set(jo.getString("greeting")); - response.status(Http.Status.NO_CONTENT_204).send(); - } - -} diff --git a/tests/integration/native-image/nima-1/src/main/java/io/helidon/tests/integration/nativeimage/nima1/Nima1Main.java b/tests/integration/native-image/nima-1/src/main/java/io/helidon/tests/integration/nativeimage/nima1/Nima1Main.java deleted file mode 100644 index b4b0b610627..00000000000 --- a/tests/integration/native-image/nima-1/src/main/java/io/helidon/tests/integration/nativeimage/nima1/Nima1Main.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2019, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.tests.integration.nativeimage.nima1; - -import java.nio.file.Paths; -import java.util.Set; - -import io.helidon.config.Config; -import io.helidon.config.FileSystemWatcher; -import io.helidon.health.HealthCheckResponse; -import io.helidon.logging.common.LogConfig; -import io.helidon.nima.observe.ObserveFeature; -import io.helidon.nima.observe.health.HealthFeature; -import io.helidon.nima.observe.health.HealthObserveProvider; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.staticcontent.StaticContentService; -import io.helidon.nima.websocket.webserver.WsRouting; - -import static io.helidon.config.ConfigSources.classpath; -import static io.helidon.config.ConfigSources.file; - -/** - * Main class of this integration test. - */ -public final class Nima1Main { - /** - * Cannot be instantiated. - */ - private Nima1Main() { - } - - /** - * Application main entry point. - * - * @param args command line arguments. - */ - public static void main(final String[] args) { - startServer(); - } - - /** - * Start the server. - * - * @return the created {@link io.helidon.nima.webserver.WebServer} instance - */ - static WebServer startServer() { - // load logging configuration - LogConfig.configureRuntime(); - - // By default this will pick up application.yaml from the classpath - Config config = buildConfig(); - - // Get webserver config from the "server" section of application.yaml - WebServer server = WebServer.builder() - .port(7076) - .addRouting(createRouting(config)) - .addRouting(WsRouting.builder() - .endpoint("/ws/messages", WebSocketEndpoint::new) - .build()) - .build() - .start(); - - System.out.println("WEB server is up! http://localhost:" + server.port() + "/greet"); - - return server; - } - - private static Config buildConfig() { - return Config.builder() - .sources( - classpath("nima-test.yaml").optional(), - file("conf/nima.yaml") - .changeWatcher(FileSystemWatcher.create()) - .optional(), - classpath("application.yaml")) - .build(); - } - - /** - * Creates new {@link io.helidon.nima.webserver.Routing}. - * - * @param config configuration of this server - * @return routing configured with JSON support, a health check, and a service - */ - private static HttpRouting createRouting(Config config) { - - GreetService greetService = new GreetService(config); - MockZipkinService zipkinService = new MockZipkinService(Set.of("helidon-reactive-webclient")); - WebClientService webClientService = new WebClientService(config, zipkinService); - HealthFeature health = HealthFeature.builder() - .addCheck(() -> HealthCheckResponse.builder() - .detail("timestamp", - System.currentTimeMillis()) - .build()) - .build(); - ObserveFeature observe = ObserveFeature.create(HealthObserveProvider.create(health)); - - return HttpRouting.builder() - .addFeature(observe) - .register("/static/path", StaticContentService.create(Paths.get("web"))) - .register("/static/classpath", StaticContentService.create("web")) - .register("/static/jar", StaticContentService.create("web-jar")) - .register("/greet", greetService) - .register("/wc", webClientService) - .register("/zipkin", zipkinService) - .build(); - } - -} diff --git a/tests/integration/native-image/nima-1/src/main/java/io/helidon/tests/integration/nativeimage/nima1/WebClientService.java b/tests/integration/native-image/nima-1/src/main/java/io/helidon/tests/integration/nativeimage/nima1/WebClientService.java deleted file mode 100644 index 9d187949241..00000000000 --- a/tests/integration/native-image/nima-1/src/main/java/io/helidon/tests/integration/nativeimage/nima1/WebClientService.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.tests.integration.nativeimage.nima1; - -import java.io.PrintWriter; -import java.io.StringWriter; -import java.lang.System.Logger.Level; -import java.time.Duration; -import java.util.Objects; -import java.util.function.Predicate; - -import io.helidon.common.http.Http; -import io.helidon.common.media.type.MediaTypes; -import io.helidon.common.reactive.Single; -import io.helidon.config.Config; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.api.WebClient; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; - -import jakarta.json.JsonValue; - -class WebClientService implements HttpService { - private static final Duration TRACE_TIMEOUT = Duration.ofSeconds(15); - private static final System.Logger LOGGER = System.getLogger(WebClientService.class.getName()); - private final WebClient client; - private final MockZipkinService zipkinService; - private final String context; - - public WebClientService(Config config, MockZipkinService zipkinService) { - this.zipkinService = zipkinService; - this.context = "http://localhost:" + config.get("port").asInt().orElse(7076); - client = WebClient.builder() - .baseUri(context) - .addHeader(Http.HeaderNames.ACCEPT, MediaTypes.APPLICATION_JSON.text()) - .config(config.get("client")) - .build(); - } - - @Override - public void routing(HttpRules rules) { - rules.get("/test", this::getTest) - .get("/redirect", this::redirect) - .get("/redirect/infinite", this::redirectInfinite) - .get("/endpoint", this::getEndpoint); - } - - private void redirect(ServerRequest request, - ServerResponse response) { - response.headers().add(Http.HeaderNames.LOCATION, context + "/wc/endpoint"); - response.status(Http.Status.MOVED_PERMANENTLY_301).send(); - } - - private void redirectInfinite(ServerRequest serverRequest, ServerResponse response) { - response.headers().add(Http.HeaderNames.LOCATION, context + "/wc/redirect/infinite"); - response.status(Http.Status.MOVED_PERMANENTLY_301).send(); - } - - private void getEndpoint(final ServerRequest request, final ServerResponse response) { - response.send(new Animal(Animal.TYPE.BIRD, "Frank")); - } - - private void getTest(final ServerRequest request, final ServerResponse response) { - - try { - testTracedGet(); - testFollowRedirect(); - testFollowRedirectInfinite(); - - response.send("ALL TESTS PASSED!\n"); - } catch (Exception e) { - response.status(Http.Status.INTERNAL_SERVER_ERROR_500); - StringWriter writer = new StringWriter(); - e.printStackTrace(new PrintWriter(writer)); - response.send("Failed to process request: " + writer); - } - } - - public void testTracedGet() { - Single nextTrace = zipkinService.next(); - Animal animal = client.get() - .path("/wc/endpoint") - .requestEntity(Animal.class); - - assertTrue(animal, a -> "Frank".equals(a.getName())); - //Wait for trace arrival to MockZipkin - nextTrace.await(TRACE_TIMEOUT); - } - - public void testFollowRedirect() { - Animal animal = client.get() - .path("/wc/redirect") - .followRedirects(true) - .requestEntity(Animal.class); - - assertTrue(animal, a -> "Frank".equals(a.getName())); - - try (HttpClientResponse response = client.get() - .path("/wc/redirect") - .followRedirects(false) - .request()) { - assertEquals(response.status(), Http.Status.MOVED_PERMANENTLY_301); - } - } - - public void testFollowRedirectInfinite() { - try { - client.get() - .path("/wc/redirect/infinite") - .requestEntity(Animal.class); - fail("This should have failed!"); - } catch (Exception e) { - assertTrue(e.getMessage(), m -> m.startsWith("Maximum number of request redirections (5) reached.")); - } - } - - private void assertTrue(T value, Predicate predicate) { - if (!predicate.test(value)) { - fail("for value: " + value); - } - } - - private void assertEquals(Object a, Object b) { - if (!Objects.equals(a, b)) { - fail("Expected " + a + " equals " + b); - } - } - - private void fail(String msg) { - fail(new RuntimeException("Assertion error " + msg)); - } - - private void fail(Exception e) { - LOGGER.log(Level.ERROR, e.getMessage()); - throw new RuntimeException("Assertion error!", e); - } -} diff --git a/tests/integration/native-image/nima-1/src/main/resources/META-INF/native-image/native-image.properties b/tests/integration/native-image/nima-1/src/main/resources/META-INF/native-image/native-image.properties deleted file mode 100644 index b73fe984a1d..00000000000 --- a/tests/integration/native-image/nima-1/src/main/resources/META-INF/native-image/native-image.properties +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright (c) 2022 Oracle and/or its affiliates. -# -# 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. -# - -# We must explicitly include resources from other modules -Args=-H:IncludeResources=web-jar/.* -H:IncludeResources=web/.* diff --git a/tests/integration/native-image/nima-1/src/main/resources/application.yaml b/tests/integration/native-image/nima-1/src/main/resources/application.yaml deleted file mode 100644 index c424126bcec..00000000000 --- a/tests/integration/native-image/nima-1/src/main/resources/application.yaml +++ /dev/null @@ -1,37 +0,0 @@ -# -# Copyright (c) 2018, 2022 Oracle and/or its affiliates. -# -# 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. -# - -app: - greeting: "Hello" - -server: - port: 7076 - host: 0.0.0.0 - -tracing: - service: "helidon-se" - protocol: "http" - host: "localhost" - port: 7076 - api-version: 2 - # mocked zipkin - path: "/zipkin/api/v2/spans" - -client: - follow-redirects: true - max-redirects: 5 - services: - tracing: \ No newline at end of file diff --git a/tests/integration/native-image/nima-1/src/main/resources/logging.properties b/tests/integration/native-image/nima-1/src/main/resources/logging.properties deleted file mode 100644 index e7e824df873..00000000000 --- a/tests/integration/native-image/nima-1/src/main/resources/logging.properties +++ /dev/null @@ -1,37 +0,0 @@ -# -# Copyright (c) 2018, 2023 Oracle and/or its affiliates. -# -# 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. -# - -# Example Logging Configuration File -# For more information see $JAVA_HOME/jre/lib/logging.properties - -# Send messages to the console -handlers=io.helidon.logging.jul.HelidonConsoleHandler - -# HelidonConsoleHandler uses a SimpleFormatter subclass that replaces "!thread!" with the current thread -java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$s %3$s !thread!: %5$s%6$s%n - -# Global logging level. Can be overridden by specific loggers -.level=INFO - -# Component specific log levels -#io.helidon.nima.webserver.level=INFO -#io.helidon.config.level=INFO -#io.helidon.security.level=INFO -#io.helidon.common.level=INFO -#io.netty.level=INFO - -io.helidon.nima.webserver.staticcontent.ClassPathContentHandler.level=FINEST -io.helidon.nima.webserver.staticcontent.FileSystemContentHandler.level=FINEST diff --git a/tests/integration/native-image/pom.xml b/tests/integration/native-image/pom.xml index e400f724375..6e3c02f6115 100644 --- a/tests/integration/native-image/pom.xml +++ b/tests/integration/native-image/pom.xml @@ -28,7 +28,7 @@ pom helidon-tests-integration-native-image - Helidon Integration Tests GraalVM Native image + Helidon Tests Integration GraalVM Native image A set of tests that make sure various Helidon modules can compile with native-image. @@ -39,7 +39,7 @@ mp-1 mp-2 mp-3 - nima-1 + se-1 diff --git a/tests/integration/native-image/se-1/conf/overrides.yaml b/tests/integration/native-image/se-1/conf/overrides.yaml new file mode 100644 index 00000000000..9028de61d52 --- /dev/null +++ b/tests/integration/native-image/se-1/conf/overrides.yaml @@ -0,0 +1,18 @@ +# +# Copyright (c) 2022, 2023 Oracle and/or its affiliates. +# +# 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. +# + +app: + greeting: "Helidon Hallo" diff --git a/tests/integration/native-image/se-1/pom.xml b/tests/integration/native-image/se-1/pom.xml new file mode 100644 index 00000000000..d0fbce6a507 --- /dev/null +++ b/tests/integration/native-image/se-1/pom.xml @@ -0,0 +1,115 @@ + + + + + 4.0.0 + + io.helidon.applications + helidon-se + 4.0.0-SNAPSHOT + ../../../../applications/se/pom.xml + + io.helidon.tests.integration + helidon-tests-native-image-se-1 + Helidon Tests Integration GraalVM Native image SE 1 + + + io.helidon.tests.integration.nativeimage.se1.Se1Main + + + + + io.helidon.webserver + helidon-webserver + + + io.helidon.webserver + helidon-webserver-static-content + + + io.helidon.webserver + helidon-webserver-websocket + + + io.helidon.http.media + helidon-http-media-jsonp + + + io.helidon.http.media + helidon-http-media-jsonb + + + io.helidon.config + helidon-config-yaml + + + io.helidon.tracing + helidon-tracing + + + io.helidon.tracing.providers + helidon-tracing-providers-zipkin + + + io.helidon.webserver.observe + helidon-webserver-observe-health + + + io.helidon.webclient + helidon-webclient + + + io.helidon.common + helidon-common-reactive + + + io.helidon.logging + helidon-logging-common + + + io.helidon.tests.integration + helidon-tests-native-image-static-content + ${project.version} + + + io.helidon.logging + helidon-logging-jul + runtime + + + org.junit.jupiter + junit-jupiter-api + test + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-libs + + + + + + diff --git a/tests/integration/native-image/nima-1/src/main/java/io/helidon/tests/integration/nativeimage/nima1/Animal.java b/tests/integration/native-image/se-1/src/main/java/io/helidon/tests/integration/nativeimage/se1/Animal.java similarity index 91% rename from tests/integration/native-image/nima-1/src/main/java/io/helidon/tests/integration/nativeimage/nima1/Animal.java rename to tests/integration/native-image/se-1/src/main/java/io/helidon/tests/integration/nativeimage/se1/Animal.java index 08f9da64cbc..b44b8aefa7e 100644 --- a/tests/integration/native-image/nima-1/src/main/java/io/helidon/tests/integration/nativeimage/nima1/Animal.java +++ b/tests/integration/native-image/se-1/src/main/java/io/helidon/tests/integration/nativeimage/se1/Animal.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.tests.integration.nativeimage.nima1; +package io.helidon.tests.integration.nativeimage.se1; import io.helidon.common.Reflected; diff --git a/tests/integration/native-image/se-1/src/main/java/io/helidon/tests/integration/nativeimage/se1/GreetService.java b/tests/integration/native-image/se-1/src/main/java/io/helidon/tests/integration/nativeimage/se1/GreetService.java new file mode 100644 index 00000000000..c7c0b5fb9ee --- /dev/null +++ b/tests/integration/native-image/se-1/src/main/java/io/helidon/tests/integration/nativeimage/se1/GreetService.java @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.tests.integration.nativeimage.se1; + +import java.util.Collections; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Consumer; + +import io.helidon.http.Http; +import io.helidon.config.Config; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; + +import jakarta.json.Json; +import jakarta.json.JsonBuilderFactory; +import jakarta.json.JsonObject; + +/** + * A simple service to greet you. Examples: + * + * Get default greeting message: + * curl -X GET http://localhost:8080/greet + * + * Get greeting message for Joe: + * curl -X GET http://localhost:8080/greet/Joe + * + * Change greeting + * curl -X PUT -H "Content-Type: application/json" -d '{"greeting" : "Howdy"}' http://localhost:8080/greet/greeting + * + * The message is returned as a JSON object + */ + +class GreetService implements HttpService { + + private static final JsonBuilderFactory JSON = Json.createBuilderFactory(Collections.emptyMap()); + /** + * The config value for the key {@code greeting}. + */ + private final AtomicReference greeting = new AtomicReference<>(); + + GreetService(Config config) { + Config greetingConfig = config.get("app.greeting"); + + // initial value + greeting.set(greetingConfig.asString().orElse("Ciao")); + + greetingConfig.onChange((Consumer) cfg -> greeting.set(cfg.asString().orElse("Ciao"))); + } + + @Override + public void routing(HttpRules rules) { + rules + .get("/", this::getDefaultMessageHandler) + // Outbound is commented out, as we want native image to work + //.get("/outbound", this::outbound) + .get("/{name}", this::getMessageHandler) + .put("/greeting", this::updateGreetingHandler); + + } + + /** + * Return a worldly greeting message. + * + * @param request the server request + * @param response the server response + */ + private void getDefaultMessageHandler(ServerRequest request, + ServerResponse response) { + sendResponse(response, "World"); + } + + /** + * Return a greeting message using the name that was provided. + * + * @param request the server request + * @param response the server response + */ + private void getMessageHandler(ServerRequest request, + ServerResponse response) { + String name = request.path().pathParameters().value("name"); + + sendResponse(response, name); + } + + private void sendResponse(ServerResponse response, String name) { + String msg = String.format("%s %s!", greeting.get(), name); + + JsonObject returnObject = JSON.createObjectBuilder() + .add("message", msg) + .build(); + response.send(returnObject); + } + + /** + * Set the greeting to use in future messages. + * + * @param request the server request + * @param response the server response + */ + private void updateGreetingHandler(ServerRequest request, + ServerResponse response) { + JsonObject jo = request.content().as(JsonObject.class); + if (!jo.containsKey("greeting")) { + JsonObject jsonErrorObject = JSON.createObjectBuilder() + .add("error", "No greeting provided") + .build(); + response.status(Http.Status.BAD_REQUEST_400) + .send(jsonErrorObject); + return; + } + + greeting.set(jo.getString("greeting")); + response.status(Http.Status.NO_CONTENT_204).send(); + } + +} diff --git a/tests/integration/native-image/nima-1/src/main/java/io/helidon/tests/integration/nativeimage/nima1/MockZipkinService.java b/tests/integration/native-image/se-1/src/main/java/io/helidon/tests/integration/nativeimage/se1/MockZipkinService.java similarity index 92% rename from tests/integration/native-image/nima-1/src/main/java/io/helidon/tests/integration/nativeimage/nima1/MockZipkinService.java rename to tests/integration/native-image/se-1/src/main/java/io/helidon/tests/integration/nativeimage/se1/MockZipkinService.java index 2d4bc215a6d..192a929f5ae 100644 --- a/tests/integration/native-image/nima-1/src/main/java/io/helidon/tests/integration/nativeimage/nima1/MockZipkinService.java +++ b/tests/integration/native-image/se-1/src/main/java/io/helidon/tests/integration/nativeimage/se1/MockZipkinService.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.tests.integration.nativeimage.nima1; +package io.helidon.tests.integration.nativeimage.se1; import java.lang.System.Logger.Level; import java.util.Set; @@ -23,10 +23,10 @@ import java.util.zip.GZIPInputStream; import io.helidon.common.reactive.Single; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import jakarta.json.Json; import jakarta.json.JsonPointer; diff --git a/tests/integration/native-image/se-1/src/main/java/io/helidon/tests/integration/nativeimage/se1/Se1Main.java b/tests/integration/native-image/se-1/src/main/java/io/helidon/tests/integration/nativeimage/se1/Se1Main.java new file mode 100644 index 00000000000..6e61fb4d737 --- /dev/null +++ b/tests/integration/native-image/se-1/src/main/java/io/helidon/tests/integration/nativeimage/se1/Se1Main.java @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.tests.integration.nativeimage.se1; + +import java.nio.file.Paths; +import java.util.Set; + +import io.helidon.config.Config; +import io.helidon.config.FileSystemWatcher; +import io.helidon.health.HealthCheckResponse; +import io.helidon.logging.common.LogConfig; +import io.helidon.webserver.observe.ObserveFeature; +import io.helidon.webserver.observe.health.HealthFeature; +import io.helidon.webserver.observe.health.HealthObserveProvider; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.staticcontent.StaticContentService; +import io.helidon.webserver.websocket.WsRouting; + +import static io.helidon.config.ConfigSources.classpath; +import static io.helidon.config.ConfigSources.file; + +/** + * Main class of this integration test. + */ +public final class Se1Main { + /** + * Cannot be instantiated. + */ + private Se1Main() { + } + + /** + * Application main entry point. + * + * @param args command line arguments. + */ + public static void main(final String[] args) { + startServer(); + } + + /** + * Start the server. + * + * @return the created {@link io.helidon.webserver.WebServer} instance + */ + static WebServer startServer() { + // load logging configuration + LogConfig.configureRuntime(); + + // By default this will pick up application.yaml from the classpath + Config config = buildConfig(); + + // Get webserver config from the "server" section of application.yaml + WebServer server = WebServer.builder() + .port(7076) + .addRouting(createRouting(config)) + .addRouting(WsRouting.builder() + .endpoint("/ws/messages", WebSocketEndpoint::new) + .build()) + .build() + .start(); + + System.out.println("WEB server is up! http://localhost:" + server.port() + "/greet"); + + return server; + } + + private static Config buildConfig() { + return Config.builder() + .sources( + classpath("application-test.yaml").optional(), + file("conf/overrides.yaml") + .changeWatcher(FileSystemWatcher.create()) + .optional(), + classpath("application.yaml")) + .build(); + } + + /** + * Creates new {@link io.helidon.webserver.Routing}. + * + * @param config configuration of this server + * @return routing configured with JSON support, a health check, and a service + */ + private static HttpRouting createRouting(Config config) { + + GreetService greetService = new GreetService(config); + MockZipkinService zipkinService = new MockZipkinService(Set.of("helidon-webclient")); + WebClientService webClientService = new WebClientService(config, zipkinService); + HealthFeature health = HealthFeature.builder() + .addCheck(() -> HealthCheckResponse.builder() + .detail("timestamp", + System.currentTimeMillis()) + .build()) + .build(); + ObserveFeature observe = ObserveFeature.create(HealthObserveProvider.create(health)); + + return HttpRouting.builder() + .addFeature(observe) + .register("/static/path", StaticContentService.create(Paths.get("web"))) + .register("/static/classpath", StaticContentService.create("web")) + .register("/static/jar", StaticContentService.create("web-jar")) + .register("/greet", greetService) + .register("/wc", webClientService) + .register("/zipkin", zipkinService) + .build(); + } + +} diff --git a/tests/integration/native-image/se-1/src/main/java/io/helidon/tests/integration/nativeimage/se1/WebClientService.java b/tests/integration/native-image/se-1/src/main/java/io/helidon/tests/integration/nativeimage/se1/WebClientService.java new file mode 100644 index 00000000000..b98b201620c --- /dev/null +++ b/tests/integration/native-image/se-1/src/main/java/io/helidon/tests/integration/nativeimage/se1/WebClientService.java @@ -0,0 +1,153 @@ +/* + * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.tests.integration.nativeimage.se1; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.lang.System.Logger.Level; +import java.time.Duration; +import java.util.Objects; +import java.util.function.Predicate; + +import io.helidon.http.Http; +import io.helidon.common.media.type.MediaTypes; +import io.helidon.common.reactive.Single; +import io.helidon.config.Config; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.api.WebClient; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; + +import jakarta.json.JsonValue; + +class WebClientService implements HttpService { + private static final Duration TRACE_TIMEOUT = Duration.ofSeconds(15); + private static final System.Logger LOGGER = System.getLogger(WebClientService.class.getName()); + private final WebClient client; + private final MockZipkinService zipkinService; + private final String context; + + public WebClientService(Config config, MockZipkinService zipkinService) { + this.zipkinService = zipkinService; + this.context = "http://localhost:" + config.get("port").asInt().orElse(7076); + client = WebClient.builder() + .baseUri(context) + .addHeader(Http.HeaderNames.ACCEPT, MediaTypes.APPLICATION_JSON.text()) + .config(config.get("client")) + .build(); + } + + @Override + public void routing(HttpRules rules) { + rules.get("/test", this::getTest) + .get("/redirect", this::redirect) + .get("/redirect/infinite", this::redirectInfinite) + .get("/endpoint", this::getEndpoint); + } + + private void redirect(ServerRequest request, + ServerResponse response) { + response.headers().add(Http.HeaderNames.LOCATION, context + "/wc/endpoint"); + response.status(Http.Status.MOVED_PERMANENTLY_301).send(); + } + + private void redirectInfinite(ServerRequest serverRequest, ServerResponse response) { + response.headers().add(Http.HeaderNames.LOCATION, context + "/wc/redirect/infinite"); + response.status(Http.Status.MOVED_PERMANENTLY_301).send(); + } + + private void getEndpoint(final ServerRequest request, final ServerResponse response) { + response.send(new Animal(Animal.TYPE.BIRD, "Frank")); + } + + private void getTest(final ServerRequest request, final ServerResponse response) { + + try { + testTracedGet(); + testFollowRedirect(); + testFollowRedirectInfinite(); + + response.send("ALL TESTS PASSED!\n"); + } catch (Exception e) { + response.status(Http.Status.INTERNAL_SERVER_ERROR_500); + StringWriter writer = new StringWriter(); + e.printStackTrace(new PrintWriter(writer)); + response.send("Failed to process request: " + writer); + } + } + + public void testTracedGet() { + Single nextTrace = zipkinService.next(); + Animal animal = client.get() + .path("/wc/endpoint") + .requestEntity(Animal.class); + + assertTrue(animal, a -> "Frank".equals(a.getName())); + //Wait for trace arrival to MockZipkin + nextTrace.await(TRACE_TIMEOUT); + } + + public void testFollowRedirect() { + Animal animal = client.get() + .path("/wc/redirect") + .followRedirects(true) + .requestEntity(Animal.class); + + assertTrue(animal, a -> "Frank".equals(a.getName())); + + try (HttpClientResponse response = client.get() + .path("/wc/redirect") + .followRedirects(false) + .request()) { + assertEquals(response.status(), Http.Status.MOVED_PERMANENTLY_301); + } + } + + public void testFollowRedirectInfinite() { + try { + client.get() + .path("/wc/redirect/infinite") + .requestEntity(Animal.class); + fail("This should have failed!"); + } catch (Exception e) { + assertTrue(e.getMessage(), m -> m.startsWith("Maximum number of request redirections (5) reached.")); + } + } + + private void assertTrue(T value, Predicate predicate) { + if (!predicate.test(value)) { + fail("for value: " + value); + } + } + + private void assertEquals(Object a, Object b) { + if (!Objects.equals(a, b)) { + fail("Expected " + a + " equals " + b); + } + } + + private void fail(String msg) { + fail(new RuntimeException("Assertion error " + msg)); + } + + private void fail(Exception e) { + LOGGER.log(Level.ERROR, e.getMessage()); + throw new RuntimeException("Assertion error!", e); + } +} diff --git a/tests/integration/native-image/nima-1/src/main/java/io/helidon/tests/integration/nativeimage/nima1/WebSocketEndpoint.java b/tests/integration/native-image/se-1/src/main/java/io/helidon/tests/integration/nativeimage/se1/WebSocketEndpoint.java similarity index 90% rename from tests/integration/native-image/nima-1/src/main/java/io/helidon/tests/integration/nativeimage/nima1/WebSocketEndpoint.java rename to tests/integration/native-image/se-1/src/main/java/io/helidon/tests/integration/nativeimage/se1/WebSocketEndpoint.java index 8ac576f126b..24af59bddd0 100644 --- a/tests/integration/native-image/nima-1/src/main/java/io/helidon/tests/integration/nativeimage/nima1/WebSocketEndpoint.java +++ b/tests/integration/native-image/se-1/src/main/java/io/helidon/tests/integration/nativeimage/se1/WebSocketEndpoint.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.tests.integration.nativeimage.nima1; +package io.helidon.tests.integration.nativeimage.se1; import java.lang.System.Logger.Level; -import io.helidon.nima.websocket.WsListener; -import io.helidon.nima.websocket.WsSession; +import io.helidon.websocket.WsListener; +import io.helidon.websocket.WsSession; class WebSocketEndpoint implements WsListener { diff --git a/tests/integration/native-image/se-1/src/main/resources/META-INF/native-image/native-image.properties b/tests/integration/native-image/se-1/src/main/resources/META-INF/native-image/native-image.properties new file mode 100644 index 00000000000..49106660db1 --- /dev/null +++ b/tests/integration/native-image/se-1/src/main/resources/META-INF/native-image/native-image.properties @@ -0,0 +1,18 @@ +# +# Copyright (c) 2022, 2023 Oracle and/or its affiliates. +# +# 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. +# + +# We must explicitly include resources from other modules +Args=-H:IncludeResources=web-jar/.* -H:IncludeResources=web/.* diff --git a/tests/integration/native-image/se-1/src/main/resources/application.yaml b/tests/integration/native-image/se-1/src/main/resources/application.yaml new file mode 100644 index 00000000000..7b360e1bd65 --- /dev/null +++ b/tests/integration/native-image/se-1/src/main/resources/application.yaml @@ -0,0 +1,37 @@ +# +# Copyright (c) 2018, 2023 Oracle and/or its affiliates. +# +# 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. +# + +app: + greeting: "Hello" + +server: + port: 7076 + host: 0.0.0.0 + +tracing: + service: "helidon-se" + protocol: "http" + host: "localhost" + port: 7076 + api-version: 2 + # mocked zipkin + path: "/zipkin/api/v2/spans" + +client: + follow-redirects: true + max-redirects: 5 + services: + tracing: \ No newline at end of file diff --git a/tests/integration/native-image/se-1/src/main/resources/logging.properties b/tests/integration/native-image/se-1/src/main/resources/logging.properties new file mode 100644 index 00000000000..c8edfa26595 --- /dev/null +++ b/tests/integration/native-image/se-1/src/main/resources/logging.properties @@ -0,0 +1,37 @@ +# +# Copyright (c) 2018, 2023 Oracle and/or its affiliates. +# +# 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. +# + +# Example Logging Configuration File +# For more information see $JAVA_HOME/jre/lib/logging.properties + +# Send messages to the console +handlers=io.helidon.logging.jul.HelidonConsoleHandler + +# HelidonConsoleHandler uses a SimpleFormatter subclass that replaces "!thread!" with the current thread +java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$s %3$s !thread!: %5$s%6$s%n + +# Global logging level. Can be overridden by specific loggers +.level=INFO + +# Component specific log levels +#io.helidon.webserver.level=INFO +#io.helidon.config.level=INFO +#io.helidon.security.level=INFO +#io.helidon.common.level=INFO +#io.netty.level=INFO + +io.helidon.webserver.staticcontent.ClassPathContentHandler.level=FINEST +io.helidon.webserver.staticcontent.FileSystemContentHandler.level=FINEST diff --git a/tests/integration/native-image/nima-1/src/main/resources/web/resource.txt b/tests/integration/native-image/se-1/src/main/resources/web/resource.txt similarity index 100% rename from tests/integration/native-image/nima-1/src/main/resources/web/resource.txt rename to tests/integration/native-image/se-1/src/main/resources/web/resource.txt diff --git a/tests/integration/native-image/nima-1/web/resource.txt b/tests/integration/native-image/se-1/web/resource.txt similarity index 100% rename from tests/integration/native-image/nima-1/web/resource.txt rename to tests/integration/native-image/se-1/web/resource.txt diff --git a/tests/integration/native-image/static-content/pom.xml b/tests/integration/native-image/static-content/pom.xml index c7ab5b45526..6dcfc015734 100644 --- a/tests/integration/native-image/static-content/pom.xml +++ b/tests/integration/native-image/static-content/pom.xml @@ -27,7 +27,7 @@ io.helidon.tests.integration helidon-tests-native-image-static-content - Helidon Integration Tests GraalVM Native image Static Content + Helidon Tests Integration GraalVM Native image Static Content Static content jar file to use in other tests (to make sure we access a jar file and not a path). diff --git a/tests/integration/oidc/pom.xml b/tests/integration/oidc/pom.xml index 9a11f991353..35dc565a353 100644 --- a/tests/integration/oidc/pom.xml +++ b/tests/integration/oidc/pom.xml @@ -25,7 +25,7 @@ 4.0.0 - Helidon Integration Test OIDC + Helidon Tests Integration OIDC helidon-tests-integration-oidc diff --git a/tests/integration/pom.xml b/tests/integration/pom.xml index 4b7b5ae516c..0f1a4c28078 100644 --- a/tests/integration/pom.xml +++ b/tests/integration/pom.xml @@ -30,7 +30,7 @@ helidon-tests-integration pom - Helidon Integration Tests + Helidon Tests Integration 1.17.5 @@ -38,15 +38,16 @@ + config + dbclient + gh-5792 harness - zipkin-mp-2.2 - mp-graphql - mp-security-client health - mp-ws-services - webclient - webserver - security + jep290 + jms + jpa + kafka + mp-bean-validation mp-gh-2421 mp-gh-2461 mp-gh-3246 @@ -54,19 +55,15 @@ mp-gh-4123 mp-gh-4654 mp-gh-5328 - kafka - jpa - jms - config - dbclient - jep290 - mp-bean-validation - restclient + mp-graphql + mp-security-client + mp-ws-services native-image - vault oidc - gh-5792 - jersey-connector + restclient + security + vault + zipkin-mp-2.2 diff --git a/tests/integration/restclient/pom.xml b/tests/integration/restclient/pom.xml index a8a7b6d5c26..945d4532a3b 100644 --- a/tests/integration/restclient/pom.xml +++ b/tests/integration/restclient/pom.xml @@ -26,7 +26,7 @@ 4.0.0 helidon-tests-integration-restclient - Helidon Integration Test RestClient + Helidon Tests Integration RestClient diff --git a/tests/integration/security/gh2297/src/main/resources/logging.properties b/tests/integration/security/gh2297/src/main/resources/logging.properties index 7c135d6945c..df2e07e669a 100644 --- a/tests/integration/security/gh2297/src/main/resources/logging.properties +++ b/tests/integration/security/gh2297/src/main/resources/logging.properties @@ -27,7 +27,7 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ .level=INFO AUDIT.level=FINEST # Component specific log levels -#io.helidon.nima.webserver.level=INFO +#io.helidon.webserver.level=INFO #io.helidon.config.level=INFO #io.helidon.security.level=INFO #io.helidon.microprofile.level=INFO diff --git a/tests/integration/security/gh2297/src/test/java/io/helidon/tests/integration/security/gh2297/ProtectedMetricsTest.java b/tests/integration/security/gh2297/src/test/java/io/helidon/tests/integration/security/gh2297/ProtectedMetricsTest.java index 3d8e92db953..f21f7a1d4f0 100644 --- a/tests/integration/security/gh2297/src/test/java/io/helidon/tests/integration/security/gh2297/ProtectedMetricsTest.java +++ b/tests/integration/security/gh2297/src/test/java/io/helidon/tests/integration/security/gh2297/ProtectedMetricsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021 Oracle and/or its affiliates. + * Copyright (c) 2020, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ import java.util.Base64; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.microprofile.server.Server; import jakarta.ws.rs.client.Client; diff --git a/tests/integration/security/gh2772/src/main/resources/logging.properties b/tests/integration/security/gh2772/src/main/resources/logging.properties index 3a849bd37f6..d50cee4d8da 100644 --- a/tests/integration/security/gh2772/src/main/resources/logging.properties +++ b/tests/integration/security/gh2772/src/main/resources/logging.properties @@ -27,7 +27,7 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ .level=INFO AUDIT.level=FINEST # Component specific log levels -#io.helidon.nima.webserver.level=INFO +#io.helidon.webserver.level=INFO #io.helidon.config.level=INFO io.helidon.security.level=INFO #io.helidon.microprofile.level=INFO diff --git a/tests/integration/security/path-params/src/test/java/io/helidon/tests/integration/security/pathparams/AdminTest.java b/tests/integration/security/path-params/src/test/java/io/helidon/tests/integration/security/pathparams/AdminTest.java index e3c4a43d5f4..2fc1b73cf7d 100644 --- a/tests/integration/security/path-params/src/test/java/io/helidon/tests/integration/security/pathparams/AdminTest.java +++ b/tests/integration/security/path-params/src/test/java/io/helidon/tests/integration/security/pathparams/AdminTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022 Oracle and/or its affiliates. + * Copyright (c) 2021, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ import java.util.Base64; import java.util.function.Function; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.microprofile.server.Server; import jakarta.ws.rs.client.Client; diff --git a/tests/integration/security/pom.xml b/tests/integration/security/pom.xml index 0294fd32e5b..1102558aa7f 100644 --- a/tests/integration/security/pom.xml +++ b/tests/integration/security/pom.xml @@ -28,7 +28,7 @@ pom helidon-tests-integration-security - Helidon Integration Tests Security + Helidon Tests Integration Security Security integration tests diff --git a/tests/integration/vault/pom.xml b/tests/integration/vault/pom.xml index cc17ced3c2d..dd7c93adb6b 100644 --- a/tests/integration/vault/pom.xml +++ b/tests/integration/vault/pom.xml @@ -28,7 +28,7 @@ io.helidon.tests.integration.vault helidon-tests-integration-vault - Helidon Integration Tests Vault + Helidon Tests Integration Vault Tests for Hashicorp Vault, requires Vault and mysql to test most options, except for k8s integration. diff --git a/tests/integration/vault/src/test/java/io/helidon/examples/integrations/vault/hcp/VaultTest.java b/tests/integration/vault/src/test/java/io/helidon/examples/integrations/vault/hcp/VaultTest.java index b9a56fa7732..26dda3f5b30 100644 --- a/tests/integration/vault/src/test/java/io/helidon/examples/integrations/vault/hcp/VaultTest.java +++ b/tests/integration/vault/src/test/java/io/helidon/examples/integrations/vault/hcp/VaultTest.java @@ -25,7 +25,7 @@ import java.util.Optional; import io.helidon.common.Base64Value; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.integrations.common.rest.ApiResponse; import io.helidon.integrations.vault.Secret; import io.helidon.integrations.vault.Vault; diff --git a/tests/integration/webclient/pom.xml b/tests/integration/webclient/pom.xml deleted file mode 100644 index 3353f67c241..00000000000 --- a/tests/integration/webclient/pom.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - helidon-tests-integration - io.helidon.tests.integration - 4.0.0-SNAPSHOT - - 4.0.0 - - helidon-tests-integration-webclient - Helidon Integration Test WebClient - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.webclient - helidon-nima-webclient - - - io.helidon.nima.webclient - helidon-nima-webclient-security - - - io.helidon.security.integration - helidon-security-integration-nima - - - io.helidon.nima.webserver - helidon-nima-webserver-tracing - - - io.helidon.config - helidon-config-yaml - - - io.helidon.health - helidon-health - - - io.helidon.health - helidon-health-checks - - - io.helidon.metrics - helidon-metrics - - - io.helidon.security.providers - helidon-security-providers-abac - - - io.helidon.security.providers - helidon-security-providers-http-auth - - - io.helidon.tracing.providers - helidon-tracing-providers-opentracing - - - io.helidon.nima.http.media - helidon-nima-http-media-jsonp - - - helidon-common-testing-junit5 - io.helidon.common.testing - test - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - io.helidon.nima.webclient - helidon-nima-webclient-metrics - test - - - io.helidon.nima.webclient - helidon-nima-webclient-tracing - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - io.opentracing - opentracing-mock - test - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - diff --git a/tests/integration/webclient/src/main/java/io/helidon/tests/integration/webclient/GreetService.java b/tests/integration/webclient/src/main/java/io/helidon/tests/integration/webclient/GreetService.java deleted file mode 100644 index 0a037cac585..00000000000 --- a/tests/integration/webclient/src/main/java/io/helidon/tests/integration/webclient/GreetService.java +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.tests.integration.webclient; - -import java.lang.System.Logger.Level; -import java.security.Principal; -import java.util.Collections; -import java.util.Objects; -import java.util.Optional; -import java.util.concurrent.atomic.AtomicReference; - -import io.helidon.common.context.Context; -import io.helidon.common.context.Contexts; -import io.helidon.common.http.Http; -import io.helidon.common.parameters.Parameters; -import io.helidon.common.uri.UriFragment; -import io.helidon.config.Config; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webclient.security.WebClientSecurity; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; -import io.helidon.security.SecurityContext; - -import jakarta.json.Json; -import jakarta.json.JsonBuilderFactory; -import jakarta.json.JsonException; -import jakarta.json.JsonObject; - -/** - * A simple service to greet you. Examples: - *

    - * Get default greeting message: - * curl -X GET http://localhost:8080/greet - *

    - * Get greeting message for Joe: - * curl -X GET http://localhost:8080/greet/Joe - *

    - * Change greeting - * curl -X PUT -H "Content-Type: application/json" -d '{"greeting" : "Howdy"}' http://localhost:8080/greet/greeting - *

    - * The message is returned as a JSON object - */ - -public class GreetService implements HttpService { - - private static final JsonBuilderFactory JSON = Json.createBuilderFactory(Collections.emptyMap()); - private static final System.Logger LOGGER = System.getLogger(GreetService.class.getName()); - - /** - * The config value for the key {@code greeting}. - */ - private final AtomicReference greeting = new AtomicReference<>(); - private final Http1Client outboundClient = Http1Client.builder() - .servicesDiscoverServices(false) - .addService(WebClientSecurity.create()) - .build(); - - GreetService(Config config) { - greeting.set(config.get("app.greeting").asString().orElse("Ciao")); - } - - /** - * A service registers itself by updating the routing rules. - * - * @param rules the routing rules. - */ - @Override - public void routing(HttpRules rules) { - rules - .get("/", this::getDefaultMessageHandler) - .get("/redirect", this::redirect) - .get("/redirectPath", this::redirectPath) - .get("/redirect/infinite", this::redirectInfinite) - .post("/form", this::form) - .post("/form/content", this::formContent) - .post("/contentLength", this::contentLength) - .put("/contentLength", this::contentLength) - .get("/contentLength", this::contentLength) - .get("/secure/basic", this::basicAuth) - .get("/secure/basic/outbound", this::basicAuthOutbound) - .get("/valuesPropagated", this::valuesPropagated) - .get("/obtainedQuery", this::obtainedQuery) - .get("/pattern with space", this::getDefaultMessageHandler) - .put("/greeting", this::updateGreetingHandler) - .get("/contextCheck", this::contextCheck); - } - - private void contentLength(ServerRequest serverRequest, ServerResponse serverResponse) { - serverRequest.headers().contentLength() - .ifPresentOrElse(value -> serverResponse.send(Http.HeaderNames.CONTENT_LENGTH + " is " + value), - () -> serverResponse.send("No " + Http.HeaderNames.CONTENT_LENGTH + " has been set")); - } - - private void basicAuthOutbound(ServerRequest request, ServerResponse response) { - - try (Http1ClientResponse clientResponse = outboundClient.get("http://localhost:" - + request.requestedUri().port() - + "/greet/secure/basic") - .request()) { - response.status(clientResponse.status()); - if (clientResponse.status() == Http.Status.OK_200) { - response.send(clientResponse.entity().as(String.class)); - } else { - response.send(); - } - } - } - - private void valuesPropagated(ServerRequest serverRequest, ServerResponse serverResponse) { - String queryParam = serverRequest.query().first("param").orElse("Query param not present"); - String fragment = serverRequest.prologue().fragment().value(); - serverResponse.status(Http.Status.OK_200); - serverResponse.send(queryParam + " " + fragment); - } - - private void obtainedQuery(ServerRequest serverRequest, ServerResponse serverResponse) { - String queryParam = serverRequest.query().first("param").orElse("Query param not present"); - String queryValue = serverRequest.query().first(queryParam).orElse("Query " + queryParam + " param not present"); - UriFragment uriFragment = serverRequest.prologue().fragment(); - String fragment = uriFragment.hasValue() ? uriFragment.value() : null; - serverResponse.status(Http.Status.OK_200); - serverResponse.send(queryValue + " " + (fragment == null ? "" : fragment)); - } - - private void basicAuth(ServerRequest serverRequest, ServerResponse response) { - String name = serverRequest.context() - .get(SecurityContext.class) - .flatMap(SecurityContext::userPrincipal) - .map(Principal::getName) - .orElse("Anonymous"); - - sendResponse(response, name); - } - - /** - * Return a worldly greeting message. - * - * @param request the server request - * @param response the server response - */ - private void getDefaultMessageHandler(ServerRequest request, - ServerResponse response) { - sendResponse(response, "World"); - } - - /** - * Return a greeting message using the name that was provided. - * - * @param request the server request - * @param response the server response - */ - private void redirect(ServerRequest request, ServerResponse response) { - response.headers().add(Http.HeaderNames.LOCATION, "http://localhost:" + request.requestedUri().port() + "/greet"); - response.status(Http.Status.MOVED_PERMANENTLY_301).send(); - } - - private void redirectPath(ServerRequest request, ServerResponse response) { - response.headers().add(Http.HeaderNames.LOCATION, "/greet"); - response.status(Http.Status.MOVED_PERMANENTLY_301).send(); - } - - private void redirectInfinite(ServerRequest request, ServerResponse response) { - response.headers().add(Http.HeaderNames.LOCATION, "http://localhost:" + request.requestedUri().port() + "/greet/redirect/infinite"); - response.status(Http.Status.MOVED_PERMANENTLY_301).send(); - } - - private void form(ServerRequest req, ServerResponse res) { - Parameters form = req.content().as(Parameters.class); - res.send("Hi " + form.first("name").orElse("unknown")); - } - - private void formContent(ServerRequest req, ServerResponse res) { - Parameters form = req.content().as(Parameters.class); - res.send(form); - } - - /** - * Set the greeting to use in future messages. - * - * @param request the server request - * @param response the server response - */ - private void updateGreetingHandler(ServerRequest request, - ServerResponse response) { - try { - JsonObject jsonObject = request.content().as(JsonObject.class); - updateGreetingFromJson(jsonObject, response); - } catch (JsonException ex) { - LOGGER.log(Level.DEBUG, "Invalid JSON", ex); - JsonObject jsonErrorObject = JSON.createObjectBuilder() - .add("error", "Invalid JSON") - .build(); - response.status(Http.Status.BAD_REQUEST_400).send(jsonErrorObject); - } - } - - private void sendResponse(ServerResponse response, String name) { - String msg = String.format("%s %s!", greeting.get(), name); - - JsonObject returnObject = JSON.createObjectBuilder() - .add("message", msg) - .build(); - response.send(returnObject); - } - - private void updateGreetingFromJson(JsonObject jo, ServerResponse response) { - - if (!jo.containsKey("greeting")) { - JsonObject jsonErrorObject = JSON.createObjectBuilder() - .add("error", "No greeting provided") - .build(); - response.status(Http.Status.BAD_REQUEST_400) - .send(jsonErrorObject); - return; - } - - greeting.set(jo.getString("greeting")); - response.status(Http.Status.NO_CONTENT_204).send(); - } - - /** - * Checks the existence of a {@code Context} object in a WebClient thread. - * - * @param request the request - * @param response the response - */ - private void contextCheck(ServerRequest request, ServerResponse response) { - Http1Client webClient = Http1Client.builder() - .baseUri("http://localhost:" + request.requestedUri().port() + "/") - .build(); - - Optional context = Contexts.context(); - - // Verify that context was propagated with auth enabled - if (context.isEmpty()) { - response.status(Http.Status.INTERNAL_SERVER_ERROR_500).send(); - return; - } - - // Register instance in context - context.get().register(this); - - // Ensure context is available in webclient threads - try (Http1ClientResponse ignored = webClient.get().request()) { - Context singleContext = Contexts.context().orElseThrow(); - Objects.requireNonNull(singleContext.get(GreetService.class)); - response.status(Http.Status.OK_200); - response.send(); - } - } -} diff --git a/tests/integration/webclient/src/main/java/io/helidon/tests/integration/webclient/Main.java b/tests/integration/webclient/src/main/java/io/helidon/tests/integration/webclient/Main.java deleted file mode 100644 index d1d74ac0722..00000000000 --- a/tests/integration/webclient/src/main/java/io/helidon/tests/integration/webclient/Main.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.tests.integration.webclient; - -import io.helidon.config.Config; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.context.ContextFeature; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.tracing.TracingFeature; -import io.helidon.security.integration.nima.SecurityFeature; -import io.helidon.tracing.providers.opentracing.OpenTracing; - -import io.opentracing.Tracer; - -/** - * The application main class. - */ -public final class Main { - - /** - * Cannot be instantiated. - */ - private Main() { - } - - public static void main(String[] args) { - startServer(); - } - - /** - * Start the server. - * - * @return the created {@link WebServer} instance - */ - static WebServer startServer() { - return startServer(null); - } - - /** - * Start the server. - * - * @param tracer tracer, may be {@code null} - * @return the created {@link WebServer} instance - */ - static WebServer startServer(Tracer tracer) { - WebServerConfig.Builder builder = WebServer.builder(); - setup(builder, tracer); - WebServer server = builder.build().start(); - System.out.println("WEB server is up! http://localhost:" + server.port() + "/greet"); - return server; - } - - /** - * Set up the server. - * - * @param builder server builder - * @param tracer tracer, may be {@code null} - */ - static void setup(WebServerConfig.Builder builder, Tracer tracer) { - Config config = Config.create(); - builder.config(config.get("server")); - builder.routing(routing -> routing(routing, config, tracer)); - } - - /** - * Set up routing. - * - * @param config configuration of this server - * @param tracer tracer, may be {@code null} - */ - static void routing(HttpRouting.Builder routing, Config config, Tracer tracer) { - GreetService greetService = new GreetService(config); - routing.addFeature(ContextFeature.create()) - .addFeature(SecurityFeature.create(config.get("security"))) - .register("/greet", greetService); - if (tracer != null) { - routing.addFeature(TracingFeature.create(OpenTracing.create(tracer))); - } - } -} diff --git a/tests/integration/webclient/src/main/resources/application.yaml b/tests/integration/webclient/src/main/resources/application.yaml deleted file mode 100644 index ff9cc80c931..00000000000 --- a/tests/integration/webclient/src/main/resources/application.yaml +++ /dev/null @@ -1,59 +0,0 @@ -# -# Copyright (c) 2020, 2022 Oracle and/or its affiliates. -# -# 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. -# - -app: - greeting: "Hello" - -server: - port: -1 - host: 0.0.0.0 - -client: - follow-redirects: true - max-redirects: 5 - services: - tracing: - security: - -security: - providers: - # enable the "ABAC" security provider (also handles RBAC) - - abac: - # enabled the HTTP Basic authentication provider - - http-basic-auth: - realm: "helidon" - users: - - login: "jack" - password: "password" - roles: ["admin"] - - login: "jill" - password: "password" - roles: ["user"] - - login: "joe" - password: "password" - outbound: - - name: "propagate-to-all-targets" - web-server: - paths: - - path: "/greet/secure/basic" - authenticate: true - roles-allowed: ["user", "admin"] - - path: "/greet/secure/basic/outbound" - authenticate: true - roles-allowed: ["user", "admin"] - - path: "/greet/contextCheck" - authenticate: true - roles-allowed: ["user", "admin"] diff --git a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/CertificateHelper.java b/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/CertificateHelper.java deleted file mode 100644 index fabca590b2a..00000000000 --- a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/CertificateHelper.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.helidon.tests.integration.webclient; - -import java.util.Optional; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -class CertificateHelper { - - private static final Pattern CN_PATTERN = Pattern.compile("(.*)CN=(.*?)(,.*)?"); - - private CertificateHelper() { - } - - static Optional clientCertificateName(String name) { - Matcher matcher = CN_PATTERN.matcher(name); - if (matcher.matches()) { - String cn = matcher.group(2); - if (!cn.isBlank()) { - return Optional.of(cn); - } - } - return Optional.empty(); - } -} diff --git a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/MediaContextTest.java b/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/MediaContextTest.java deleted file mode 100644 index becd422a7f8..00000000000 --- a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/MediaContextTest.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.helidon.tests.integration.webclient; - -import java.io.InputStream; -import java.util.Collections; - -import io.helidon.common.http.Http; -import io.helidon.nima.http.media.MediaContext; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.WebServer; - -import jakarta.json.Json; -import jakarta.json.JsonBuilderFactory; -import jakarta.json.JsonObject; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.MethodOrderer.OrderAnnotation; -import org.junit.jupiter.api.Order; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.TestMethodOrder; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.not; -import static org.hamcrest.Matchers.nullValue; -import static org.hamcrest.Matchers.startsWith; -import static org.junit.jupiter.api.Assertions.assertAll; -import static org.junit.jupiter.api.Assertions.assertThrows; - -/** - * Tests for MediaContext functionality in WebClient. - */ -@TestMethodOrder(OrderAnnotation.class) -public class MediaContextTest extends TestParent { - - private static final JsonBuilderFactory JSON_BUILDER = Json.createBuilderFactory(Collections.emptyMap()); - private static final String DEFAULT_GREETING; - private static final JsonObject JSON_GREETING; - private static final JsonObject JSON_NEW_GREETING; - - static { - DEFAULT_GREETING = CONFIG.get("app.greeting").asString().orElse("Hello"); - - JSON_GREETING = JSON_BUILDER.createObjectBuilder() - .add("message", DEFAULT_GREETING + " World!") - .build(); - - JSON_NEW_GREETING = JSON_BUILDER.createObjectBuilder() - .add("greeting", "Hola") - .build(); - } - - MediaContextTest(WebServer server) { - super(server); - } - - @Test - @Order(1) - public void testInputStream() { - try (Http1ClientResponse res = client.get().request()) { - InputStream is = res.inputStream(); - assertAll( - () -> assertThat(res.status(), is(Http.Status.OK_200)), - () -> assertThat(new String(is.readAllBytes()), is("{\"message\":\"Hello World!\"}")) - ); - } - } - - @Test - @Order(2) - public void testMediaSupportDefaults() { - Http1Client client = Http1Client.builder() - .baseUri("http://localhost:" + server.port() + "/greet") - .build(); - - String greeting = client.get().requestEntity(String.class); - assertThat(greeting, is(JSON_GREETING.toString())); - } - - @Test - @Order(3) - public void testMediaSupportWithoutDefaults() { - Http1Client client = Http1Client.builder() - .baseUri("http://localhost:" + server.port() + "/greet") - .mediaContext(MediaContext.builder() - .registerDefaults(false) - .mediaSupportsDiscoverServices(false) - .build()) - .build(); - - IllegalArgumentException ex = assertThrows(IllegalArgumentException.class, () -> - client.get().request().as(String.class)); - assertThat(ex.getMessage(), startsWith("No client response media support for class")); - } - - @Test - @Order(4) - @Disabled("https://github.com/helidon-io/helidon/issues/7205") - public void testReaderRegisteredOnClient() { - Http1Client client = Http1Client.builder() - .baseUri("http://localhost:" + server.port() + "/greet") - .mediaContext(MediaContext.builder() - //.addMediaReader(JsonpSupport.create().reader()) - .mediaSupportsDiscoverServices(false) - .build()) - .build(); - - JsonObject jsonObject = client.get().requestEntity(JsonObject.class); - assertThat(jsonObject, is(not(nullValue()))); - - IllegalArgumentException ex = assertThrows(IllegalArgumentException.class, () -> - client.put() - .path("/greeting") - .submit(JSON_NEW_GREETING) - .close()); - assertThat(ex.getMessage(), startsWith("No client request media writer for class")); - } - - @Test - @Order(5) - @Disabled("https://github.com/helidon-io/helidon/issues/7205") - public void testWriterRegisteredOnClient() { - Http1Client client = Http1Client.builder() - .baseUri("http://localhost:" + server.port() + "/greet") - .mediaContext(MediaContext.builder() - //.addMediaWriter(JsonpSupport.create().writer()) - .mediaSupportsDiscoverServices(false) - .build()) - .build(); - - IllegalArgumentException ex = assertThrows(IllegalArgumentException.class, () -> { - try (Http1ClientResponse response = client.put() - .path("/greeting") - .submit(JSON_NEW_GREETING)) { - response.as(JsonObject.class); - } - }); - assertThat(ex.getMessage(), startsWith("No client response media support for interface")); - } -} diff --git a/tests/integration/webclient/src/test/resources/client.p12 b/tests/integration/webclient/src/test/resources/client.p12 deleted file mode 100644 index 4eb3b8325cd..00000000000 Binary files a/tests/integration/webclient/src/test/resources/client.p12 and /dev/null differ diff --git a/tests/integration/webclient/src/test/resources/server.p12 b/tests/integration/webclient/src/test/resources/server.p12 deleted file mode 100644 index ff8e4ddfc7f..00000000000 Binary files a/tests/integration/webclient/src/test/resources/server.p12 and /dev/null differ diff --git a/tests/integration/webserver/gh2631/pom.xml b/tests/integration/webserver/gh2631/pom.xml deleted file mode 100644 index 26591d5e296..00000000000 --- a/tests/integration/webserver/gh2631/pom.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - helidon-tests-integration-webserver - io.helidon.tests.integration - 4.0.0-SNAPSHOT - - 4.0.0 - - helidon-tests-integration-webserver-gh2631 - Helidon Integration Test WebServer GH 2631 - - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.webserver - helidon-nima-webserver-static-content - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - io.helidon.logging - helidon-logging-jul - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - - \ No newline at end of file diff --git a/tests/integration/webserver/pom.xml b/tests/integration/webserver/pom.xml deleted file mode 100644 index 29c300e485a..00000000000 --- a/tests/integration/webserver/pom.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - 4.0.0 - - - io.helidon.tests.integration - helidon-tests-integration - 4.0.0-SNAPSHOT - - - pom - helidon-tests-integration-webserver - Helidon Integration Tests WebServer - - - WebServer integration tests - - - - gh2631 - upgrade - resource-limits - - \ No newline at end of file diff --git a/tests/integration/webserver/resource-limits/pom.xml b/tests/integration/webserver/resource-limits/pom.xml deleted file mode 100644 index 103575574d5..00000000000 --- a/tests/integration/webserver/resource-limits/pom.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - helidon-tests-integration-webserver - io.helidon.tests.integration - 4.0.0-SNAPSHOT - - 4.0.0 - - helidon-tests-integration-webserver-resource-limits - Helidon Integration Test WebServer Resource Limits - - - - io.helidon.common - helidon-common-key-util - - - io.helidon.logging - helidon-logging-common - - - io.helidon.common - helidon-common-configurable - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.http2 - helidon-nima-http2-webserver - - - io.helidon.nima.http2 - helidon-nima-http2-webclient - test - - - io.helidon.nima.websocket - helidon-nima-websocket-webserver - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-http2 - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - \ No newline at end of file diff --git a/tests/integration/webserver/upgrade/pom.xml b/tests/integration/webserver/upgrade/pom.xml deleted file mode 100644 index 1e0565092b6..00000000000 --- a/tests/integration/webserver/upgrade/pom.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - - helidon-tests-integration-webserver - io.helidon.tests.integration - 4.0.0-SNAPSHOT - - 4.0.0 - - helidon-tests-integration-webserver-upgrade - Helidon Integration Test WebServer Upgrade codecs composition - - - - io.helidon.common - helidon-common-key-util - - - io.helidon.logging - helidon-logging-common - - - io.helidon.common - helidon-common-configurable - - - io.helidon.nima.webserver - helidon-nima-webserver - - - io.helidon.nima.http2 - helidon-nima-http2-webserver - - - io.helidon.nima.http2 - helidon-nima-http2-webclient - test - - - io.helidon.nima.websocket - helidon-nima-websocket-webserver - - - io.helidon.nima.http.encoding - helidon-nima-http-encoding-deflate - - - io.helidon.nima.http.encoding - helidon-nima-http-encoding-gzip - - - io.helidon.logging - helidon-logging-jul - - - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - org.junit.jupiter - junit-jupiter-params - test - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - default-testCompile - - - - --add-modules - java.net.http - - - - - - - - - \ No newline at end of file diff --git a/tests/integration/webserver/upgrade/src/main/java/io/helidon/integration/webserver/upgrade/Main.java b/tests/integration/webserver/upgrade/src/main/java/io/helidon/integration/webserver/upgrade/Main.java deleted file mode 100644 index 91550f74c1c..00000000000 --- a/tests/integration/webserver/upgrade/src/main/java/io/helidon/integration/webserver/upgrade/Main.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.integration.webserver.upgrade; - -import io.helidon.common.configurable.Resource; -import io.helidon.common.http.Http; -import io.helidon.common.http.PathMatchers; -import io.helidon.common.pki.Keys; -import io.helidon.logging.common.LogConfig; -import io.helidon.nima.http2.webserver.Http2Route; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http1.Http1Route; -import io.helidon.nima.websocket.webserver.WsRouting; - -import static io.helidon.common.http.Http.Method.GET; -import static io.helidon.common.http.Http.Method.POST; -import static io.helidon.common.http.Http.Method.PUT; - -public class Main { - - public static void main(String[] args) { - LogConfig.configureRuntime(); - startServer(true); - } - - public static WebServer startServer(boolean ssl) { - Keys privateKeyConfig = Keys.builder() - .keystore(store -> store.passphrase("helidon") - .keystore(Resource.create("server.p12"))) - .build(); - - return WebServer.builder() - .update(server -> { - server.host("localhost"); - if (ssl) { - server.tls(tls -> tls - .privateKey(privateKeyConfig) - .privateKeyCertChain(privateKeyConfig)); - } - }) - .routing(r -> r - .get("/", (req, res) -> res.send("HTTP Version " + req.prologue().protocolVersion() + "\n")) - .route(Http1Route.route(GET, "/versionspecific", (req, res) -> res.send("HTTP/1.1 route\n"))) - .route(Http2Route.route(GET, "/versionspecific", (req, res) -> res.send("HTTP/2.0 route\n"))) - .route(Http1Route.route(GET, "/versionspecific1", (req, res) -> res.send("HTTP/1.1 route\n"))) - .route(Http2Route.route(GET, "/versionspecific2", (req, res) -> res.send("HTTP/2.0 route\n"))) - .route(Http.Method.predicate(GET, POST, PUT), - PathMatchers.create("/multi*"), - (req, res) -> res.send("HTTP/" + req.prologue().protocolVersion() - + " route " + req.prologue().method() + "\n"))) - .addRouting(WsRouting.builder() - .endpoint("/ws-echo", new EchoWsListener()) - .build()) - .build() - .start(); - } -} diff --git a/tests/integration/webserver/upgrade/src/main/java/module-info.java b/tests/integration/webserver/upgrade/src/main/java/module-info.java deleted file mode 100644 index 0722d7fa98f..00000000000 --- a/tests/integration/webserver/upgrade/src/main/java/module-info.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. - * - * 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. - */ - -/** - * Integration test for routing composition. - */ -module helidon.tests.integration.webserver.upgrade { - - exports io.helidon.integration.webserver.upgrade; - - requires io.helidon.logging.common; - requires io.helidon.common.http; - requires io.helidon.nima.webserver; - requires io.helidon.common.pki; - requires io.helidon.nima.http2.webserver; - requires io.helidon.nima.websocket.webserver; -} \ No newline at end of file diff --git a/tests/integration/webserver/upgrade/src/main/resources/logging.properties b/tests/integration/webserver/upgrade/src/main/resources/logging.properties deleted file mode 100644 index efe83882543..00000000000 --- a/tests/integration/webserver/upgrade/src/main/resources/logging.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 2022 Oracle and/or its affiliates. -# -# 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. -# - - -#All attributes details -handlers=io.helidon.logging.jul.HelidonConsoleHandler -java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$s %3$s !thread!: %5$s%6$s%n - -#All log level details -.level=FINEST diff --git a/tests/integration/zipkin-mp-2.2/pom.xml b/tests/integration/zipkin-mp-2.2/pom.xml index bb657b2615e..9a7d312117a 100644 --- a/tests/integration/zipkin-mp-2.2/pom.xml +++ b/tests/integration/zipkin-mp-2.2/pom.xml @@ -27,7 +27,7 @@ io.helidon.tests.integration helidon-tests-integration-zipkin-mp-2-2 - Helidon Integration Test: Zipkin with MP + Helidon Tests Integration: Zipkin with MP diff --git a/tracing/tests/it-tracing-client-zipkin/pom.xml b/tracing/tests/it-tracing-client-zipkin/pom.xml index 313e7a71390..4d82efc5e81 100644 --- a/tracing/tests/it-tracing-client-zipkin/pom.xml +++ b/tracing/tests/it-tracing-client-zipkin/pom.xml @@ -48,13 +48,13 @@ test - io.helidon.nima.testing.junit5 - helidon-nima-testing-junit5-webserver + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 test - io.helidon.nima.webserver - helidon-nima-webserver-tracing + io.helidon.webserver + helidon-webserver-tracing test diff --git a/tracing/tests/it-tracing-client-zipkin/src/test/java/io/helidon/tracing/tests/it1/OpenTraceableClientE2ETest.java b/tracing/tests/it-tracing-client-zipkin/src/test/java/io/helidon/tracing/tests/it1/OpenTraceableClientE2ETest.java index 63e1abed3e6..6874a8b9b89 100644 --- a/tracing/tests/it-tracing-client-zipkin/src/test/java/io/helidon/tracing/tests/it1/OpenTraceableClientE2ETest.java +++ b/tracing/tests/it-tracing-client-zipkin/src/test/java/io/helidon/tracing/tests/it1/OpenTraceableClientE2ETest.java @@ -26,11 +26,11 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.tracing.TracingFeature; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.tracing.TracingFeature; import io.helidon.tracing.Span; import io.helidon.tracing.jersey.client.ClientTracingFilter; import io.helidon.tracing.providers.opentracing.OpenTracing; diff --git a/nima/webclient/README.md b/webclient/README.md similarity index 100% rename from nima/webclient/README.md rename to webclient/README.md diff --git a/webclient/api/etc/spotbugs/exclude.xml b/webclient/api/etc/spotbugs/exclude.xml new file mode 100644 index 00000000000..a1b67149047 --- /dev/null +++ b/webclient/api/etc/spotbugs/exclude.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/webclient/api/pom.xml b/webclient/api/pom.xml new file mode 100644 index 00000000000..90505c70bc5 --- /dev/null +++ b/webclient/api/pom.xml @@ -0,0 +1,156 @@ + + + + 4.0.0 + + io.helidon.webclient + helidon-webclient-project + 4.0.0-SNAPSHOT + + helidon-webclient-api + Helidon WebClient API + + + etc/spotbugs/exclude.xml + + + + + io.helidon.http + helidon-http + + + io.helidon.common + helidon-common-socket + + + io.helidon.common + helidon-common-key-util + + + io.helidon.common + helidon-common-tls + + + io.helidon.common + helidon-common-config + + + io.helidon.http.media + helidon-http-media + + + io.helidon.http.encoding + helidon-http-encoding + + + io.helidon.common + helidon-common-context + + + io.helidon.common.features + helidon-common-features-api + true + + + io.helidon.config + helidon-config-metadata + true + + + io.helidon.builder + helidon-builder-api + + + io.helidon.inject.configdriven + helidon-inject-configdriven-api + true + + + io.helidon.inject.configdriven + helidon-inject-configdriven-runtime + true + + + org.junit.jupiter + junit-jupiter-api + test + + + junit-jupiter-params + org.junit.jupiter + test + + + org.hamcrest + hamcrest-all + test + + + io.helidon.common.testing + helidon-common-testing-http-junit5 + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + io.helidon.builder + helidon-builder-processor + ${helidon.version} + + + io.helidon.inject.configdriven + helidon-inject-configdriven-processor + ${helidon.version} + + + + + + io.helidon.inject.configdriven + helidon-inject-configdriven-processor + ${helidon.version} + + + io.helidon.builder + helidon-builder-processor + ${helidon.version} + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + + + + diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ClientConnection.java b/webclient/api/src/main/java/io/helidon/webclient/api/ClientConnection.java similarity index 97% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ClientConnection.java rename to webclient/api/src/main/java/io/helidon/webclient/api/ClientConnection.java index d725c6cd983..5224b042dfa 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ClientConnection.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/ClientConnection.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; import java.time.Duration; diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ClientRequest.java b/webclient/api/src/main/java/io/helidon/webclient/api/ClientRequest.java similarity index 96% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ClientRequest.java rename to webclient/api/src/main/java/io/helidon/webclient/api/ClientRequest.java index 5cf0ab2a510..236a498bd8c 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ClientRequest.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/ClientRequest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; import java.io.IOException; import java.io.OutputStream; @@ -24,16 +24,16 @@ import java.util.function.Consumer; import io.helidon.common.buffers.BufferData; -import io.helidon.common.http.ClientRequestHeaders; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpException; -import io.helidon.common.http.HttpMediaType; import io.helidon.common.media.type.MediaType; +import io.helidon.common.tls.Tls; import io.helidon.common.uri.UriEncoding; import io.helidon.common.uri.UriFragment; import io.helidon.common.uri.UriInfo; -import io.helidon.nima.common.tls.Tls; +import io.helidon.http.ClientRequestHeaders; +import io.helidon.http.Headers; +import io.helidon.http.Http; +import io.helidon.http.HttpException; +import io.helidon.http.HttpMediaType; /** * Request can be reused within a single thread, but it remembers all explicitly configured headers and URI. @@ -271,7 +271,7 @@ default ClientResponseTyped request(Class type) { * * @param type type of requested entity * @return correctly typed entity - * @throws io.helidon.common.http.HttpException in case the response status is not success + * @throws io.helidon.http.HttpException in case the response status is not success * @param type of the entity to read from the response */ default E requestEntity(Class type) throws HttpException { diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ClientRequestBase.java b/webclient/api/src/main/java/io/helidon/webclient/api/ClientRequestBase.java similarity index 97% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ClientRequestBase.java rename to webclient/api/src/main/java/io/helidon/webclient/api/ClientRequestBase.java index 64875510c5d..bd44cc907ac 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ClientRequestBase.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/ClientRequestBase.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; import java.net.URI; import java.time.Duration; @@ -33,14 +33,14 @@ import io.helidon.common.buffers.BufferData; import io.helidon.common.context.Context; import io.helidon.common.context.Contexts; -import io.helidon.common.http.ClientRequestHeaders; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; +import io.helidon.common.tls.Tls; import io.helidon.common.uri.UriEncoding; import io.helidon.common.uri.UriFragment; -import io.helidon.nima.common.tls.Tls; -import io.helidon.nima.http.media.MediaContext; -import io.helidon.nima.webclient.spi.WebClientService; +import io.helidon.http.ClientRequestHeaders; +import io.helidon.http.Headers; +import io.helidon.http.Http; +import io.helidon.http.media.MediaContext; +import io.helidon.webclient.spi.WebClientService; /** * Abstract base implementation of an HTTP client. Provides helpful methods to handle cookies, client services etc. @@ -412,7 +412,7 @@ protected MediaContext mediaContext() { } /** - * Resolve possible templated URI definition against the provided {@link io.helidon.nima.webclient.api.ClientUri}, + * Resolve possible templated URI definition against the provided {@link ClientUri}, * extracting possible query information into the provided writable query. * * @param toResolve client uri to update from the template diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ClientResponseBase.java b/webclient/api/src/main/java/io/helidon/webclient/api/ClientResponseBase.java similarity index 88% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ClientResponseBase.java rename to webclient/api/src/main/java/io/helidon/webclient/api/ClientResponseBase.java index 936fea8f18c..373fb46dc8f 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ClientResponseBase.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/ClientResponseBase.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; -import io.helidon.common.http.ClientResponseHeaders; -import io.helidon.common.http.Http; +import io.helidon.http.ClientResponseHeaders; +import io.helidon.http.Http; /** * Http client response base. diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ClientResponseEntity.java b/webclient/api/src/main/java/io/helidon/webclient/api/ClientResponseEntity.java similarity index 92% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ClientResponseEntity.java rename to webclient/api/src/main/java/io/helidon/webclient/api/ClientResponseEntity.java index daa6e787ff7..b2812f69cad 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ClientResponseEntity.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/ClientResponseEntity.java @@ -14,17 +14,17 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; import java.util.function.Function; import io.helidon.common.GenericType; import io.helidon.common.buffers.BufferData; -import io.helidon.common.http.ClientRequestHeaders; -import io.helidon.common.http.ClientResponseHeaders; -import io.helidon.nima.http.media.MediaContext; -import io.helidon.nima.http.media.ReadableEntity; -import io.helidon.nima.http.media.ReadableEntityBase; +import io.helidon.http.ClientRequestHeaders; +import io.helidon.http.ClientResponseHeaders; +import io.helidon.http.media.MediaContext; +import io.helidon.http.media.ReadableEntity; +import io.helidon.http.media.ReadableEntityBase; /** * Client response entity. diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ClientResponseTyped.java b/webclient/api/src/main/java/io/helidon/webclient/api/ClientResponseTyped.java similarity index 97% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ClientResponseTyped.java rename to webclient/api/src/main/java/io/helidon/webclient/api/ClientResponseTyped.java index 1f0e36698e1..4601a9991f1 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ClientResponseTyped.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/ClientResponseTyped.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; /** * Http client response explicitly typed. diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ClientResponseTypedImpl.java b/webclient/api/src/main/java/io/helidon/webclient/api/ClientResponseTypedImpl.java similarity index 93% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ClientResponseTypedImpl.java rename to webclient/api/src/main/java/io/helidon/webclient/api/ClientResponseTypedImpl.java index a7a252f3201..32d17af5ef1 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ClientResponseTypedImpl.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/ClientResponseTypedImpl.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; -import io.helidon.common.http.ClientResponseHeaders; -import io.helidon.common.http.Http; +import io.helidon.http.ClientResponseHeaders; +import io.helidon.http.Http; class ClientResponseTypedImpl implements ClientResponseTyped { private final HttpClientResponse response; diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ClientUri.java b/webclient/api/src/main/java/io/helidon/webclient/api/ClientUri.java similarity index 99% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ClientUri.java rename to webclient/api/src/main/java/io/helidon/webclient/api/ClientUri.java index 3fe6d0e839d..583918345c4 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ClientUri.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/ClientUri.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; import java.net.URI; diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ConnectionKey.java b/webclient/api/src/main/java/io/helidon/webclient/api/ConnectionKey.java similarity index 91% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ConnectionKey.java rename to webclient/api/src/main/java/io/helidon/webclient/api/ConnectionKey.java index e1334c97117..3432909dda9 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ConnectionKey.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/ConnectionKey.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; -import io.helidon.nima.common.tls.Tls; -import io.helidon.nima.webclient.spi.DnsResolver; +import io.helidon.common.tls.Tls; +import io.helidon.webclient.spi.DnsResolver; /** * Connection key instance contains all needed connection related information. diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/DefaultAddressLookupFinder.java b/webclient/api/src/main/java/io/helidon/webclient/api/DefaultAddressLookupFinder.java similarity index 98% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/DefaultAddressLookupFinder.java rename to webclient/api/src/main/java/io/helidon/webclient/api/DefaultAddressLookupFinder.java index e7be7ab75cb..3f69a7a873f 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/DefaultAddressLookupFinder.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/DefaultAddressLookupFinder.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; import java.net.Inet6Address; import java.net.InetAddress; diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/DefaultDnsResolver.java b/webclient/api/src/main/java/io/helidon/webclient/api/DefaultDnsResolver.java similarity index 79% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/DefaultDnsResolver.java rename to webclient/api/src/main/java/io/helidon/webclient/api/DefaultDnsResolver.java index 175f3a904eb..63c37b82545 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/DefaultDnsResolver.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/DefaultDnsResolver.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; import java.net.InetAddress; -import io.helidon.nima.webclient.spi.DnsResolver; +import io.helidon.webclient.spi.DnsResolver; /** - * No Nima specific DNS resolver to be used. Connection creation fallbacks to the standard Java approach. + * Default DNS resolver. Connection creation fallbacks to the standard Java approach. * - * @see io.helidon.nima.webclient.api.WebClientConfig.Builder#dnsResolver(io.helidon.nima.webclient.spi.DnsResolver) + * @see io.helidon.webclient.api.WebClientConfig.Builder#dnsResolver(io.helidon.webclient.spi.DnsResolver) */ public final class DefaultDnsResolver implements DnsResolver { diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/DefaultDnsResolverProvider.java b/webclient/api/src/main/java/io/helidon/webclient/api/DefaultDnsResolverProvider.java similarity index 87% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/DefaultDnsResolverProvider.java rename to webclient/api/src/main/java/io/helidon/webclient/api/DefaultDnsResolverProvider.java index fefb011bbee..576f183fb8c 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/DefaultDnsResolverProvider.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/DefaultDnsResolverProvider.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; -import io.helidon.nima.webclient.spi.DnsResolver; -import io.helidon.nima.webclient.spi.DnsResolverProvider; +import io.helidon.webclient.spi.DnsResolver; +import io.helidon.webclient.spi.DnsResolverProvider; /** * Provider of the {@link DefaultDnsResolver} instance. Not looked up by {@link java.util.ServiceLoader}, diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/DnsAddressLookup.java b/webclient/api/src/main/java/io/helidon/webclient/api/DnsAddressLookup.java similarity index 99% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/DnsAddressLookup.java rename to webclient/api/src/main/java/io/helidon/webclient/api/DnsAddressLookup.java index 9431adf40bd..a0521f75f61 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/DnsAddressLookup.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/DnsAddressLookup.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; import java.io.Serializable; import java.net.InetAddress; diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/FullClientRequest.java b/webclient/api/src/main/java/io/helidon/webclient/api/FullClientRequest.java similarity index 95% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/FullClientRequest.java rename to webclient/api/src/main/java/io/helidon/webclient/api/FullClientRequest.java index bcec704af7a..350f4a2e468 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/FullClientRequest.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/FullClientRequest.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; import java.time.Duration; import java.util.Map; import java.util.Optional; -import io.helidon.common.http.Http; -import io.helidon.nima.common.tls.Tls; +import io.helidon.common.tls.Tls; +import io.helidon.http.Http; /** * Client request with getters for all configurable options, used for integration with HTTP version implementations. diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/HttpClient.java b/webclient/api/src/main/java/io/helidon/webclient/api/HttpClient.java similarity index 98% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/HttpClient.java rename to webclient/api/src/main/java/io/helidon/webclient/api/HttpClient.java index 89be8d161ff..288112defbc 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/HttpClient.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/HttpClient.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; -import io.helidon.common.http.Http; +import io.helidon.http.Http; /** * HTTP client. diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/HttpClientConfigBlueprint.java b/webclient/api/src/main/java/io/helidon/webclient/api/HttpClientConfigBlueprint.java similarity index 90% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/HttpClientConfigBlueprint.java rename to webclient/api/src/main/java/io/helidon/webclient/api/HttpClientConfigBlueprint.java index 1942ca49b45..c4ed7263001 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/HttpClientConfigBlueprint.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/HttpClientConfigBlueprint.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; import java.time.Duration; import java.util.List; @@ -24,21 +24,21 @@ import java.util.concurrent.ExecutorService; import io.helidon.builder.api.Prototype; -import io.helidon.common.http.ClientRequestHeaders; -import io.helidon.common.http.Http; -import io.helidon.common.http.WritableHeaders; import io.helidon.common.media.type.ParserMode; import io.helidon.common.socket.SocketOptions; import io.helidon.common.uri.UriFragment; import io.helidon.common.uri.UriQuery; import io.helidon.config.metadata.Configured; import io.helidon.config.metadata.ConfiguredOption; -import io.helidon.nima.http.encoding.ContentEncodingContext; -import io.helidon.nima.http.media.MediaContext; -import io.helidon.nima.http.media.MediaSupport; -import io.helidon.nima.webclient.spi.DnsResolver; -import io.helidon.nima.webclient.spi.WebClientService; -import io.helidon.nima.webclient.spi.WebClientServiceProvider; +import io.helidon.http.ClientRequestHeaders; +import io.helidon.http.Http; +import io.helidon.http.WritableHeaders; +import io.helidon.http.encoding.ContentEncodingContext; +import io.helidon.http.media.MediaContext; +import io.helidon.http.media.MediaSupport; +import io.helidon.webclient.spi.DnsResolver; +import io.helidon.webclient.spi.WebClientService; +import io.helidon.webclient.spi.WebClientServiceProvider; /** * This can be used by any HTTP client version, and does not act as a factory, for easy extensibility. @@ -136,7 +136,7 @@ default ClientRequestHeaders defaultRequestHeaders() { ParserMode mediaTypeParserMode(); /** - * Configure the listener specific {@link io.helidon.nima.http.encoding.ContentEncodingContext}. + * Configure the listener specific {@link io.helidon.http.encoding.ContentEncodingContext}. * This method discards all previously registered ContentEncodingContext. * If no content encoding context is registered, default encoding context is used. * @@ -146,7 +146,7 @@ default ClientRequestHeaders defaultRequestHeaders() { ContentEncodingContext contentEncoding(); /** - * Configure the listener specific {@link io.helidon.nima.http.media.MediaContext}. + * Configure the listener specific {@link io.helidon.http.media.MediaContext}. * This method discards all previously registered MediaContext. * If no media context is registered, default media context is used. * @@ -165,7 +165,7 @@ default ClientRequestHeaders defaultRequestHeaders() { List mediaSupports(); /** - * Web client services. + * WebClient services. * * @return services to use with this web client */ @@ -211,7 +211,7 @@ default ClientRequestHeaders defaultRequestHeaders() { int connectionCacheSize(); /** - * Web client cookie manager. + * WebClient cookie manager. * * @return cookie manager to use */ diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/HttpClientConfigSupport.java b/webclient/api/src/main/java/io/helidon/webclient/api/HttpClientConfigSupport.java similarity index 89% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/HttpClientConfigSupport.java rename to webclient/api/src/main/java/io/helidon/webclient/api/HttpClientConfigSupport.java index 02760c75f6a..97ed8cd579c 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/HttpClientConfigSupport.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/HttpClientConfigSupport.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; import java.net.URI; import java.util.ServiceLoader; @@ -22,13 +22,13 @@ import io.helidon.builder.api.Prototype; import io.helidon.common.HelidonServiceLoader; import io.helidon.common.LazyValue; -import io.helidon.common.http.Http; import io.helidon.common.socket.SocketOptions; -import io.helidon.nima.common.tls.Tls; -import io.helidon.nima.http.encoding.ContentEncodingContext; -import io.helidon.nima.http.media.MediaContext; -import io.helidon.nima.webclient.spi.DnsResolver; -import io.helidon.nima.webclient.spi.DnsResolverProvider; +import io.helidon.common.tls.Tls; +import io.helidon.http.Http; +import io.helidon.http.encoding.ContentEncodingContext; +import io.helidon.http.media.MediaContext; +import io.helidon.webclient.spi.DnsResolver; +import io.helidon.webclient.spi.DnsResolverProvider; class HttpClientConfigSupport { private static final LazyValue EMPTY_TLS = LazyValue.create(() -> Tls.builder().build()); @@ -103,13 +103,13 @@ static void addHeader(HttpClientConfig.BuilderBase builder, Http.HeaderNam /** * Add default header value. This method is not optimal and should only be used when the header name is really - * obtained from a string, in other cases, use an alternative with {@link io.helidon.common.http.Http.HeaderName} - * or {@link io.helidon.common.http.Http.Header}. + * obtained from a string, in other cases, use an alternative with {@link io.helidon.http.Http.HeaderName} + * or {@link io.helidon.http.Http.Header}. * * @param builder builder to update * @param name name of the header * @param value value of the header - * @see #addHeader(io.helidon.common.http.Http.Header) + * @see #addHeader(io.helidon.http.Http.Header) */ @Prototype.BuilderMethod static void addHeader(HttpClientConfig.BuilderBase builder, String name, String value) { @@ -118,13 +118,13 @@ static void addHeader(HttpClientConfig.BuilderBase builder, String name, S /** * Add default header value. This method is not optimal and should only be used when the header name is really - * obtained from a string, in other cases, use an alternative with {@link io.helidon.common.http.Http.HeaderName} - * or {@link io.helidon.common.http.Http.Header}. + * obtained from a string, in other cases, use an alternative with {@link io.helidon.http.Http.HeaderName} + * or {@link io.helidon.http.Http.Header}. * * @param builder builder to update * @param name name of the header * @param value value of the header - * @see #addHeader(io.helidon.common.http.Http.Header) + * @see #addHeader(io.helidon.http.Http.Header) */ @Prototype.BuilderMethod static void addHeader(HttpClientConfig.BuilderBase builder, String name, int value) { @@ -133,13 +133,13 @@ static void addHeader(HttpClientConfig.BuilderBase builder, String name, i /** * Add default header value. This method is not optimal and should only be used when the header name is really - * obtained from a string, in other cases, use an alternative with {@link io.helidon.common.http.Http.HeaderName} - * or {@link io.helidon.common.http.Http.Header}. + * obtained from a string, in other cases, use an alternative with {@link io.helidon.http.Http.HeaderName} + * or {@link io.helidon.http.Http.Header}. * * @param builder builder to update * @param name name of the header * @param value value of the header - * @see #addHeader(io.helidon.common.http.Http.Header) + * @see #addHeader(io.helidon.http.Http.Header) */ @Prototype.BuilderMethod static void addHeader(HttpClientConfig.BuilderBase builder, String name, long value) { diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/HttpClientRequest.java b/webclient/api/src/main/java/io/helidon/webclient/api/HttpClientRequest.java similarity index 91% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/HttpClientRequest.java rename to webclient/api/src/main/java/io/helidon/webclient/api/HttpClientRequest.java index 41600e44fc4..d3882188af7 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/HttpClientRequest.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/HttpClientRequest.java @@ -14,18 +14,17 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; import java.util.List; import java.util.Map; import java.util.Optional; import io.helidon.common.configurable.LruCache; -import io.helidon.common.http.Http; import io.helidon.common.socket.HelidonSocket; -import io.helidon.nima.common.tls.Tls; -import io.helidon.nima.webclient.api.LoomClient.ProtocolSpi; -import io.helidon.nima.webclient.spi.HttpClientSpi; +import io.helidon.common.tls.Tls; +import io.helidon.http.Http; +import io.helidon.webclient.spi.HttpClientSpi; /** * Client request of any client that support HTTP protocol. @@ -37,19 +36,19 @@ public class HttpClientRequest extends ClientRequestBase clientSpiCache = LruCache.create(); private final WebClient webClient; - private final Map clients; - private final List tcpProtocols; + private final Map clients; + private final List tcpProtocols; private final List tcpProtocolIds; - private final List protocols; + private final List protocols; private String preferredProtocolId; HttpClientRequest(WebClient webClient, WebClientConfig clientConfig, Http.Method method, ClientUri clientUri, - Map protocolsToClients, - List protocols, - List tcpProtocols, + Map protocolsToClients, + List protocols, + List tcpProtocols, List tcpProtocolIds) { super(clientConfig, webClient.cookieManager(), "any", method, clientUri, clientConfig.properties()); this.webClient = webClient; @@ -91,7 +90,7 @@ private ClientRequest discoverHttpImplementation() { /* Explicit protocol id specified for this very request - we must honor it */ - ProtocolSpi httpClientSpi = clients.get(preferredProtocolId); + LoomClient.ProtocolSpi httpClientSpi = clients.get(preferredProtocolId); if (httpClientSpi == null) { throw new IllegalArgumentException("Requested protocol with id \"" + preferredProtocolId + "\", which is not " + "available on classpath. Available protocols: " + clients.keySet()); @@ -114,7 +113,7 @@ private ClientRequest discoverHttpImplementation() { // now use the first protocol that supports the request without condition, store first compatible HttpClientSpi compatible = null; HttpClientSpi unknown = null; - for (ProtocolSpi protocol : protocols) { + for (LoomClient.ProtocolSpi protocol : protocols) { // must iterate through list, to maintain weighted ordering HttpClientSpi client = protocol.spi(); @@ -152,7 +151,7 @@ private ClientRequest discoverHttpImplementation() { HelidonSocket socket = connection.helidonSocket(); if (socket.protocolNegotiated()) { String negotiatedProtocol = socket.protocol(); - ProtocolSpi protocolSpi = clients.get(negotiatedProtocol); + LoomClient.ProtocolSpi protocolSpi = clients.get(negotiatedProtocol); if (protocolSpi == null) { if (LOGGER.isLoggable(System.Logger.Level.TRACE)) { LOGGER.log(System.Logger.Level.TRACE, "Attempted to negotiate a protocol (" + tcpProtocolIds + "), " diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/HttpClientResponse.java b/webclient/api/src/main/java/io/helidon/webclient/api/HttpClientResponse.java similarity index 90% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/HttpClientResponse.java rename to webclient/api/src/main/java/io/helidon/webclient/api/HttpClientResponse.java index b63a63d1508..8fa87dfcde2 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/HttpClientResponse.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/HttpClientResponse.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; import java.io.InputStream; import io.helidon.common.GenericType; -import io.helidon.nima.http.media.ReadableEntity; -import io.helidon.nima.webclient.spi.Source; +import io.helidon.http.media.ReadableEntity; +import io.helidon.webclient.spi.Source; /** * Http client response. @@ -35,7 +35,7 @@ public interface HttpClientResponse extends AutoCloseable, ClientResponseBase { /** * Entity input stream. - * This is a shortcut to {@link #entity()} and {@link io.helidon.nima.http.media.ReadableEntity#inputStream()}. + * This is a shortcut to {@link #entity()} and {@link io.helidon.http.media.ReadableEntity#inputStream()}. * * @return input stream */ @@ -45,7 +45,7 @@ default InputStream inputStream() { /** * Read the entity as a specific type. - * This is a shortcut to {@link #entity()} and {@link io.helidon.nima.http.media.ReadableEntity#as(Class)}. + * This is a shortcut to {@link #entity()} and {@link io.helidon.http.media.ReadableEntity#as(Class)}. * * @param type class of the entity * @param type of the entity diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/HttpConfigBaseBlueprint.java b/webclient/api/src/main/java/io/helidon/webclient/api/HttpConfigBaseBlueprint.java similarity index 97% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/HttpConfigBaseBlueprint.java rename to webclient/api/src/main/java/io/helidon/webclient/api/HttpConfigBaseBlueprint.java index e5b38b86e3c..c992e34d56e 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/HttpConfigBaseBlueprint.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/HttpConfigBaseBlueprint.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; import java.time.Duration; import java.util.Map; import java.util.Optional; import io.helidon.builder.api.Prototype; +import io.helidon.common.tls.Tls; import io.helidon.config.metadata.Configured; import io.helidon.config.metadata.ConfiguredOption; -import io.helidon.nima.common.tls.Tls; /** * Common configuration for HTTP protocols. diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/LoomClient.java b/webclient/api/src/main/java/io/helidon/webclient/api/LoomClient.java similarity index 95% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/LoomClient.java rename to webclient/api/src/main/java/io/helidon/webclient/api/LoomClient.java index e96591b7b54..b83dbb30d82 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/LoomClient.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/LoomClient.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; import java.util.ArrayList; import java.util.HashMap; @@ -27,13 +27,13 @@ import io.helidon.common.HelidonServiceLoader; import io.helidon.common.LazyValue; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.inject.configdriven.api.ConfigDriven; -import io.helidon.nima.webclient.spi.ClientProtocolProvider; -import io.helidon.nima.webclient.spi.HttpClientSpi; -import io.helidon.nima.webclient.spi.HttpClientSpiProvider; -import io.helidon.nima.webclient.spi.Protocol; -import io.helidon.nima.webclient.spi.ProtocolConfig; +import io.helidon.webclient.spi.ClientProtocolProvider; +import io.helidon.webclient.spi.HttpClientSpi; +import io.helidon.webclient.spi.HttpClientSpiProvider; +import io.helidon.webclient.spi.Protocol; +import io.helidon.webclient.spi.ProtocolConfig; import jakarta.inject.Inject; diff --git a/webclient/api/src/main/java/io/helidon/webclient/api/ProtocolConfigs.java b/webclient/api/src/main/java/io/helidon/webclient/api/ProtocolConfigs.java new file mode 100644 index 00000000000..655611f6c69 --- /dev/null +++ b/webclient/api/src/main/java/io/helidon/webclient/api/ProtocolConfigs.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.webclient.api; + +import java.util.List; +import java.util.Objects; +import java.util.function.Supplier; + +import io.helidon.webclient.spi.ProtocolConfig; + +/** + * Protocol configuration to obtain explicitly configured details for the current socket. + */ +class ProtocolConfigs { + private final List protocolConfigs; + + private ProtocolConfigs(List protocolConfigs) { + this.protocolConfigs = List.copyOf(protocolConfigs); + } + + /** + * Create new protocol configuration handler. + * + * @param protocolConfigs all available protocol configurations. + * @return protocol configuration handler + */ + public static ProtocolConfigs create(List protocolConfigs) { + Objects.requireNonNull(protocolConfigs); + return new ProtocolConfigs(protocolConfigs); + } + + /** + * Get a protocol configuration if defined. + * + * @param protocolType type of the protocol, to distinguish between protocols + * (two protocols may use the same configuration class) + * @param protocolConfigType type of the expected configuration (same protocol type may use different configuration + * class) + * @param type of the expected protocol configuration + * @return protocol configuration(s) to use, if empty, this protocol should not be used + */ + public T config(String protocolType, + Class protocolConfigType, + Supplier defaultConfigSupplier) { + Objects.requireNonNull(protocolType); + Objects.requireNonNull(protocolConfigType); + + return protocolConfigs.stream() + .filter(it -> protocolType.equals(it.type())) + .filter(it -> protocolConfigType.isAssignableFrom(it.getClass())) + .map(protocolConfigType::cast) + .findFirst() + .orElseGet(defaultConfigSupplier); + } +} diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/Proxy.java b/webclient/api/src/main/java/io/helidon/webclient/api/Proxy.java similarity index 99% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/Proxy.java rename to webclient/api/src/main/java/io/helidon/webclient/api/Proxy.java index 4c225a8bf58..84af190e638 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/Proxy.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/Proxy.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; import java.io.IOException; import java.io.UncheckedIOException; @@ -40,13 +40,13 @@ import io.helidon.common.config.Config; import io.helidon.common.configurable.LruCache; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderNames; import io.helidon.common.media.type.MediaTypes; import io.helidon.common.socket.SocketOptions; +import io.helidon.common.tls.Tls; import io.helidon.config.metadata.Configured; import io.helidon.config.metadata.ConfiguredOption; -import io.helidon.nima.common.tls.Tls; +import io.helidon.http.Http; +import io.helidon.http.Http.HeaderNames; /** * A definition of a proxy server to use for outgoing requests. diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ReleasableResource.java b/webclient/api/src/main/java/io/helidon/webclient/api/ReleasableResource.java similarity index 96% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ReleasableResource.java rename to webclient/api/src/main/java/io/helidon/webclient/api/ReleasableResource.java index ae65de5aff6..b27b782ba76 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ReleasableResource.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/ReleasableResource.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; /** * A resource that can be released or closed. diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/RuntimeUnknownHostException.java b/webclient/api/src/main/java/io/helidon/webclient/api/RuntimeUnknownHostException.java similarity index 96% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/RuntimeUnknownHostException.java rename to webclient/api/src/main/java/io/helidon/webclient/api/RuntimeUnknownHostException.java index 65fe6d2b386..dbd8c3dacd9 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/RuntimeUnknownHostException.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/RuntimeUnknownHostException.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; import java.net.UnknownHostException; diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ServiceChainImpl.java b/webclient/api/src/main/java/io/helidon/webclient/api/ServiceChainImpl.java similarity index 91% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ServiceChainImpl.java rename to webclient/api/src/main/java/io/helidon/webclient/api/ServiceChainImpl.java index 5e152aa7b11..9652a82497d 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ServiceChainImpl.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/ServiceChainImpl.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; -import io.helidon.nima.webclient.spi.WebClientService; +import io.helidon.webclient.spi.WebClientService; class ServiceChainImpl implements WebClientService.Chain { private final WebClientService.Chain next; diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ServiceRequestImpl.java b/webclient/api/src/main/java/io/helidon/webclient/api/ServiceRequestImpl.java similarity index 95% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ServiceRequestImpl.java rename to webclient/api/src/main/java/io/helidon/webclient/api/ServiceRequestImpl.java index fe49c32d957..c9b0fd4d965 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/ServiceRequestImpl.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/ServiceRequestImpl.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; import java.util.HashMap; import java.util.Map; import java.util.concurrent.CompletionStage; import io.helidon.common.context.Context; -import io.helidon.common.http.ClientRequestHeaders; -import io.helidon.common.http.Http; +import io.helidon.http.ClientRequestHeaders; +import io.helidon.http.Http; class ServiceRequestImpl implements WebClientServiceRequest { private final Map properties; diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/TcpClientConnection.java b/webclient/api/src/main/java/io/helidon/webclient/api/TcpClientConnection.java similarity index 98% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/TcpClientConnection.java rename to webclient/api/src/main/java/io/helidon/webclient/api/TcpClientConnection.java index bc99bbe114c..76746e0c011 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/TcpClientConnection.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/TcpClientConnection.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; import java.io.IOException; import java.io.UncheckedIOException; @@ -40,8 +40,8 @@ import io.helidon.common.socket.HelidonSocket; import io.helidon.common.socket.PlainSocket; import io.helidon.common.socket.TlsSocket; -import io.helidon.nima.common.tls.Tls; -import io.helidon.nima.webclient.spi.DnsResolver; +import io.helidon.common.tls.Tls; +import io.helidon.webclient.spi.DnsResolver; import static java.lang.System.Logger.Level.DEBUG; import static java.lang.System.Logger.Level.TRACE; diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/WebClient.java b/webclient/api/src/main/java/io/helidon/webclient/api/WebClient.java similarity index 96% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/WebClient.java rename to webclient/api/src/main/java/io/helidon/webclient/api/WebClient.java index e1f3bc1ea99..147ba35891d 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/WebClient.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/WebClient.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; import java.util.concurrent.ExecutorService; import java.util.function.Consumer; import io.helidon.builder.api.RuntimeType; -import io.helidon.nima.webclient.spi.Protocol; -import io.helidon.nima.webclient.spi.ProtocolConfig; +import io.helidon.webclient.spi.Protocol; +import io.helidon.webclient.spi.ProtocolConfig; /** * HTTP client. diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/WebClientConfigBlueprint.java b/webclient/api/src/main/java/io/helidon/webclient/api/WebClientConfigBlueprint.java similarity index 91% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/WebClientConfigBlueprint.java rename to webclient/api/src/main/java/io/helidon/webclient/api/WebClientConfigBlueprint.java index 64e7ff40e09..7ced8e55e48 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/WebClientConfigBlueprint.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/WebClientConfigBlueprint.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; import java.util.List; @@ -22,11 +22,11 @@ import io.helidon.config.metadata.Configured; import io.helidon.config.metadata.ConfiguredOption; import io.helidon.inject.configdriven.api.ConfigBean; -import io.helidon.nima.webclient.spi.ProtocolConfig; -import io.helidon.nima.webclient.spi.ProtocolConfigProvider; +import io.helidon.webclient.spi.ProtocolConfig; +import io.helidon.webclient.spi.ProtocolConfigProvider; /** - * Web client configuration. + * WebClient configuration. */ @Configured(root = true, prefix = "clients") @ConfigBean(repeatable = true, wantDefault = true) diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/WebClientCookieManager.java b/webclient/api/src/main/java/io/helidon/webclient/api/WebClientCookieManager.java similarity index 96% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/WebClientCookieManager.java rename to webclient/api/src/main/java/io/helidon/webclient/api/WebClientCookieManager.java index b05b9327deb..df13b9ff51c 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/WebClientCookieManager.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/WebClientCookieManager.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; import java.io.IOException; import java.io.UncheckedIOException; @@ -26,12 +26,12 @@ import java.util.function.Consumer; import io.helidon.builder.api.RuntimeType; -import io.helidon.common.http.ClientRequestHeaders; -import io.helidon.common.http.ClientResponseHeaders; -import io.helidon.common.http.Http; +import io.helidon.http.ClientRequestHeaders; +import io.helidon.http.ClientResponseHeaders; +import io.helidon.http.Http; /** - * Helidon Web Client cookie manager. + * Helidon WebClient cookie manager. */ @RuntimeType.PrototypedBy(WebClientCookieManagerConfig.class) public class WebClientCookieManager extends CookieManager implements RuntimeType.Api { diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/WebClientCookieManagerConfigBlueprint.java b/webclient/api/src/main/java/io/helidon/webclient/api/WebClientCookieManagerConfigBlueprint.java similarity index 97% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/WebClientCookieManagerConfigBlueprint.java rename to webclient/api/src/main/java/io/helidon/webclient/api/WebClientCookieManagerConfigBlueprint.java index 750a8b88413..31987670840 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/WebClientCookieManagerConfigBlueprint.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/WebClientCookieManagerConfigBlueprint.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; import java.net.CookiePolicy; import java.net.CookieStore; diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/WebClientServiceRequest.java b/webclient/api/src/main/java/io/helidon/webclient/api/WebClientServiceRequest.java similarity index 88% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/WebClientServiceRequest.java rename to webclient/api/src/main/java/io/helidon/webclient/api/WebClientServiceRequest.java index 4cc5ac4ad0a..3635bebc9b1 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/WebClientServiceRequest.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/WebClientServiceRequest.java @@ -14,17 +14,17 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; import java.util.Map; import java.util.concurrent.CompletionStage; import io.helidon.common.context.Context; -import io.helidon.common.http.ClientRequestHeaders; -import io.helidon.common.http.Http; +import io.helidon.http.ClientRequestHeaders; +import io.helidon.http.Http; /** - * Request to SPI {@link io.helidon.nima.webclient.spi.WebClientService} that supports modification of the outgoing request. + * Request to SPI {@link io.helidon.webclient.spi.WebClientService} that supports modification of the outgoing request. */ public interface WebClientServiceRequest { /** @@ -35,10 +35,10 @@ public interface WebClientServiceRequest { ClientUri uri(); /** - * Returns an HTTP request method. See also {@link io.helidon.common.http.Http.Method HTTP standard methods} utility class. + * Returns an HTTP request method. See also {@link io.helidon.http.Http.Method HTTP standard methods} utility class. * * @return an HTTP method - * @see io.helidon.common.http.Http.Method + * @see io.helidon.http.Http.Method */ Http.Method method(); diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/WebClientServiceResponseBlueprint.java b/webclient/api/src/main/java/io/helidon/webclient/api/WebClientServiceResponseBlueprint.java similarity index 94% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/WebClientServiceResponseBlueprint.java rename to webclient/api/src/main/java/io/helidon/webclient/api/WebClientServiceResponseBlueprint.java index 74bf3c1924b..e1647b187c0 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/api/WebClientServiceResponseBlueprint.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/WebClientServiceResponseBlueprint.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; import java.io.InputStream; import java.util.Optional; import java.util.concurrent.CompletableFuture; import io.helidon.builder.api.Prototype; -import io.helidon.common.http.ClientResponseHeaders; -import io.helidon.common.http.Http; +import io.helidon.http.ClientResponseHeaders; +import io.helidon.http.Http; /** * Response which is created upon receiving of server response. diff --git a/webclient/api/src/main/java/io/helidon/webclient/api/package-info.java b/webclient/api/src/main/java/io/helidon/webclient/api/package-info.java new file mode 100644 index 00000000000..2c09f374741 --- /dev/null +++ b/webclient/api/src/main/java/io/helidon/webclient/api/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebClient APIs shared by all types of clients. + */ +package io.helidon.webclient.api; diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/ClientProtocolProvider.java b/webclient/api/src/main/java/io/helidon/webclient/spi/ClientProtocolProvider.java similarity index 88% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/ClientProtocolProvider.java rename to webclient/api/src/main/java/io/helidon/webclient/spi/ClientProtocolProvider.java index b2d39d8393a..14e8aa4748a 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/ClientProtocolProvider.java +++ b/webclient/api/src/main/java/io/helidon/webclient/spi/ClientProtocolProvider.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.helidon.nima.webclient.spi; +package io.helidon.webclient.spi; -import io.helidon.nima.webclient.api.WebClient; +import io.helidon.webclient.api.WebClient; /** * Provider interface for client protocols. - * HTTP protocols need to also implement {@link io.helidon.nima.webclient.spi.HttpClientSpiProvider} to + * HTTP protocols need to also implement {@link HttpClientSpiProvider} to * be available through the unified HTTP client API. * * @param type of protocol diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/DnsResolver.java b/webclient/api/src/main/java/io/helidon/webclient/spi/DnsResolver.java similarity index 88% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/DnsResolver.java rename to webclient/api/src/main/java/io/helidon/webclient/spi/DnsResolver.java index c00cee313f9..ba376096af3 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/DnsResolver.java +++ b/webclient/api/src/main/java/io/helidon/webclient/spi/DnsResolver.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.helidon.nima.webclient.spi; +package io.helidon.webclient.spi; import java.net.InetAddress; -import io.helidon.nima.webclient.api.DnsAddressLookup; +import io.helidon.webclient.api.DnsAddressLookup; /** * DNS resolving interface. @@ -27,7 +27,7 @@ public interface DnsResolver { /** * Whether to use standard Java DNS resolver. - * If this method returns true, {@link #resolveAddress(String, io.helidon.nima.webclient.api.DnsAddressLookup)} method is not invoked and + * If this method returns true, {@link #resolveAddress(String, io.helidon.webclient.api.DnsAddressLookup)} method is not invoked and * no {@link DnsAddressLookup} preferences will be applied. * * @return use standard Java resolver diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/DnsResolverProvider.java b/webclient/api/src/main/java/io/helidon/webclient/spi/DnsResolverProvider.java similarity index 96% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/DnsResolverProvider.java rename to webclient/api/src/main/java/io/helidon/webclient/spi/DnsResolverProvider.java index e4ae75feafe..bc082979d4e 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/DnsResolverProvider.java +++ b/webclient/api/src/main/java/io/helidon/webclient/spi/DnsResolverProvider.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.spi; +package io.helidon.webclient.spi; /** * Provider interface for custom DNS resolvers. diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/HttpClientSpi.java b/webclient/api/src/main/java/io/helidon/webclient/spi/HttpClientSpi.java similarity index 90% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/HttpClientSpi.java rename to webclient/api/src/main/java/io/helidon/webclient/spi/HttpClientSpi.java index 1377b3f43ff..3956badc3d8 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/HttpClientSpi.java +++ b/webclient/api/src/main/java/io/helidon/webclient/spi/HttpClientSpi.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.helidon.nima.webclient.spi; +package io.helidon.webclient.spi; -import io.helidon.nima.webclient.api.ClientRequest; -import io.helidon.nima.webclient.api.ClientUri; -import io.helidon.nima.webclient.api.FullClientRequest; +import io.helidon.webclient.api.ClientRequest; +import io.helidon.webclient.api.ClientUri; +import io.helidon.webclient.api.FullClientRequest; /** * Integration for HTTP versions to provide a single API. @@ -39,9 +39,9 @@ public interface HttpClientSpi { * So how can we get to HTTP/2 with prior knowledge, or HTTP/3? There are the following options: *

      *
    • An explicit protocol id is configured for the request - - * {@link io.helidon.nima.webclient.api.HttpClientRequest#protocolId(String)}
    • + * {@link io.helidon.webclient.api.HttpClientRequest#protocolId(String)} *
    • There is no fallback protocol enabled, in such a case, we use the one with highest priority - see - * {@link io.helidon.nima.webclient.api.WebClientConfig.Builder#addProtocolPreference(String)}
    • + * {@link io.helidon.webclient.api.WebClientConfig.Builder#addProtocolPreference(String)} *
    • We get an {@code Alt-Svc} header from a response that points us to a protocol version (we only support permanent * protocol changes, {@code Alt-Svc} with timeout will be ignored
    • *
    • This protocol version already handled a request to such an endpoint and has the connection available
    • diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/HttpClientSpiProvider.java b/webclient/api/src/main/java/io/helidon/webclient/spi/HttpClientSpiProvider.java similarity index 95% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/HttpClientSpiProvider.java rename to webclient/api/src/main/java/io/helidon/webclient/spi/HttpClientSpiProvider.java index b2327f1063a..6c23f023b81 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/HttpClientSpiProvider.java +++ b/webclient/api/src/main/java/io/helidon/webclient/spi/HttpClientSpiProvider.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.spi; +package io.helidon.webclient.spi; /** * A {@link java.util.ServiceLoader} provider interface to obtain clients that support HTTP protocol. diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/Protocol.java b/webclient/api/src/main/java/io/helidon/webclient/spi/Protocol.java similarity index 95% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/Protocol.java rename to webclient/api/src/main/java/io/helidon/webclient/spi/Protocol.java index 0338418479e..c09b8a2c131 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/Protocol.java +++ b/webclient/api/src/main/java/io/helidon/webclient/spi/Protocol.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.spi; +package io.helidon.webclient.spi; /** * Client protocol. diff --git a/webclient/api/src/main/java/io/helidon/webclient/spi/ProtocolConfig.java b/webclient/api/src/main/java/io/helidon/webclient/spi/ProtocolConfig.java new file mode 100644 index 00000000000..6101c6938cc --- /dev/null +++ b/webclient/api/src/main/java/io/helidon/webclient/spi/ProtocolConfig.java @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.webclient.spi; + +import io.helidon.common.config.NamedService; + +/** + * Client protocol configuration. + */ +public interface ProtocolConfig extends NamedService { +} diff --git a/webclient/api/src/main/java/io/helidon/webclient/spi/ProtocolConfigProvider.java b/webclient/api/src/main/java/io/helidon/webclient/spi/ProtocolConfigProvider.java new file mode 100644 index 00000000000..b124fb492b3 --- /dev/null +++ b/webclient/api/src/main/java/io/helidon/webclient/spi/ProtocolConfigProvider.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.webclient.spi; + +import io.helidon.common.config.ConfiguredProvider; + +/** + * Client protocol configuration. + * + * @param type of configuration supported by this provider + */ +public interface ProtocolConfigProvider extends ConfiguredProvider { +} diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/Source.java b/webclient/api/src/main/java/io/helidon/webclient/spi/Source.java similarity index 96% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/Source.java rename to webclient/api/src/main/java/io/helidon/webclient/spi/Source.java index a7784fe7068..a407c10e601 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/Source.java +++ b/webclient/api/src/main/java/io/helidon/webclient/spi/Source.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.spi; +package io.helidon.webclient.spi; /** * A listener for arbitrary events. diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/SourceHandlerProvider.java b/webclient/api/src/main/java/io/helidon/webclient/spi/SourceHandlerProvider.java similarity index 90% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/SourceHandlerProvider.java rename to webclient/api/src/main/java/io/helidon/webclient/spi/SourceHandlerProvider.java index f7f44793b1c..8c9709162c4 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/SourceHandlerProvider.java +++ b/webclient/api/src/main/java/io/helidon/webclient/spi/SourceHandlerProvider.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.helidon.nima.webclient.spi; +package io.helidon.webclient.spi; import io.helidon.common.GenericType; -import io.helidon.nima.http.media.MediaContext; -import io.helidon.nima.webclient.api.HttpClientResponse; +import io.helidon.http.media.MediaContext; +import io.helidon.webclient.api.HttpClientResponse; /** * {@link java.util.ServiceLoader} provider interface for {@link Source} handlers. diff --git a/webclient/api/src/main/java/io/helidon/webclient/spi/WebClientService.java b/webclient/api/src/main/java/io/helidon/webclient/spi/WebClientService.java new file mode 100644 index 00000000000..a70c510208a --- /dev/null +++ b/webclient/api/src/main/java/io/helidon/webclient/spi/WebClientService.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.webclient.spi; + + +import io.helidon.common.config.NamedService; +import io.helidon.webclient.api.WebClientServiceRequest; +import io.helidon.webclient.api.WebClientServiceResponse; + +/** + * Extension that can modify web client behavior. + * This is now only designed for HTTP/1 + */ +@FunctionalInterface +public interface WebClientService extends NamedService { + @Override + default String name() { + return "@default"; + } + + @Override + default String type() { + return "inlined-service"; + } + + /** + * Invoke a service, call {@link Chain#proceed(io.helidon.webclient.api.WebClientServiceRequest)} to call the + * next service in the chain. + * + * @param chain to invoke next web client service, or the HTTP call if this is the last service + * @param clientRequest request from the client, or previous services + * @return response to be returned to the client + */ + WebClientServiceResponse handle(Chain chain, WebClientServiceRequest clientRequest); + + /** + * Chain of services. + */ + interface Chain { + /** + * Proceed with invocation of the next service, or the HTTP call. + * This method is always fully blocking. + * + * @param clientRequest request + * @return response from the next service or HTTP call + */ + WebClientServiceResponse proceed(WebClientServiceRequest clientRequest); + } +} diff --git a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/WebClientServiceProvider.java b/webclient/api/src/main/java/io/helidon/webclient/spi/WebClientServiceProvider.java similarity index 95% rename from nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/WebClientServiceProvider.java rename to webclient/api/src/main/java/io/helidon/webclient/spi/WebClientServiceProvider.java index 4959d4d5a8c..cf26d51f9fd 100644 --- a/nima/webclient/api/src/main/java/io/helidon/nima/webclient/spi/WebClientServiceProvider.java +++ b/webclient/api/src/main/java/io/helidon/webclient/spi/WebClientServiceProvider.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.spi; +package io.helidon.webclient.spi; import io.helidon.common.config.ConfiguredProvider; diff --git a/webclient/api/src/main/java/io/helidon/webclient/spi/package-info.java b/webclient/api/src/main/java/io/helidon/webclient/spi/package-info.java new file mode 100644 index 00000000000..d6b97b2e7ad --- /dev/null +++ b/webclient/api/src/main/java/io/helidon/webclient/spi/package-info.java @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebClient SPI. + * Interfaces to be implemented by new clients. + * These do not use {@link java.util.ServiceLoader}. + */ +package io.helidon.webclient.spi; diff --git a/webclient/api/src/main/java/module-info.java b/webclient/api/src/main/java/module-info.java new file mode 100644 index 00000000000..80d47956383 --- /dev/null +++ b/webclient/api/src/main/java/module-info.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.common.features.api.Feature; +import io.helidon.common.features.api.HelidonFlavor; +import io.helidon.webclient.spi.DnsResolverProvider; +import io.helidon.webclient.spi.HttpClientSpiProvider; +import io.helidon.webclient.spi.ProtocolConfigProvider; +import io.helidon.webclient.spi.SourceHandlerProvider; +import io.helidon.webclient.spi.WebClientServiceProvider; + +/** + * Helidon WebClient API. + */ +@Feature(value = "WebClient", + description = "WebClient", + in = HelidonFlavor.SE, + path = "WebClient" +) +module io.helidon.webclient.api { + // @Feature + requires static io.helidon.common.features.api; + // @ConfiguredOption etc + requires static io.helidon.config.metadata; + requires static io.helidon.inject.configdriven.api; + requires static io.helidon.inject.configdriven.runtime; + // Injection support + requires static jakarta.inject; + + // @Builder - interfaces are a runtime dependency + requires io.helidon.builder.api; + + requires transitive io.helidon.common; + requires transitive io.helidon.common.context; + requires transitive io.helidon.http; + requires transitive io.helidon.common.configurable; + requires transitive io.helidon.common.socket; + requires transitive io.helidon.common.uri; + requires transitive io.helidon.common.tls; + requires transitive io.helidon.http.encoding; + requires transitive io.helidon.http.media; + requires transitive io.helidon.common.config; + + exports io.helidon.webclient.api; + exports io.helidon.webclient.spi; + + uses DnsResolverProvider; + uses SourceHandlerProvider; + uses WebClientServiceProvider; + uses ProtocolConfigProvider; + uses HttpClientSpiProvider; +} diff --git a/nima/webclient/api/src/test/java/io/helidon/nima/webclient/api/ClientUriTest.java b/webclient/api/src/test/java/io/helidon/webclient/api/ClientUriTest.java similarity index 99% rename from nima/webclient/api/src/test/java/io/helidon/nima/webclient/api/ClientUriTest.java rename to webclient/api/src/test/java/io/helidon/webclient/api/ClientUriTest.java index 182c63672f1..9619297d4ce 100644 --- a/nima/webclient/api/src/test/java/io/helidon/nima/webclient/api/ClientUriTest.java +++ b/webclient/api/src/test/java/io/helidon/webclient/api/ClientUriTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; import java.net.URI; diff --git a/nima/webclient/api/src/test/java/io/helidon/nima/webclient/api/HttpClientTest.java b/webclient/api/src/test/java/io/helidon/webclient/api/HttpClientTest.java similarity index 97% rename from nima/webclient/api/src/test/java/io/helidon/nima/webclient/api/HttpClientTest.java rename to webclient/api/src/test/java/io/helidon/webclient/api/HttpClientTest.java index e6f487e98ee..a6f2d429d9e 100644 --- a/nima/webclient/api/src/test/java/io/helidon/nima/webclient/api/HttpClientTest.java +++ b/webclient/api/src/test/java/io/helidon/webclient/api/HttpClientTest.java @@ -14,18 +14,18 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; import java.net.URI; import java.time.Duration; import java.util.Map; import java.util.function.Consumer; -import io.helidon.common.http.ClientRequestHeaders; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; +import io.helidon.http.ClientRequestHeaders; +import io.helidon.http.Headers; +import io.helidon.http.Http; import io.helidon.common.uri.UriFragment; -import io.helidon.nima.common.tls.Tls; +import io.helidon.common.tls.Tls; import org.junit.jupiter.api.Test; diff --git a/nima/webclient/api/src/test/java/io/helidon/nima/webclient/api/ProxyTest.java b/webclient/api/src/test/java/io/helidon/webclient/api/ProxyTest.java similarity index 95% rename from nima/webclient/api/src/test/java/io/helidon/nima/webclient/api/ProxyTest.java rename to webclient/api/src/test/java/io/helidon/webclient/api/ProxyTest.java index 93e3ec181a2..7637970ded8 100644 --- a/nima/webclient/api/src/test/java/io/helidon/nima/webclient/api/ProxyTest.java +++ b/webclient/api/src/test/java/io/helidon/webclient/api/ProxyTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.api; +package io.helidon.webclient.api; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; @@ -23,9 +23,6 @@ import java.util.Set; import java.util.function.Function; -import io.helidon.nima.webclient.api.ClientUri; -import io.helidon.nima.webclient.api.Proxy; - import org.junit.jupiter.api.Test; class ProxyTest { diff --git a/webclient/dns-resolver/first/pom.xml b/webclient/dns-resolver/first/pom.xml new file mode 100644 index 00000000000..ffd5251b82f --- /dev/null +++ b/webclient/dns-resolver/first/pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + io.helidon.webclient.dns.resolver + helidon-webclient-dns-resolver-project + 4.0.0-SNAPSHOT + + + helidon-webclient-dns-resolver-first + Helidon WebClient DNS Resolver First + DNS resolver that uses the first address from DNS lookup + + + + io.helidon.webclient + helidon-webclient-api + + + org.junit.jupiter + junit-jupiter-api + test + + + diff --git a/nima/webclient/dns-resolver/first/src/main/java/io/helidon/nima/webclient/dns/resolver/first/FirstDnsResolver.java b/webclient/dns-resolver/first/src/main/java/io/helidon/webclient/dns/resolver/first/FirstDnsResolver.java similarity index 88% rename from nima/webclient/dns-resolver/first/src/main/java/io/helidon/nima/webclient/dns/resolver/first/FirstDnsResolver.java rename to webclient/dns-resolver/first/src/main/java/io/helidon/webclient/dns/resolver/first/FirstDnsResolver.java index 36f85a82fec..d85d8b1e053 100644 --- a/nima/webclient/dns-resolver/first/src/main/java/io/helidon/nima/webclient/dns/resolver/first/FirstDnsResolver.java +++ b/webclient/dns-resolver/first/src/main/java/io/helidon/webclient/dns/resolver/first/FirstDnsResolver.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.dns.resolver.first; +package io.helidon.webclient.dns.resolver.first; import java.net.InetAddress; import java.net.UnknownHostException; @@ -22,9 +22,9 @@ import java.util.Objects; import java.util.concurrent.ConcurrentHashMap; -import io.helidon.nima.webclient.api.DnsAddressLookup; -import io.helidon.nima.webclient.api.RuntimeUnknownHostException; -import io.helidon.nima.webclient.spi.DnsResolver; +import io.helidon.webclient.api.DnsAddressLookup; +import io.helidon.webclient.api.RuntimeUnknownHostException; +import io.helidon.webclient.spi.DnsResolver; final class FirstDnsResolver implements DnsResolver { diff --git a/nima/webclient/dns-resolver/first/src/main/java/io/helidon/nima/webclient/dns/resolver/first/FirstDnsResolverProvider.java b/webclient/dns-resolver/first/src/main/java/io/helidon/webclient/dns/resolver/first/FirstDnsResolverProvider.java similarity index 88% rename from nima/webclient/dns-resolver/first/src/main/java/io/helidon/nima/webclient/dns/resolver/first/FirstDnsResolverProvider.java rename to webclient/dns-resolver/first/src/main/java/io/helidon/webclient/dns/resolver/first/FirstDnsResolverProvider.java index 4b8e4775de1..dedf759a508 100644 --- a/nima/webclient/dns-resolver/first/src/main/java/io/helidon/nima/webclient/dns/resolver/first/FirstDnsResolverProvider.java +++ b/webclient/dns-resolver/first/src/main/java/io/helidon/webclient/dns/resolver/first/FirstDnsResolverProvider.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.nima.webclient.dns.resolver.first; +package io.helidon.webclient.dns.resolver.first; import io.helidon.common.Weight; import io.helidon.common.Weighted; -import io.helidon.nima.webclient.spi.DnsResolver; -import io.helidon.nima.webclient.spi.DnsResolverProvider; +import io.helidon.webclient.spi.DnsResolver; +import io.helidon.webclient.spi.DnsResolverProvider; /** * Provider of the {@link FirstDnsResolver} instance. diff --git a/webclient/dns-resolver/first/src/main/java/io/helidon/webclient/dns/resolver/first/package-info.java b/webclient/dns-resolver/first/src/main/java/io/helidon/webclient/dns/resolver/first/package-info.java new file mode 100644 index 00000000000..3b603e31229 --- /dev/null +++ b/webclient/dns-resolver/first/src/main/java/io/helidon/webclient/dns/resolver/first/package-info.java @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebClient DNS Resolver First Support. + * This implementation uses the first address from DNS lookup. + */ +package io.helidon.webclient.dns.resolver.first; diff --git a/webclient/dns-resolver/first/src/main/java/module-info.java b/webclient/dns-resolver/first/src/main/java/module-info.java new file mode 100644 index 00000000000..ed20c1570f2 --- /dev/null +++ b/webclient/dns-resolver/first/src/main/java/module-info.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.webclient.dns.resolver.first.FirstDnsResolverProvider; +import io.helidon.webclient.spi.DnsResolverProvider; + +/** + * Helidon WebClient DNS Resolver First Support. + * This implementation uses the first address from DNS lookup. + */ +module io.helidon.webclient.dns.resolver.first { + requires io.helidon.webclient.api; + + exports io.helidon.webclient.dns.resolver.first; + + provides DnsResolverProvider + with FirstDnsResolverProvider; +} \ No newline at end of file diff --git a/nima/webclient/dns-resolver/first/src/test/java/io/helidon/nima/webclient/dns/resolver/first/FirstDnsResolverTest.java b/webclient/dns-resolver/first/src/test/java/io/helidon/webclient/dns/resolver/first/FirstDnsResolverTest.java similarity index 81% rename from nima/webclient/dns-resolver/first/src/test/java/io/helidon/nima/webclient/dns/resolver/first/FirstDnsResolverTest.java rename to webclient/dns-resolver/first/src/test/java/io/helidon/webclient/dns/resolver/first/FirstDnsResolverTest.java index 5687181d793..d2c1c80f9cb 100644 --- a/nima/webclient/dns-resolver/first/src/test/java/io/helidon/nima/webclient/dns/resolver/first/FirstDnsResolverTest.java +++ b/webclient/dns-resolver/first/src/test/java/io/helidon/webclient/dns/resolver/first/FirstDnsResolverTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.dns.resolver.first; +package io.helidon.webclient.dns.resolver.first; import java.util.HashSet; import java.util.Set; @@ -22,8 +22,7 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; -import io.helidon.nima.webclient.api.DefaultDnsResolver; -import io.helidon.nima.webclient.api.DnsAddressLookup; +import io.helidon.webclient.api.DnsAddressLookup; import org.junit.jupiter.api.Test; @@ -32,8 +31,8 @@ class FirstDnsResolverTest { private static final int THREADS = 100; /** - * Test that {@link DefaultDnsResolver} can be exercised concurrently. A - * {@link io.helidon.nima.webclient.api.WebClient} used concurrently will use a single resolver. + * Test that {@link io.helidon.webclient.api.DefaultDnsResolver} can be exercised concurrently. A + * {@link io.helidon.webclient.api.WebClient} used concurrently will use a single resolver. * * @throws Exception on unexpected condition */ diff --git a/webclient/dns-resolver/pom.xml b/webclient/dns-resolver/pom.xml new file mode 100644 index 00000000000..d153063f0aa --- /dev/null +++ b/webclient/dns-resolver/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + io.helidon.webclient + helidon-webclient-project + 4.0.0-SNAPSHOT + + + pom + + io.helidon.webclient.dns.resolver + helidon-webclient-dns-resolver-project + Helidon WebClient DNS Resolver Project + + + first + round-robin + + diff --git a/webclient/dns-resolver/round-robin/pom.xml b/webclient/dns-resolver/round-robin/pom.xml new file mode 100644 index 00000000000..34284b5aa55 --- /dev/null +++ b/webclient/dns-resolver/round-robin/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + io.helidon.webclient.dns.resolver + helidon-webclient-dns-resolver-project + 4.0.0-SNAPSHOT + + + helidon-webclient-dns-resolver-round-robin + Helidon WebClient DNS Resolver Round Robin + DNS resolver that cycles through addresses from DNS lookup + + + + io.helidon.webclient + helidon-webclient-api + + + diff --git a/nima/webclient/dns-resolver/round-robin/src/main/java/io/helidon/nima/webclient/dns/resolver/roundrobin/RoundRobinDnsResolver.java b/webclient/dns-resolver/round-robin/src/main/java/io/helidon/webclient/dns/resolver/roundrobin/RoundRobinDnsResolver.java similarity index 90% rename from nima/webclient/dns-resolver/round-robin/src/main/java/io/helidon/nima/webclient/dns/resolver/roundrobin/RoundRobinDnsResolver.java rename to webclient/dns-resolver/round-robin/src/main/java/io/helidon/webclient/dns/resolver/roundrobin/RoundRobinDnsResolver.java index e29a076ab56..9eb310ee6d7 100644 --- a/nima/webclient/dns-resolver/round-robin/src/main/java/io/helidon/nima/webclient/dns/resolver/roundrobin/RoundRobinDnsResolver.java +++ b/webclient/dns-resolver/round-robin/src/main/java/io/helidon/webclient/dns/resolver/roundrobin/RoundRobinDnsResolver.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.dns.resolver.roundrobin; +package io.helidon.webclient.dns.resolver.roundrobin; import java.net.InetAddress; import java.net.UnknownHostException; @@ -22,9 +22,9 @@ import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; -import io.helidon.nima.webclient.api.DnsAddressLookup; -import io.helidon.nima.webclient.api.RuntimeUnknownHostException; -import io.helidon.nima.webclient.spi.DnsResolver; +import io.helidon.webclient.api.DnsAddressLookup; +import io.helidon.webclient.api.RuntimeUnknownHostException; +import io.helidon.webclient.spi.DnsResolver; /** * Round-robin DNS resolver implementation. diff --git a/nima/webclient/dns-resolver/round-robin/src/main/java/io/helidon/nima/webclient/dns/resolver/roundrobin/RoundRobinDnsResolverProvider.java b/webclient/dns-resolver/round-robin/src/main/java/io/helidon/webclient/dns/resolver/roundrobin/RoundRobinDnsResolverProvider.java similarity index 88% rename from nima/webclient/dns-resolver/round-robin/src/main/java/io/helidon/nima/webclient/dns/resolver/roundrobin/RoundRobinDnsResolverProvider.java rename to webclient/dns-resolver/round-robin/src/main/java/io/helidon/webclient/dns/resolver/roundrobin/RoundRobinDnsResolverProvider.java index 49e5e2ad2eb..96631ab1498 100644 --- a/nima/webclient/dns-resolver/round-robin/src/main/java/io/helidon/nima/webclient/dns/resolver/roundrobin/RoundRobinDnsResolverProvider.java +++ b/webclient/dns-resolver/round-robin/src/main/java/io/helidon/webclient/dns/resolver/roundrobin/RoundRobinDnsResolverProvider.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.nima.webclient.dns.resolver.roundrobin; +package io.helidon.webclient.dns.resolver.roundrobin; import io.helidon.common.Weight; import io.helidon.common.Weighted; -import io.helidon.nima.webclient.spi.DnsResolver; -import io.helidon.nima.webclient.spi.DnsResolverProvider; +import io.helidon.webclient.spi.DnsResolver; +import io.helidon.webclient.spi.DnsResolverProvider; /** * Provider of the {@link RoundRobinDnsResolver} instance. diff --git a/webclient/dns-resolver/round-robin/src/main/java/io/helidon/webclient/dns/resolver/roundrobin/package-info.java b/webclient/dns-resolver/round-robin/src/main/java/io/helidon/webclient/dns/resolver/roundrobin/package-info.java new file mode 100644 index 00000000000..4244e969208 --- /dev/null +++ b/webclient/dns-resolver/round-robin/src/main/java/io/helidon/webclient/dns/resolver/roundrobin/package-info.java @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebClient DNS Resolver Round Robin Support. + * This implementation cycles through addresses from DNS lookup. + */ +package io.helidon.webclient.dns.resolver.roundrobin; diff --git a/webclient/dns-resolver/round-robin/src/main/java/module-info.java b/webclient/dns-resolver/round-robin/src/main/java/module-info.java new file mode 100644 index 00000000000..500a79bc258 --- /dev/null +++ b/webclient/dns-resolver/round-robin/src/main/java/module-info.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.webclient.dns.resolver.roundrobin.RoundRobinDnsResolverProvider; +import io.helidon.webclient.spi.DnsResolverProvider; + +/** + * Helidon WebClient DNS Resolver Round Robin Support. + * This implementation cycles through addresses from DNS lookup. + */ +module io.helidon.webclient.dns.resolver.roundrobin { + requires io.helidon.webclient.api; + + exports io.helidon.webclient.dns.resolver.roundrobin; + + provides DnsResolverProvider + with RoundRobinDnsResolverProvider; +} \ No newline at end of file diff --git a/webclient/http1/etc/spotbugs/exclude.xml b/webclient/http1/etc/spotbugs/exclude.xml new file mode 100644 index 00000000000..d810876b937 --- /dev/null +++ b/webclient/http1/etc/spotbugs/exclude.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + diff --git a/webclient/http1/pom.xml b/webclient/http1/pom.xml new file mode 100644 index 00000000000..3ece50ddfdb --- /dev/null +++ b/webclient/http1/pom.xml @@ -0,0 +1,161 @@ + + + + 4.0.0 + + io.helidon.webclient + helidon-webclient-project + 4.0.0-SNAPSHOT + + + helidon-webclient-http1 + Helidon WebClient HTTP/1.1 + + + etc/spotbugs/exclude.xml + + + + + io.helidon.webclient + helidon-webclient-api + + + io.helidon.http + helidon-http + + + io.helidon.common + helidon-common-socket + + + io.helidon.common + helidon-common-key-util + + + io.helidon.common + helidon-common-tls + + + io.helidon.common + helidon-common-config + + + io.helidon.http.media + helidon-http-media + + + io.helidon.http.encoding + helidon-http-encoding + + + io.helidon.common + helidon-common-context + + + io.helidon.common.features + helidon-common-features-api + true + + + io.helidon.config + helidon-config-metadata + true + + + io.helidon.builder + helidon-builder-api + + + io.helidon.inject.configdriven + helidon-inject-configdriven-api + true + + + io.helidon.inject.configdriven + helidon-inject-configdriven-runtime + true + + + org.junit.jupiter + junit-jupiter-api + test + + + junit-jupiter-params + org.junit.jupiter + test + + + org.hamcrest + hamcrest-all + test + + + io.helidon.common.testing + helidon-common-testing-http-junit5 + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + io.helidon.builder + helidon-builder-processor + ${helidon.version} + + + io.helidon.inject.configdriven + helidon-inject-configdriven-processor + ${helidon.version} + + + + + + io.helidon.inject.configdriven + helidon-inject-configdriven-processor + ${helidon.version} + + + io.helidon.builder + helidon-builder-processor + ${helidon.version} + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + + + + diff --git a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1CallChainBase.java b/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1CallChainBase.java similarity index 95% rename from nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1CallChainBase.java rename to webclient/http1/src/main/java/io/helidon/webclient/http1/Http1CallChainBase.java index 5b55ecdd490..b0a14493c1a 100644 --- a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1CallChainBase.java +++ b/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1CallChainBase.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.http1; +package io.helidon.webclient.http1; import java.io.InputStream; import java.io.UncheckedIOException; @@ -27,25 +27,25 @@ import io.helidon.common.buffers.Bytes; import io.helidon.common.buffers.DataReader; import io.helidon.common.buffers.DataWriter; -import io.helidon.common.http.ClientRequestHeaders; -import io.helidon.common.http.ClientResponseHeaders; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderNames; -import io.helidon.common.http.Http.Method; -import io.helidon.common.http.Http1HeadersParser; -import io.helidon.common.http.WritableHeaders; import io.helidon.common.socket.HelidonSocket; -import io.helidon.nima.common.tls.Tls; -import io.helidon.nima.http.encoding.ContentDecoder; -import io.helidon.nima.http.encoding.ContentEncodingContext; -import io.helidon.nima.webclient.api.ClientConnection; -import io.helidon.nima.webclient.api.ClientUri; -import io.helidon.nima.webclient.api.HttpClientConfig; -import io.helidon.nima.webclient.api.Proxy; -import io.helidon.nima.webclient.api.WebClientServiceRequest; -import io.helidon.nima.webclient.api.WebClientServiceResponse; -import io.helidon.nima.webclient.spi.WebClientService; +import io.helidon.common.tls.Tls; +import io.helidon.http.ClientRequestHeaders; +import io.helidon.http.ClientResponseHeaders; +import io.helidon.http.Headers; +import io.helidon.http.Http; +import io.helidon.http.Http.HeaderNames; +import io.helidon.http.Http.Method; +import io.helidon.http.Http1HeadersParser; +import io.helidon.http.WritableHeaders; +import io.helidon.http.encoding.ContentDecoder; +import io.helidon.http.encoding.ContentEncodingContext; +import io.helidon.webclient.api.ClientConnection; +import io.helidon.webclient.api.ClientUri; +import io.helidon.webclient.api.HttpClientConfig; +import io.helidon.webclient.api.Proxy; +import io.helidon.webclient.api.WebClientServiceRequest; +import io.helidon.webclient.api.WebClientServiceResponse; +import io.helidon.webclient.spi.WebClientService; import static java.lang.System.Logger.Level.TRACE; import static java.nio.charset.StandardCharsets.US_ASCII; diff --git a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1CallEntityChain.java b/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1CallEntityChain.java similarity index 90% rename from nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1CallEntityChain.java rename to webclient/http1/src/main/java/io/helidon/webclient/http1/Http1CallEntityChain.java index 1088f72e709..fd39823f49e 100644 --- a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1CallEntityChain.java +++ b/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1CallEntityChain.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.http1; +package io.helidon.webclient.http1; import java.io.ByteArrayOutputStream; import java.util.concurrent.CompletableFuture; @@ -23,12 +23,12 @@ import io.helidon.common.buffers.BufferData; import io.helidon.common.buffers.DataReader; import io.helidon.common.buffers.DataWriter; -import io.helidon.common.http.ClientRequestHeaders; -import io.helidon.common.http.Http; -import io.helidon.nima.http.media.EntityWriter; -import io.helidon.nima.webclient.api.ClientConnection; -import io.helidon.nima.webclient.api.WebClientServiceRequest; -import io.helidon.nima.webclient.api.WebClientServiceResponse; +import io.helidon.http.ClientRequestHeaders; +import io.helidon.http.Http; +import io.helidon.http.media.EntityWriter; +import io.helidon.webclient.api.ClientConnection; +import io.helidon.webclient.api.WebClientServiceRequest; +import io.helidon.webclient.api.WebClientServiceResponse; class Http1CallEntityChain extends Http1CallChainBase { diff --git a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1CallOutputStreamChain.java b/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1CallOutputStreamChain.java similarity index 96% rename from nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1CallOutputStreamChain.java rename to webclient/http1/src/main/java/io/helidon/webclient/http1/Http1CallOutputStreamChain.java index eef323ff1cd..9368e317b52 100644 --- a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1CallOutputStreamChain.java +++ b/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1CallOutputStreamChain.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.http1; +package io.helidon.webclient.http1; import java.io.IOException; import java.io.OutputStream; @@ -27,19 +27,19 @@ import io.helidon.common.buffers.Bytes; import io.helidon.common.buffers.DataReader; import io.helidon.common.buffers.DataWriter; -import io.helidon.common.http.ClientRequestHeaders; -import io.helidon.common.http.ClientResponseHeaders; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http1HeadersParser; -import io.helidon.common.http.WritableHeaders; import io.helidon.common.uri.UriInfo; -import io.helidon.nima.webclient.api.ClientConnection; -import io.helidon.nima.webclient.api.ClientRequest; -import io.helidon.nima.webclient.api.ClientUri; -import io.helidon.nima.webclient.api.HttpClientConfig; -import io.helidon.nima.webclient.api.WebClientServiceRequest; -import io.helidon.nima.webclient.api.WebClientServiceResponse; +import io.helidon.http.ClientRequestHeaders; +import io.helidon.http.ClientResponseHeaders; +import io.helidon.http.Headers; +import io.helidon.http.Http; +import io.helidon.http.Http1HeadersParser; +import io.helidon.http.WritableHeaders; +import io.helidon.webclient.api.ClientConnection; +import io.helidon.webclient.api.ClientRequest; +import io.helidon.webclient.api.ClientUri; +import io.helidon.webclient.api.HttpClientConfig; +import io.helidon.webclient.api.WebClientServiceRequest; +import io.helidon.webclient.api.WebClientServiceResponse; import static java.lang.System.Logger.Level.TRACE; diff --git a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1Client.java b/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1Client.java similarity index 89% rename from nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1Client.java rename to webclient/http1/src/main/java/io/helidon/webclient/http1/Http1Client.java index dc72fa9439f..3a663fb12e8 100644 --- a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1Client.java +++ b/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1Client.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package io.helidon.nima.webclient.http1; +package io.helidon.webclient.http1; import java.util.function.Consumer; import io.helidon.builder.api.RuntimeType; import io.helidon.common.config.Config; -import io.helidon.nima.webclient.api.HttpClient; -import io.helidon.nima.webclient.api.WebClient; -import io.helidon.nima.webclient.spi.Protocol; +import io.helidon.webclient.api.HttpClient; +import io.helidon.webclient.api.WebClient; +import io.helidon.webclient.spi.Protocol; /** * HTTP/1.1 client. @@ -35,7 +35,7 @@ public interface Http1Client extends HttpClient, RuntimeType String PROTOCOL_ID = "http/1.1"; /** * HTTP/1.1 protocol to use to obtain an instance of HTTP/1.1 specific client from - * {@link io.helidon.nima.webclient.api.WebClient#client(io.helidon.nima.webclient.spi.Protocol)}. + * {@link io.helidon.webclient.api.WebClient#client(io.helidon.webclient.spi.Protocol)}. */ Protocol PROTOCOL = Http1ProtocolProvider::new; diff --git a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ClientConfigBlueprint.java b/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ClientConfigBlueprint.java similarity index 91% rename from nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ClientConfigBlueprint.java rename to webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ClientConfigBlueprint.java index e4f1e916d2f..c55e2f85f08 100644 --- a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ClientConfigBlueprint.java +++ b/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ClientConfigBlueprint.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.helidon.nima.webclient.http1; +package io.helidon.webclient.http1; import io.helidon.builder.api.Prototype; import io.helidon.config.metadata.ConfiguredOption; -import io.helidon.nima.webclient.api.HttpClientConfig; +import io.helidon.webclient.api.HttpClientConfig; /** * HTTP/1.1. full webclient configuration. diff --git a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ClientImpl.java b/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ClientImpl.java similarity index 91% rename from nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ClientImpl.java rename to webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ClientImpl.java index 10c35301b94..f925f02bf77 100644 --- a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ClientImpl.java +++ b/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ClientImpl.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.nima.webclient.http1; - -import io.helidon.common.http.Http; -import io.helidon.nima.webclient.api.ClientRequest; -import io.helidon.nima.webclient.api.ClientUri; -import io.helidon.nima.webclient.api.FullClientRequest; -import io.helidon.nima.webclient.api.WebClient; -import io.helidon.nima.webclient.spi.HttpClientSpi; +package io.helidon.webclient.http1; + +import io.helidon.http.Http; +import io.helidon.webclient.api.ClientRequest; +import io.helidon.webclient.api.ClientUri; +import io.helidon.webclient.api.FullClientRequest; +import io.helidon.webclient.api.WebClient; +import io.helidon.webclient.spi.HttpClientSpi; class Http1ClientImpl implements Http1Client, HttpClientSpi { private final WebClient webClient; diff --git a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ClientProtocolConfigBlueprint.java b/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ClientProtocolConfigBlueprint.java similarity index 96% rename from nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ClientProtocolConfigBlueprint.java rename to webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ClientProtocolConfigBlueprint.java index ceafef3da4f..4583876ef99 100644 --- a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ClientProtocolConfigBlueprint.java +++ b/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ClientProtocolConfigBlueprint.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.nima.webclient.http1; +package io.helidon.webclient.http1; import io.helidon.builder.api.Prototype; import io.helidon.config.metadata.Configured; import io.helidon.config.metadata.ConfiguredOption; -import io.helidon.nima.webclient.spi.ProtocolConfig; +import io.helidon.webclient.spi.ProtocolConfig; /** * Configuration of an HTTP/1.1 client. diff --git a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ClientRequest.java b/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ClientRequest.java similarity index 95% rename from nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ClientRequest.java rename to webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ClientRequest.java index 27034d721b7..44d13ee485a 100644 --- a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ClientRequest.java +++ b/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ClientRequest.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.helidon.nima.webclient.http1; +package io.helidon.webclient.http1; import io.helidon.common.buffers.BufferData; -import io.helidon.nima.webclient.api.ClientRequest; +import io.helidon.webclient.api.ClientRequest; /** * Client request for HTTP/1.1. diff --git a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ClientRequestImpl.java b/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ClientRequestImpl.java similarity index 96% rename from nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ClientRequestImpl.java rename to webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ClientRequestImpl.java index 4b728b15d31..7e020a65ff6 100644 --- a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ClientRequestImpl.java +++ b/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ClientRequestImpl.java @@ -14,17 +14,17 @@ * limitations under the License. */ -package io.helidon.nima.webclient.http1; +package io.helidon.webclient.http1; import java.util.Map; import java.util.concurrent.CompletableFuture; import io.helidon.common.buffers.BufferData; -import io.helidon.common.http.Http; -import io.helidon.nima.webclient.api.ClientRequestBase; -import io.helidon.nima.webclient.api.ClientUri; -import io.helidon.nima.webclient.api.WebClientServiceRequest; -import io.helidon.nima.webclient.api.WebClientServiceResponse; +import io.helidon.http.Http; +import io.helidon.webclient.api.ClientRequestBase; +import io.helidon.webclient.api.ClientUri; +import io.helidon.webclient.api.WebClientServiceRequest; +import io.helidon.webclient.api.WebClientServiceResponse; class Http1ClientRequestImpl extends ClientRequestBase implements Http1ClientRequest { private static final System.Logger LOGGER = System.getLogger(Http1ClientRequestImpl.class.getName()); diff --git a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ClientResponse.java b/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ClientResponse.java similarity index 88% rename from nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ClientResponse.java rename to webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ClientResponse.java index 1290cfcbf6a..5f5a901875f 100644 --- a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ClientResponse.java +++ b/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ClientResponse.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.helidon.nima.webclient.http1; +package io.helidon.webclient.http1; -import io.helidon.nima.webclient.api.HttpClientResponse; +import io.helidon.webclient.api.HttpClientResponse; /** * Client response for HTTP/1.1. client. diff --git a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ClientResponseImpl.java b/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ClientResponseImpl.java similarity index 87% rename from nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ClientResponseImpl.java rename to webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ClientResponseImpl.java index 5702f11f5df..021b25b50a6 100644 --- a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ClientResponseImpl.java +++ b/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ClientResponseImpl.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.http1; +package io.helidon.webclient.http1; import java.io.InputStream; import java.util.List; @@ -25,23 +25,23 @@ import io.helidon.common.GenericType; import io.helidon.common.HelidonServiceLoader; import io.helidon.common.buffers.BufferData; -import io.helidon.common.http.ClientRequestHeaders; -import io.helidon.common.http.ClientResponseHeaders; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderNames; -import io.helidon.common.http.Http.Headers; -import io.helidon.common.http.Http1HeadersParser; -import io.helidon.common.http.WritableHeaders; import io.helidon.common.media.type.ParserMode; -import io.helidon.nima.http.media.MediaContext; -import io.helidon.nima.http.media.ReadableEntity; -import io.helidon.nima.http.media.ReadableEntityBase; -import io.helidon.nima.webclient.api.ClientConnection; -import io.helidon.nima.webclient.api.ClientResponseEntity; -import io.helidon.nima.webclient.api.ClientUri; -import io.helidon.nima.webclient.api.HttpClientConfig; -import io.helidon.nima.webclient.spi.Source; -import io.helidon.nima.webclient.spi.SourceHandlerProvider; +import io.helidon.http.ClientRequestHeaders; +import io.helidon.http.ClientResponseHeaders; +import io.helidon.http.Http; +import io.helidon.http.Http.HeaderNames; +import io.helidon.http.Http.Headers; +import io.helidon.http.Http1HeadersParser; +import io.helidon.http.WritableHeaders; +import io.helidon.http.media.MediaContext; +import io.helidon.http.media.ReadableEntity; +import io.helidon.http.media.ReadableEntityBase; +import io.helidon.webclient.api.ClientConnection; +import io.helidon.webclient.api.ClientResponseEntity; +import io.helidon.webclient.api.ClientUri; +import io.helidon.webclient.api.HttpClientConfig; +import io.helidon.webclient.spi.Source; +import io.helidon.webclient.spi.SourceHandlerProvider; class Http1ClientResponseImpl implements Http1ClientResponse { private static final System.Logger LOGGER = System.getLogger(Http1ClientResponseImpl.class.getName()); diff --git a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ClientSpiProvider.java b/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ClientSpiProvider.java similarity index 89% rename from nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ClientSpiProvider.java rename to webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ClientSpiProvider.java index 450415421eb..602f5abfa86 100644 --- a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ClientSpiProvider.java +++ b/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ClientSpiProvider.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.helidon.nima.webclient.http1; +package io.helidon.webclient.http1; -import io.helidon.nima.webclient.api.WebClient; -import io.helidon.nima.webclient.spi.HttpClientSpi; -import io.helidon.nima.webclient.spi.HttpClientSpiProvider; +import io.helidon.webclient.api.WebClient; +import io.helidon.webclient.spi.HttpClientSpi; +import io.helidon.webclient.spi.HttpClientSpiProvider; /** * {@link java.util.ServiceLoader} provider implementation for HTTP/1.1 protocol. diff --git a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ConnectionCache.java b/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ConnectionCache.java similarity index 93% rename from nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ConnectionCache.java rename to webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ConnectionCache.java index 3ced0fda960..8e0e58161c3 100644 --- a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ConnectionCache.java +++ b/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ConnectionCache.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.http1; +package io.helidon.webclient.http1; import java.time.Duration; import java.util.HashMap; @@ -23,16 +23,16 @@ import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.TimeUnit; -import io.helidon.common.http.ClientRequestHeaders; -import io.helidon.common.http.Http; -import io.helidon.common.http.WritableHeaders; -import io.helidon.nima.common.tls.Tls; -import io.helidon.nima.webclient.api.ClientConnection; -import io.helidon.nima.webclient.api.ClientUri; -import io.helidon.nima.webclient.api.ConnectionKey; -import io.helidon.nima.webclient.api.Proxy; -import io.helidon.nima.webclient.api.TcpClientConnection; -import io.helidon.nima.webclient.api.WebClient; +import io.helidon.common.tls.Tls; +import io.helidon.http.ClientRequestHeaders; +import io.helidon.http.Http; +import io.helidon.http.WritableHeaders; +import io.helidon.webclient.api.ClientConnection; +import io.helidon.webclient.api.ClientUri; +import io.helidon.webclient.api.ConnectionKey; +import io.helidon.webclient.api.Proxy; +import io.helidon.webclient.api.TcpClientConnection; +import io.helidon.webclient.api.WebClient; import static java.lang.System.Logger.Level.DEBUG; diff --git a/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ProtocolConfigProvider.java b/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ProtocolConfigProvider.java new file mode 100644 index 00000000000..74c0747e10d --- /dev/null +++ b/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ProtocolConfigProvider.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.webclient.http1; + +import io.helidon.common.config.Config; +import io.helidon.webclient.spi.ProtocolConfigProvider; + +/** + * Implementation of protocol config provider. + */ +public class Http1ProtocolConfigProvider implements ProtocolConfigProvider { + /** + * Required to be used by {@link java.util.ServiceLoader}. + * @deprecated do not use directly, use Http1ClientProtocol + */ + public Http1ProtocolConfigProvider() { + } + + @Override + public String configKey() { + return Http1ProtocolProvider.CONFIG_KEY; + } + + @Override + public Http1ClientProtocolConfig create(Config config, String name) { + return Http1ClientProtocolConfig.builder() + .config(config) + .name(name) + .build(); + } +} diff --git a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ProtocolProvider.java b/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ProtocolProvider.java similarity index 90% rename from nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ProtocolProvider.java rename to webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ProtocolProvider.java index af3e0bce9fe..2671595737e 100644 --- a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1ProtocolProvider.java +++ b/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1ProtocolProvider.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.helidon.nima.webclient.http1; +package io.helidon.webclient.http1; -import io.helidon.nima.webclient.api.WebClient; -import io.helidon.nima.webclient.spi.ClientProtocolProvider; +import io.helidon.webclient.api.WebClient; +import io.helidon.webclient.spi.ClientProtocolProvider; class Http1ProtocolProvider implements ClientProtocolProvider { static final String CONFIG_KEY = "http_1_1"; diff --git a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1StatusParser.java b/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1StatusParser.java similarity index 98% rename from nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1StatusParser.java rename to webclient/http1/src/main/java/io/helidon/webclient/http1/Http1StatusParser.java index 3b3c636235f..c27be73f9e8 100644 --- a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/Http1StatusParser.java +++ b/webclient/http1/src/main/java/io/helidon/webclient/http1/Http1StatusParser.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.nima.webclient.http1; +package io.helidon.webclient.http1; import java.nio.charset.StandardCharsets; import io.helidon.common.buffers.BufferData; import io.helidon.common.buffers.Bytes; import io.helidon.common.buffers.DataReader; -import io.helidon.common.http.Http; +import io.helidon.http.Http; /** * Parser of HTTP/1.0 or HTTP/1.1 response status. diff --git a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/OutputStreamInterruptedException.java b/webclient/http1/src/main/java/io/helidon/webclient/http1/OutputStreamInterruptedException.java similarity index 94% rename from nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/OutputStreamInterruptedException.java rename to webclient/http1/src/main/java/io/helidon/webclient/http1/OutputStreamInterruptedException.java index dd525fe7991..ed503b8e441 100644 --- a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/OutputStreamInterruptedException.java +++ b/webclient/http1/src/main/java/io/helidon/webclient/http1/OutputStreamInterruptedException.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.http1; +package io.helidon.webclient.http1; class OutputStreamInterruptedException extends RuntimeException { diff --git a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/RedirectionProcessor.java b/webclient/http1/src/main/java/io/helidon/webclient/http1/RedirectionProcessor.java similarity index 97% rename from nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/RedirectionProcessor.java rename to webclient/http1/src/main/java/io/helidon/webclient/http1/RedirectionProcessor.java index 74d7d861a43..866f1b9c493 100644 --- a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/RedirectionProcessor.java +++ b/webclient/http1/src/main/java/io/helidon/webclient/http1/RedirectionProcessor.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.helidon.nima.webclient.http1; +package io.helidon.webclient.http1; import java.net.URI; import io.helidon.common.buffers.BufferData; -import io.helidon.common.http.Http; -import io.helidon.nima.webclient.api.ClientUri; +import io.helidon.http.Http; +import io.helidon.webclient.api.ClientUri; class RedirectionProcessor { diff --git a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/UpgradeResponse.java b/webclient/http1/src/main/java/io/helidon/webclient/http1/UpgradeResponse.java similarity index 91% rename from nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/UpgradeResponse.java rename to webclient/http1/src/main/java/io/helidon/webclient/http1/UpgradeResponse.java index 5387888b4c8..8a4c8ec076a 100644 --- a/nima/webclient/http1/src/main/java/io/helidon/nima/webclient/http1/UpgradeResponse.java +++ b/webclient/http1/src/main/java/io/helidon/webclient/http1/UpgradeResponse.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package io.helidon.nima.webclient.http1; +package io.helidon.webclient.http1; import java.util.NoSuchElementException; -import io.helidon.common.http.ClientResponseHeaders; -import io.helidon.common.http.Http; -import io.helidon.nima.http.media.ReadableEntity; -import io.helidon.nima.webclient.api.ClientConnection; -import io.helidon.nima.webclient.api.ClientUri; -import io.helidon.nima.webclient.api.HttpClientResponse; +import io.helidon.http.ClientResponseHeaders; +import io.helidon.http.Http; +import io.helidon.http.media.ReadableEntity; +import io.helidon.webclient.api.ClientConnection; +import io.helidon.webclient.api.ClientUri; +import io.helidon.webclient.api.HttpClientResponse; /** * Response to an upgrade attempt. diff --git a/webclient/http1/src/main/java/io/helidon/webclient/http1/package-info.java b/webclient/http1/src/main/java/io/helidon/webclient/http1/package-info.java new file mode 100644 index 00000000000..1f923630032 --- /dev/null +++ b/webclient/http1/src/main/java/io/helidon/webclient/http1/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebClient HTTP/1.1 Support. + */ +package io.helidon.webclient.http1; diff --git a/webclient/http1/src/main/java/module-info.java b/webclient/http1/src/main/java/module-info.java new file mode 100644 index 00000000000..f6c8f31f05b --- /dev/null +++ b/webclient/http1/src/main/java/module-info.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.common.features.api.Feature; +import io.helidon.common.features.api.HelidonFlavor; +import io.helidon.webclient.http1.Http1ClientSpiProvider; +import io.helidon.webclient.http1.Http1ProtocolConfigProvider; +import io.helidon.webclient.spi.HttpClientSpiProvider; +import io.helidon.webclient.spi.ProtocolConfigProvider; +import io.helidon.webclient.spi.SourceHandlerProvider; + +/** + * Helidon WebClient HTTP/1.1 Support. + */ +@Feature(value = "HTTP/1.1", + description = "WebClient HTTP/1.1 support", + in = HelidonFlavor.SE, + path = {"WebClient", "HTTP/1.1"} +) +module io.helidon.webclient.http1 { + uses SourceHandlerProvider; + requires static io.helidon.common.features.api; + // @ConfiguredOption etc + requires static io.helidon.config.metadata; + + requires transitive io.helidon.webclient.api; + // @Builder - interfaces are a runtime dependency + requires io.helidon.builder.api; + + exports io.helidon.webclient.http1; + + provides HttpClientSpiProvider + with Http1ClientSpiProvider; + provides ProtocolConfigProvider + with Http1ProtocolConfigProvider; +} \ No newline at end of file diff --git a/webclient/http1/src/test/java/io/helidon/webclient/http1/Http1ClientTest.java b/webclient/http1/src/test/java/io/helidon/webclient/http1/Http1ClientTest.java new file mode 100644 index 00000000000..e722f70d619 --- /dev/null +++ b/webclient/http1/src/test/java/io/helidon/webclient/http1/Http1ClientTest.java @@ -0,0 +1,829 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.webclient.http1; + +import java.io.OutputStream; +import java.net.URI; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.StringTokenizer; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import java.util.stream.Stream; + +import io.helidon.common.GenericType; +import io.helidon.common.buffers.BufferData; +import io.helidon.common.buffers.Bytes; +import io.helidon.common.buffers.DataReader; +import io.helidon.common.buffers.DataWriter; +import io.helidon.http.Headers; +import io.helidon.http.Http; +import io.helidon.http.Http1HeadersParser; +import io.helidon.http.WritableHeaders; +import io.helidon.common.socket.HelidonSocket; +import io.helidon.common.socket.PeerInfo; +import io.helidon.http.media.EntityReader; +import io.helidon.http.media.EntityWriter; +import io.helidon.http.media.MediaContext; +import io.helidon.http.media.MediaContextConfig; +import io.helidon.webclient.api.ClientConnection; +import io.helidon.webclient.api.HttpClientResponse; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import static io.helidon.common.testing.http.junit5.HttpHeaderMatcher.hasHeader; +import static io.helidon.common.testing.http.junit5.HttpHeaderMatcher.noHeader; +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.startsWith; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.params.provider.Arguments.arguments; + +class Http1ClientTest { + public static final String VALID_HEADER_VALUE = "Valid-Header-Value"; + public static final String VALID_HEADER_NAME = "Valid-Header-Name"; + public static final String BAD_HEADER_PATH = "/badHeader"; + public static final String HEADER_NAME_VALUE_DELIMETER = "->"; + private static final Http.Header REQ_CHUNKED_HEADER = Http.Headers.create( + Http.HeaderNames.create("X-Req-Chunked"), "true"); + private static final Http.Header REQ_EXPECT_100_HEADER_NAME = Http.Headers.create( + Http.HeaderNames.create("X-Req-Expect100"), "true"); + private static final Http.HeaderName REQ_CONTENT_LENGTH_HEADER_NAME = Http.HeaderNames.create("X-Req-ContentLength"); + private static final long NO_CONTENT_LENGTH = -1L; + private static final Http1Client client = Http1Client.builder() + .sendExpectContinue(false) + .build(); + private static final int dummyPort = 1234; + + @Test + void testMaxHeaderSizeFail() { + Http1Client client = Http1Client.create(builder -> builder.protocolConfig(pc -> pc.maxHeaderSize(15))); + + validateFailedResponse(client, new FakeHttp1ClientConnection(), "Header size exceeded"); + } + + @Test + void testMaxHeaderSizeSuccess() { + Http1Client client = Http1Client.builder() + .protocolConfig(pc -> pc.maxHeaderSize(500)) + .build(); + + validateSuccessfulResponse(client, new FakeHttp1ClientConnection()); + } + + @Test + void testMaxStatusLineLengthFail() { + Http1Client client = Http1Client.builder() + .protocolConfig(it -> it.maxStatusLineLength(1)) + .build(); + validateFailedResponse(client, new FakeHttp1ClientConnection(), "HTTP Response did not contain HTTP status line"); + } + + @Test + void testMaxHeaderLineLengthSuccess() { + Http1Client client = Http1Client.builder() + .protocolConfig(it -> it.maxStatusLineLength(20)) + .build(); + validateSuccessfulResponse(client, new FakeHttp1ClientConnection()); + } + + @Test + void testMediaContext() { + Http1Client client = Http1Client.builder() + .mediaContext(new CustomizedMediaContext()) + .build(); + validateSuccessfulResponse(client, new FakeHttp1ClientConnection()); + } + + @Test + void testChunk() { + String[] requestEntityParts = {"First", "Second", "Third"}; + + Http1ClientRequest request = getHttp1ClientRequest(Http.Method.PUT, "/test"); + request.connection(new FakeHttp1ClientConnection()); + Http1ClientResponse response = getHttp1ClientResponseFromOutputStream(request, requestEntityParts); + + validateChunkTransfer(response, true, NO_CONTENT_LENGTH, String.join("", requestEntityParts)); + } + + @Test + void testNoChunk() { + String[] requestEntityParts = {"First"}; + long contentLength = requestEntityParts[0].length(); + + Http1ClientRequest request = getHttp1ClientRequest(Http.Method.PUT, "/test") + .header(Http.HeaderNames.CONTENT_LENGTH, String.valueOf(contentLength)); + request.connection(new FakeHttp1ClientConnection()); + Http1ClientResponse response = getHttp1ClientResponseFromOutputStream(request, requestEntityParts); + + validateChunkTransfer(response, false, contentLength, requestEntityParts[0]); + } + + @Test + void testForcedChunkNoContentLength() { + String[] requestEntityParts = {"First"}; + + Http1ClientRequest request = getHttp1ClientRequest(Http.Method.PUT, "/test"); + request.connection(new FakeHttp1ClientConnection()); + Http1ClientResponse response = getHttp1ClientResponseFromOutputStream(request, requestEntityParts); + + validateChunkTransfer(response, true, NO_CONTENT_LENGTH, requestEntityParts[0]); + } + + @Test + void testForcedChunkTransferEncodingChunked() { + String[] requestEntityParts = {"First"}; + + Http1ClientRequest request = getHttp1ClientRequest(Http.Method.PUT, "/test") + .header(Http.Headers.TRANSFER_ENCODING_CHUNKED); + request.connection(new FakeHttp1ClientConnection()); + Http1ClientResponse response = getHttp1ClientResponseFromOutputStream(request, requestEntityParts); + + validateChunkTransfer(response, true, NO_CONTENT_LENGTH, requestEntityParts[0]); + } + + @Test + void testExpect100() { + String[] requestEntityParts = {"First", "Second", "Third"}; + + Http1Client client = Http1Client.builder() + .sendExpectContinue(true) + .build(); + Http1ClientRequest request = client.put("http://localhost:" + dummyPort + "/test"); + request.connection(new FakeHttp1ClientConnection()); + + Http1ClientResponse response = getHttp1ClientResponseFromOutputStream(request, requestEntityParts); + + validateChunkTransfer(response, true, NO_CONTENT_LENGTH, String.join("", requestEntityParts)); + assertThat(response.headers(), hasHeader(REQ_EXPECT_100_HEADER_NAME)); + } + + // validates that HEAD is not allowed with entity payload + @Test + void testHeadMethod() { + String url = "http://localhost:" + dummyPort + "/test"; + ClientConnection http1ClientConnection = new FakeHttp1ClientConnection(); + assertThrows(IllegalArgumentException.class, () -> + client.head(url).connection(http1ClientConnection).submit("Foo Bar")); + assertThrows(IllegalArgumentException.class, () -> + client.head(url).connection(http1ClientConnection).outputStream(it -> { + it.write("Foo Bar".getBytes(StandardCharsets.UTF_8)); + it.close(); + })); + client.head(url).connection(http1ClientConnection).request(); + http1ClientConnection.closeResource(); + } + + @Test + void testSkipUrlEncoding() { + //Fill with chars which should be encoded + Http1ClientRequest request = getHttp1ClientRequest(Http.Method.PUT, "/ěščžř") + .queryParam("specialChar+", "someValue,").fragment("someFragment,"); + URI uri = request.resolvedUri().toUri(); + assertThat(uri.getRawPath(), is("/%C4%9B%C5%A1%C4%8D%C5%BE%C5%99")); + assertThat(uri.getRawQuery(), is("specialChar%2B=someValue%2C")); + assertThat(uri.getRawFragment(), is("someFragment%2C")); + + request = request.skipUriEncoding(true); + uri = request.resolvedUri().toUri(); + assertThat(uri.getRawPath(), is("/ěščžř")); + assertThat(uri.getRawQuery(), is("specialChar+=someValue,")); + assertThat(uri.getRawFragment(), is("someFragment,")); + } + + @ParameterizedTest + @MethodSource("relativeUris") + void testRelativeUris(boolean relativeUris, boolean outputStream, String requestUri, String expectedUriStart) { + Http1Client client = Http1Client.builder().relativeUris(relativeUris).build(); + FakeHttp1ClientConnection connection = new FakeHttp1ClientConnection(); + Http1ClientRequest request = client.put(requestUri); + request.connection(connection); + HttpClientResponse response; + if (outputStream) { + response = getHttp1ClientResponseFromOutputStream(request, new String[] {"Sending Something"}); + } else { + response = request.submit("Sending Something"); + } + + assertThat(response.status(), is(Http.Status.OK_200)); + StringTokenizer st = new StringTokenizer(connection.getPrologue(), " "); + // skip method part + st.nextToken(); + // Validate URI part + assertThat(st.nextToken(), startsWith(expectedUriStart)); + } + + @ParameterizedTest + @MethodSource("headerValues") + void testHeaderValues(List headerValues, boolean expectsValid) { + Http1Client clientValidateRequestHeaders = Http1Client.builder() + .protocolConfig(it -> { + it.validateRequestHeaders(true); + it.validateResponseHeaders(false); + }) + .build(); + Http1ClientRequest request = clientValidateRequestHeaders.get("http://localhost:" + dummyPort + "/test"); + request.header(Http.Headers.create("HeaderName", headerValues)); + request.connection(new FakeHttp1ClientConnection()); + if (expectsValid) { + HttpClientResponse response = request.request(); + assertThat(response.status(), is(Http.Status.OK_200)); + } else { + assertThrows(IllegalArgumentException.class, () -> request.request()); + } + } + + @ParameterizedTest + @MethodSource("headers") + void testHeaders(Http.Header header, boolean expectsValid) { + Http1Client clientValidateRequestHeaders = Http1Client.builder() + .protocolConfig(it -> { + it.validateRequestHeaders(true); + it.validateResponseHeaders(false); + }) + .build(); + Http1ClientRequest request = clientValidateRequestHeaders.get("http://localhost:" + dummyPort + "/test"); + request.connection(new FakeHttp1ClientConnection()); + request.header(header); + if (expectsValid) { + HttpClientResponse response = request.request(); + assertThat(response.status(), is(Http.Status.OK_200)); + } else { + assertThrows(IllegalArgumentException.class, () -> request.request()); + } + } + + @ParameterizedTest + @MethodSource("headers") + void testDisableHeaderValidation(Http.Header header, boolean expectsValid) { + Http1Client clientWithDisabledHeaderValidation = Http1Client.builder() + .protocolConfig(it -> { + it.validateRequestHeaders(false); + it.validateResponseHeaders(false); + }) + .build(); + Http1ClientRequest request = clientWithDisabledHeaderValidation.put("http://localhost:" + dummyPort + "/test"); + request.header(header); + request.connection(new FakeHttp1ClientConnection()); + HttpClientResponse response = request.submit("Sending Something"); + if (expectsValid) { + assertThat(response.status(), is(Http.Status.OK_200)); + } else { + assertThat(response.status(), is(Http.Status.BAD_REQUEST_400)); + } + } + + @ParameterizedTest + @MethodSource("responseHeaders") + void testHeadersFromResponse(String headerName, String headerValue, boolean expectsValid) { + Http1Client clientValidateResponseHeaders = Http1Client.builder() + .protocolConfig(it -> { + it.validateRequestHeaders(false); + it.validateResponseHeaders(true); + }) + .build(); + Http1ClientRequest request = clientValidateResponseHeaders.get("http://localhost:" + dummyPort + BAD_HEADER_PATH); + request.connection(new FakeHttp1ClientConnection()); + String headerNameAndValue = headerName + HEADER_NAME_VALUE_DELIMETER + headerValue; + if (expectsValid) { + HttpClientResponse response = request.submit(headerNameAndValue); + assertThat(response.status(), is(Http.Status.OK_200)); + String responseHeaderValue = response.headers().get(Http.HeaderNames.create(headerName)).values(); + assertThat(responseHeaderValue, is(headerValue.trim())); + } else { + assertThrows(IllegalArgumentException.class, () -> request.submit(headerNameAndValue)); + } + } + + @ParameterizedTest + @MethodSource("responseHeadersForDisabledValidation") + void testDisableValidationForHeadersFromResponse(String headerName, String headerValue) { + Http1Client clientWithNoHeaderValidation = Http1Client.builder() + .protocolConfig(it -> { + it.validateRequestHeaders(false); + it.validateResponseHeaders(false); + }) + .build(); + Http1ClientRequest request = clientWithNoHeaderValidation.put("http://localhost:" + dummyPort + BAD_HEADER_PATH); + request.connection(new FakeHttp1ClientConnection()); + Http1ClientResponse response = request.submit(headerName + HEADER_NAME_VALUE_DELIMETER + headerValue); + assertThat(response.status(), is(Http.Status.OK_200)); + String responseHeaderValue = response.headers().get(Http.HeaderNames.create(headerName)).values(); + assertThat(responseHeaderValue, is(headerValue.trim())); + } + + private static void validateSuccessfulResponse(Http1Client client, ClientConnection connection) { + String requestEntity = "Sending Something"; + Http1ClientRequest request = client.put("http://localhost:" + dummyPort + "/test"); + if (connection != null) { + request.connection(connection); + } + Http1ClientResponse response = request.submit(requestEntity); + + assertThat(response.status(), is(Http.Status.OK_200)); + assertThat(response.entity().as(String.class), is(requestEntity)); + } + + private static void validateFailedResponse(Http1Client client, ClientConnection connection, String errorMessage) { + String requestEntity = "Sending Something"; + Http1ClientRequest request = client.put("http://localhost:" + dummyPort + "/test"); + if (connection != null) { + request.connection(connection); + } + IllegalStateException ie = assertThrows(IllegalStateException.class, () -> request.submit(requestEntity)); + if (errorMessage != null) { + assertThat(ie.getMessage(), containsString(errorMessage)); + } + } + + private static void validateChunkTransfer(Http1ClientResponse response, boolean chunked, long contentLength, String entity) { + assertThat(response.status(), is(Http.Status.OK_200)); + if (contentLength == NO_CONTENT_LENGTH) { + assertThat(response.headers(), noHeader(REQ_CONTENT_LENGTH_HEADER_NAME)); + } else { + assertThat(response.headers(), hasHeader(REQ_CONTENT_LENGTH_HEADER_NAME, String.valueOf(contentLength))); + } + if (chunked) { + assertThat(response.headers(), hasHeader(REQ_CHUNKED_HEADER)); + } else { + assertThat(response.headers(), noHeader(REQ_CHUNKED_HEADER.headerName())); + } + String responseEntity = response.entity().as(String.class); + assertThat(responseEntity, is(entity)); + } + + private static Http1ClientRequest getHttp1ClientRequest(Http.Method method, String uriPath) { + return client.method(method).uri("http://localhost:" + dummyPort + uriPath); + } + + private static Http1ClientResponse getHttp1ClientResponseFromOutputStream(Http1ClientRequest request, + String[] requestEntityParts) { + Http1ClientResponse response = request.outputStream(it -> { + for (String r : requestEntityParts) { + it.write(r.getBytes(StandardCharsets.UTF_8)); + } + it.close(); + }); + return response; + } + + private static Stream relativeUris() { + return Stream.of( + // OutputStream (chunk request) + arguments(false, true, "http://www.dummy.com/test", "http://www.dummy.com:80/"), + arguments(false, true, "http://www.dummy.com:1111/test", "http://www.dummy.com:1111/"), + arguments(false, true, "https://www.dummy.com/test", "https://www.dummy.com:443/"), + arguments(false, true, "https://www.dummy.com:1111/test", "https://www.dummy.com:1111/"), + arguments(true, true, "http://www.dummy.com/test", "/test"), + arguments(true, true, "http://www.dummy.com:1111/test", "/test"), + arguments(true, true, "https://www.dummy.com/test", "/test"), + arguments(true, true, "https://www.dummy.com:1111/test", "/test"), + // non-OutputStream (single entity request) + arguments(false, false, "http://www.dummy.com/test", "http://www.dummy.com:80/"), + arguments(false, false, "http://www.dummy.com:1111/test", "http://www.dummy.com:1111/"), + arguments(false, false, "https://www.dummy.com/test", "https://www.dummy.com:443/"), + arguments(false, false, "https://www.dummy.com:1111/test", "https://www.dummy.com:1111/"), + arguments(true, false, "http://www.dummy.com/test", "/test"), + arguments(true, false, "http://www.dummy.com:1111/test", "/test"), + arguments(true, false, "https://www.dummy.com/test", "/test"), + arguments(true, false, "https://www.dummy.com:1111/test", "/test")); + } + + private static Stream headerValues() { + return Stream.of( + // Valid header values + arguments(Arrays.asList("Header Value"), true), + arguments(Arrays.asList("HeaderValue1", "Header\u0080Value\u00ff2"), true), + arguments(Arrays.asList("HeaderName1\u0009", "Header=Value2"), true), + // Invalid header values + arguments(Arrays.asList(" HeaderValue"), false), + arguments(Arrays.asList("HeaderValue1", "Header\u007fValue"), false), + arguments(Arrays.asList("HeaderValue1\r\n", "HeaderValue2"), false) + ); + } + + private static Stream headers() { + return Stream.of( + // Valid headers + arguments(Http.Headers.ACCEPT_RANGES_BYTES, true), + arguments(Http.Headers.CONNECTION_KEEP_ALIVE, true), + arguments(Http.Headers.CONTENT_TYPE_TEXT_PLAIN, true), + arguments(Http.Headers.ACCEPT_TEXT, true), + arguments(Http.Headers.CACHE_NO_CACHE, true), + arguments(Http.Headers.TE_TRAILERS, true), + arguments(Http.Headers.create("!#$Custom~%&\'*Header+^`|", "!Header\tValue~"), true), + arguments(Http.Headers.create("Custom_0-9_a-z_A-Z_Header", + "\u0080Header Value\u00ff"), true), + // Invalid headers + arguments(Http.Headers.create(VALID_HEADER_NAME, "H\u001ceaderValue1"), false), + arguments(Http.Headers.create(VALID_HEADER_NAME, + "HeaderValue1, Header\u007fValue"), false), + arguments(Http.Headers.create(VALID_HEADER_NAME, + "HeaderValue1\u001f, HeaderValue2"), false), + arguments(Http.Headers.create("Header\u001aName", VALID_HEADER_VALUE), false), + arguments(Http.Headers.create("Header\u000EName", VALID_HEADER_VALUE), false), + arguments(Http.Headers.create("HeaderName\r\n", VALID_HEADER_VALUE), false), + arguments(Http.Headers.create("HeaderName\u00FF\u0124", VALID_HEADER_VALUE), false), + arguments(Http.Headers.create("(Header:Name)", VALID_HEADER_VALUE), false), + arguments(Http.Headers.create("", VALID_HEADER_VALUE), false), + arguments(Http.Headers.create("{Header=Name}", VALID_HEADER_VALUE), false), + arguments(Http.Headers.create("\"HeaderName\"", VALID_HEADER_VALUE), false), + arguments(Http.Headers.create("[\\HeaderName]", VALID_HEADER_VALUE), false), + arguments(Http.Headers.create("@Header,Name;", VALID_HEADER_VALUE), false) + ); + } + + private static Stream responseHeaders() { + return Stream.of( + // Invalid header names + arguments("Header\u001aName", VALID_HEADER_VALUE, false), + arguments("Header\u000EName", VALID_HEADER_VALUE, false), + arguments("HeaderName\r\n", VALID_HEADER_VALUE, false), + arguments("(Header:Name)", VALID_HEADER_VALUE, false), + arguments("", VALID_HEADER_VALUE, false), + arguments("{Header=Name}", VALID_HEADER_VALUE, false), + arguments("\"HeaderName\"", VALID_HEADER_VALUE, false), + arguments("[\\HeaderName]", VALID_HEADER_VALUE, false), + arguments("@Header,Name;", VALID_HEADER_VALUE, false), + // Valid header names + arguments("!#$Custom~%&\'*Header+^`|", VALID_HEADER_VALUE, true), + arguments("Custom_0-9_a-z_A-Z_Header", VALID_HEADER_VALUE, true), + // Valid header values + arguments(VALID_HEADER_NAME, "Header Value", true), + arguments(VALID_HEADER_NAME, "HeaderValue1\u0009, Header=Value2", true), + arguments(VALID_HEADER_NAME, "Header\tValue", true), + arguments(VALID_HEADER_NAME, " Header Value ", true), + // Invalid header values + arguments(VALID_HEADER_NAME, "H\u001ceaderValue1", false), + arguments(VALID_HEADER_NAME, "HeaderValue1, Header\u007fValue", false), + arguments(VALID_HEADER_NAME, "HeaderValue1\u001f, HeaderValue2", false) + ); + } + + private static Stream responseHeadersForDisabledValidation() { + return Stream.of( + // Invalid header names + arguments("Header\u001aName", VALID_HEADER_VALUE, false), + arguments("Header\u000EName", VALID_HEADER_VALUE, false), + arguments("{Header=Name}", VALID_HEADER_VALUE, false), + arguments("\"HeaderName\"", VALID_HEADER_VALUE, false), + arguments("[\\HeaderName]", VALID_HEADER_VALUE, false), + arguments("@Header,Name;", VALID_HEADER_VALUE, false), + // Valid header names + arguments("!#$Custom~%&\'*Header+^`|", VALID_HEADER_VALUE, true), + arguments("Custom_0-9_a-z_A-Z_Header", VALID_HEADER_VALUE, true), + // Valid header values + arguments(VALID_HEADER_NAME, "Header Value", true), + arguments(VALID_HEADER_NAME, "HeaderValue1\u0009, Header=Value2", true), + arguments(VALID_HEADER_NAME, "Header\tValue", true), + arguments(VALID_HEADER_NAME, " Header Value ", true), + // Invalid header values + arguments(VALID_HEADER_NAME, "H\u001ceaderValue1", false), + arguments(VALID_HEADER_NAME, "HeaderValue1, Header\u007fValue", false), + arguments(VALID_HEADER_NAME, "HeaderValue1\u001f, HeaderValue2", false) + ); + } + + private static class FakeHttp1ClientConnection implements ClientConnection { + private final DataReader clientReader; + private final DataWriter clientWriter; + private final DataReader serverReader; + private final DataWriter serverWriter; + private Throwable serverException; + private ExecutorService webServerEmulator; + private String prologue; + + FakeHttp1ClientConnection() { + ArrayBlockingQueue serverToClient = new ArrayBlockingQueue<>(1024); + ArrayBlockingQueue clientToServer = new ArrayBlockingQueue<>(1024); + + this.clientReader = reader(serverToClient); + this.clientWriter = writer(clientToServer); + this.serverReader = reader(clientToServer); + this.serverWriter = writer(serverToClient); + } + + @Override + public HelidonSocket helidonSocket() { + return new FakeSocket(); + } + + @Override + public DataReader reader() { + return clientReader; + } + + @Override + public DataWriter writer() { + return clientWriter; + } + + @Override + public void releaseResource() { + } + + @Override + public void closeResource() { + webServerEmulator.shutdownNow(); + } + + @Override + public String channelId() { + return helidonSocket().socketId(); + } + + @Override + public void readTimeout(Duration readTimeout) { + //NOOP + } + + // This will be used for testing the element of Prologue + String getPrologue() { + return prologue; + } + + private DataWriter writer(ArrayBlockingQueue queue) { + return new DataWriter() { + @Override + public void write(BufferData... buffers) { + writeNow(buffers); + } + + @Override + public void write(BufferData buffer) { + writeNow(buffer); + } + + @Override + public void writeNow(BufferData... buffers) { + for (BufferData buffer : buffers) { + writeNow(buffer); + } + } + + @Override + public void writeNow(BufferData buffer) { + if (serverException != null) { + throw new IllegalStateException("Server exception", serverException); + } + if (webServerEmulator == null) { + webServerEmulator = Executors.newFixedThreadPool(1); + webServerEmulator.submit(() -> { + try { + webServerHandle(); + } catch (Throwable t) { + serverException = t; + throw t; + } + }); + } + + byte[] bytes = new byte[buffer.available()]; + buffer.read(bytes); + try { + queue.put(bytes); + } catch (InterruptedException e) { + throw new IllegalStateException("Thread interrupted", e); + } + } + }; + } + + private DataReader reader(ArrayBlockingQueue queue) { + return new DataReader(() -> { + if (serverException != null) { + throw new IllegalStateException("Server exception", serverException); + } + byte[] data; + try { + data = queue.poll(5, TimeUnit.SECONDS); + if (data == null) { + return null; + } + } catch (InterruptedException e) { + throw new IllegalArgumentException("Thread interrupted", e); + } + if (data.length == 0) { + return null; + } + return data; + }); + } + + private void webServerHandle() { + BufferData entity = BufferData.growing(128); + + // Read prologue + int lineLength = serverReader.findNewLine(16384); + if (lineLength > 0) { + prologue = serverReader.readAsciiString(lineLength); + serverReader.skip(2); // skip CRLF + } + + boolean requestFailed = false; + // Read Headers + WritableHeaders reqHeaders = null; + try { + reqHeaders = Http1HeadersParser.readHeaders(serverReader, 16384, false); + for (Iterator it = reqHeaders.iterator(); it.hasNext(); ) { + Http.Header header = it.next(); + header.validate(); + } + } catch (IllegalArgumentException e) { + requestFailed = true; + } + + int entitySize = 0; + if (!requestFailed) { + if (reqHeaders.contains(Http.Headers.TRANSFER_ENCODING_CHUNKED)) { + // Send 100-Continue if requested + if (reqHeaders.contains(Http.Headers.EXPECT_100)) { + serverWriter.write( + BufferData.create("HTTP/1.1 100 Continue\r\n".getBytes(StandardCharsets.UTF_8))); + } + + // Assemble the entity from the chunks + while (true) { + String hex = serverReader.readLine(); + int chunkLength = Integer.parseUnsignedInt(hex, 16); + if (chunkLength == 0) { + serverReader.readLine(); + break; + } + BufferData chunkData = serverReader.readBuffer(chunkLength); + entity.write(chunkData); + serverReader.skip(2); + entitySize += chunkLength; + } + } else if (reqHeaders.contains(Http.HeaderNames.CONTENT_LENGTH)) { + entitySize = reqHeaders.get(Http.HeaderNames.CONTENT_LENGTH).value(int.class); + if (entitySize > 0) { + entity.write(serverReader.getBuffer(entitySize)); + } + } + } + + WritableHeaders resHeaders = WritableHeaders.create(); + resHeaders.add(Http.Headers.CONNECTION_KEEP_ALIVE); + + if (reqHeaders != null) { + // Send headers that can be validated if Expect-100-Continue, Content_Length, and Chunked request headers exist + if (reqHeaders.contains(Http.Headers.EXPECT_100)) { + resHeaders.set(REQ_EXPECT_100_HEADER_NAME); + } + if (reqHeaders.contains(Http.HeaderNames.CONTENT_LENGTH)) { + resHeaders.set(REQ_CONTENT_LENGTH_HEADER_NAME, reqHeaders.get(Http.HeaderNames.CONTENT_LENGTH).value()); + } + if (reqHeaders.contains(Http.Headers.TRANSFER_ENCODING_CHUNKED)) { + resHeaders.set(REQ_CHUNKED_HEADER); + } + } + + // if prologue contains "/badHeader" path, send back the entity (name and value delimited by ->) as a header + if (getPrologue().contains(BAD_HEADER_PATH)) { + String[] header = entity.readString(entitySize, StandardCharsets.US_ASCII).split(HEADER_NAME_VALUE_DELIMETER); + resHeaders.add(Http.Headers.create(header[0], header[1])); + } + + String responseMessage = !requestFailed ? "HTTP/1.1 200 OK\r\n" : "HTTP/1.1 400 Bad Request\r\n"; + serverWriter.write(BufferData.create(responseMessage.getBytes(StandardCharsets.UTF_8))); + + // Send the headers + resHeaders.add(Http.HeaderNames.CONTENT_LENGTH, Integer.toString(entitySize)); + BufferData entityBuffer = BufferData.growing(128); + for (Http.Header header : resHeaders) { + header.writeHttp1Header(entityBuffer); + } + entityBuffer.write(Bytes.CR_BYTE); + entityBuffer.write(Bytes.LF_BYTE); + serverWriter.write(entityBuffer); + + // Send the entity if it exist + if (entitySize > 0) { + serverWriter.write(entity); + } + } + + } + + private static class FakeSocket implements HelidonSocket { + @Override + public void close() { + + } + + @Override + public int read(BufferData buffer) { + return 0; + } + + @Override + public void write(BufferData buffer) { + + } + + @Override + public PeerInfo remotePeer() { + return null; + } + + @Override + public PeerInfo localPeer() { + return null; + } + + @Override + public boolean isSecure() { + return false; + } + + @Override + public String socketId() { + return "fake"; + } + + @Override + public String childSocketId() { + return "fake"; + } + + @Override + public byte[] get() { + return new byte[0]; + } + } + + private static class CustomizedMediaContext implements MediaContext { + private final MediaContext delegated = MediaContext.create(); + + @Override + public MediaContextConfig prototype() { + return delegated.prototype(); + } + + @Override + public EntityReader reader(GenericType type, Headers headers) { + return delegated.reader(type, headers); + } + + @Override + public EntityWriter writer(GenericType type, Headers requestHeaders, WritableHeaders responseHeaders) { + EntityWriter impl = delegated.writer(type, requestHeaders, responseHeaders); + + EntityWriter realWriter = new EntityWriter() { + @Override + public void write(GenericType type, + T object, + OutputStream outputStream, + Headers requestHeaders, + WritableHeaders responseHeaders) { + if (object instanceof String) { + @SuppressWarnings("unchecked") final T maxLen5 = (T) ((String) object).substring(0, 5); + impl.write(type, maxLen5, outputStream, requestHeaders, responseHeaders); + } else { + impl.write(type, object, outputStream, requestHeaders, responseHeaders); + } + } + + @Override + public void write(GenericType type, T object, OutputStream outputStream, WritableHeaders headers) { + impl.write(type, object, outputStream, headers); + } + }; + return realWriter; + } + + @Override + public EntityReader reader(GenericType type, Headers requestHeaders, Headers responseHeaders) { + return delegated.reader(type, requestHeaders, responseHeaders); + } + + @Override + public EntityWriter writer(GenericType type, WritableHeaders requestHeaders) { + return delegated.writer(type, requestHeaders); + } + } +} diff --git a/nima/webclient/http1/src/test/java/io/helidon/nima/webclient/http1/Http1StatusParserTest.java b/webclient/http1/src/test/java/io/helidon/webclient/http1/Http1StatusParserTest.java similarity index 95% rename from nima/webclient/http1/src/test/java/io/helidon/nima/webclient/http1/Http1StatusParserTest.java rename to webclient/http1/src/test/java/io/helidon/webclient/http1/Http1StatusParserTest.java index 50e66c4cfa8..52f33aba42b 100644 --- a/nima/webclient/http1/src/test/java/io/helidon/nima/webclient/http1/Http1StatusParserTest.java +++ b/webclient/http1/src/test/java/io/helidon/webclient/http1/Http1StatusParserTest.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.helidon.nima.webclient.http1; +package io.helidon.webclient.http1; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import io.helidon.common.buffers.DataReader; -import io.helidon.common.http.Http.Status; +import io.helidon.http.Http.Status; import org.junit.jupiter.api.Test; diff --git a/webclient/http2/etc/spotbugs/exclude.xml b/webclient/http2/etc/spotbugs/exclude.xml new file mode 100644 index 00000000000..5666fb417d6 --- /dev/null +++ b/webclient/http2/etc/spotbugs/exclude.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + diff --git a/webclient/http2/pom.xml b/webclient/http2/pom.xml new file mode 100644 index 00000000000..c52bcab5a59 --- /dev/null +++ b/webclient/http2/pom.xml @@ -0,0 +1,139 @@ + + + + 4.0.0 + + io.helidon.webclient + helidon-webclient-project + 4.0.0-SNAPSHOT + + + helidon-webclient-http2 + Helidon WebClient HTTP/2 + + + etc/spotbugs/exclude.xml + + + + + io.helidon.http + helidon-http-http2 + + + io.helidon.http.encoding + helidon-http-encoding + + + io.helidon.webclient + helidon-webclient + + + io.helidon.common.features + helidon-common-features-api + true + + + io.helidon.config + helidon-config-metadata + true + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + io.helidon.webserver + helidon-webserver-http2 + test + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 + test + + + org.junit.jupiter + junit-jupiter-params + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + io.helidon.config + helidon-config-metadata-processor + ${helidon.version} + + + io.helidon.builder + helidon-builder-processor + ${helidon.version} + + + io.helidon.common.processor + helidon-common-processor-helidon-copyright + ${helidon.version} + + + + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + io.helidon.config + helidon-config-metadata-processor + ${helidon.version} + + + io.helidon.builder + helidon-builder-processor + ${helidon.version} + + + io.helidon.common.processor + helidon-common-processor-helidon-copyright + ${helidon.version} + + + + + + + diff --git a/webclient/http2/src/main/java/io/helidon/webclient/http2/ConnectionContext.java b/webclient/http2/src/main/java/io/helidon/webclient/http2/ConnectionContext.java new file mode 100644 index 00000000000..f9b4b64b51d --- /dev/null +++ b/webclient/http2/src/main/java/io/helidon/webclient/http2/ConnectionContext.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.webclient.http2; + +import java.time.Duration; + +record ConnectionContext(int initialWindowSize, + int maxFrameSize, + long maxHeaderListSize, + int connectionPrefetch, + int requestPrefetch, + Duration flowControlTimeout, + Duration timeout) { +} diff --git a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2CallChainBase.java b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2CallChainBase.java similarity index 89% rename from nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2CallChainBase.java rename to webclient/http2/src/main/java/io/helidon/webclient/http2/Http2CallChainBase.java index e707337d0d4..7f4b8a57887 100644 --- a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2CallChainBase.java +++ b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2CallChainBase.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2.webclient; +package io.helidon.webclient.http2; import java.io.InputStream; import java.nio.charset.StandardCharsets; @@ -24,26 +24,26 @@ import java.util.function.Function; import io.helidon.common.buffers.BufferData; -import io.helidon.common.http.ClientRequestHeaders; -import io.helidon.common.http.ClientResponseHeaders; -import io.helidon.common.http.Http; -import io.helidon.nima.common.tls.Tls; -import io.helidon.nima.http.encoding.ContentDecoder; -import io.helidon.nima.http.encoding.ContentEncodingContext; -import io.helidon.nima.http2.Http2Headers; -import io.helidon.nima.webclient.api.ClientUri; -import io.helidon.nima.webclient.api.ConnectionKey; -import io.helidon.nima.webclient.api.HttpClientConfig; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.api.ReleasableResource; -import io.helidon.nima.webclient.api.WebClientServiceRequest; -import io.helidon.nima.webclient.api.WebClientServiceResponse; -import io.helidon.nima.webclient.http1.Http1ClientRequest; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webclient.spi.WebClientService; - -import static io.helidon.common.http.Http.HeaderNames.CONTENT_ENCODING; -import static io.helidon.nima.webclient.api.ClientRequestBase.USER_AGENT_HEADER; +import io.helidon.common.tls.Tls; +import io.helidon.http.ClientRequestHeaders; +import io.helidon.http.ClientResponseHeaders; +import io.helidon.http.Http; +import io.helidon.http.encoding.ContentDecoder; +import io.helidon.http.encoding.ContentEncodingContext; +import io.helidon.http.http2.Http2Headers; +import io.helidon.webclient.api.ClientUri; +import io.helidon.webclient.api.ConnectionKey; +import io.helidon.webclient.api.HttpClientConfig; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.api.ReleasableResource; +import io.helidon.webclient.api.WebClientServiceRequest; +import io.helidon.webclient.api.WebClientServiceResponse; +import io.helidon.webclient.http1.Http1ClientRequest; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webclient.spi.WebClientService; + +import static io.helidon.http.Http.HeaderNames.CONTENT_ENCODING; +import static io.helidon.webclient.api.ClientRequestBase.USER_AGENT_HEADER; abstract class Http2CallChainBase implements WebClientService.Chain { private static final Tls NO_TLS = Tls.builder().enabled(false).build(); @@ -56,9 +56,7 @@ abstract class Http2CallChainBase implements WebClientService.Chain { private Http2ClientStream stream; private HttpClientResponse response; private ClientRequestHeaders requestHeaders; - private ClientResponseHeaders responseHeaders; private Http.Status responseStatus; - private Http2ConnectionAttemptResult.Result result; Http2CallChainBase(Http2ClientImpl http2Client, Http2ClientRequestImpl clientRequest, @@ -86,8 +84,6 @@ public WebClientServiceResponse proceed(WebClientServiceRequest serviceRequest) Http2ConnectionAttemptResult result = http2Client.connectionCache() .newStream(http2Client, connectionKey, clientRequest, uri, http1EntityHandler); - this.result = result.result(); - try { if (result.result() == Http2ConnectionAttemptResult.Result.HTTP_2) { // ALPN, prior knowledge, or upgrade success @@ -132,7 +128,6 @@ protected abstract WebClientServiceResponse doProceed(WebClientServiceRequest se * @return correct response */ protected WebClientServiceResponse doProceed(WebClientServiceRequest serviceRequest, HttpClientResponse response) { - this.responseHeaders = response.headers(); this.responseStatus = response.status(); WebClientServiceResponse.Builder builder = WebClientServiceResponse.builder(); diff --git a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2CallEntityChain.java b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2CallEntityChain.java similarity index 88% rename from nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2CallEntityChain.java rename to webclient/http2/src/main/java/io/helidon/webclient/http2/Http2CallEntityChain.java index cc9a8555597..3174bf29852 100644 --- a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2CallEntityChain.java +++ b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2CallEntityChain.java @@ -14,20 +14,20 @@ * limitations under the License. */ -package io.helidon.nima.http2.webclient; +package io.helidon.webclient.http2; import java.io.ByteArrayOutputStream; import java.util.concurrent.CompletableFuture; import io.helidon.common.GenericType; import io.helidon.common.buffers.BufferData; -import io.helidon.common.http.ClientRequestHeaders; -import io.helidon.common.http.Http; -import io.helidon.nima.http.media.EntityWriter; -import io.helidon.nima.http2.Http2Headers; -import io.helidon.nima.webclient.api.ClientUri; -import io.helidon.nima.webclient.api.WebClientServiceRequest; -import io.helidon.nima.webclient.api.WebClientServiceResponse; +import io.helidon.http.ClientRequestHeaders; +import io.helidon.http.Http; +import io.helidon.http.http2.Http2Headers; +import io.helidon.http.media.EntityWriter; +import io.helidon.webclient.api.ClientUri; +import io.helidon.webclient.api.WebClientServiceRequest; +import io.helidon.webclient.api.WebClientServiceResponse; class Http2CallEntityChain extends Http2CallChainBase { private final CompletableFuture whenSent; diff --git a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2CallOutputStreamChain.java b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2CallOutputStreamChain.java similarity index 87% rename from nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2CallOutputStreamChain.java rename to webclient/http2/src/main/java/io/helidon/webclient/http2/Http2CallOutputStreamChain.java index 74f56820f05..6c54a956b95 100644 --- a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2CallOutputStreamChain.java +++ b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2CallOutputStreamChain.java @@ -14,18 +14,18 @@ * limitations under the License. */ -package io.helidon.nima.http2.webclient; +package io.helidon.webclient.http2; import java.io.IOException; import java.io.UncheckedIOException; import java.util.concurrent.CompletableFuture; -import io.helidon.common.http.ClientRequestHeaders; -import io.helidon.nima.http2.Http2Headers; -import io.helidon.nima.webclient.api.ClientRequest; -import io.helidon.nima.webclient.api.ClientUri; -import io.helidon.nima.webclient.api.WebClientServiceRequest; -import io.helidon.nima.webclient.api.WebClientServiceResponse; +import io.helidon.http.ClientRequestHeaders; +import io.helidon.http.http2.Http2Headers; +import io.helidon.webclient.api.ClientRequest; +import io.helidon.webclient.api.ClientUri; +import io.helidon.webclient.api.WebClientServiceRequest; +import io.helidon.webclient.api.WebClientServiceResponse; class Http2CallOutputStreamChain extends Http2CallChainBase { private final CompletableFuture whenSent; diff --git a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2Client.java b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2Client.java similarity index 94% rename from nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2Client.java rename to webclient/http2/src/main/java/io/helidon/webclient/http2/Http2Client.java index 1829092a036..c1d35f6c7a3 100644 --- a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2Client.java +++ b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2Client.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.nima.http2.webclient; +package io.helidon.webclient.http2; import java.util.function.Consumer; import io.helidon.builder.api.RuntimeType; import io.helidon.common.config.Config; -import io.helidon.nima.webclient.api.HttpClient; -import io.helidon.nima.webclient.api.WebClient; +import io.helidon.webclient.api.HttpClient; +import io.helidon.webclient.api.WebClient; /** * HTTP2 client. diff --git a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientConfigBlueprint.java b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientConfigBlueprint.java similarity index 91% rename from nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientConfigBlueprint.java rename to webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientConfigBlueprint.java index aed0d98c77a..7eea6b8c8b4 100644 --- a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientConfigBlueprint.java +++ b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientConfigBlueprint.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.helidon.nima.http2.webclient; +package io.helidon.webclient.http2; import io.helidon.builder.api.Prototype; import io.helidon.config.metadata.ConfiguredOption; -import io.helidon.nima.webclient.api.HttpClientConfig; +import io.helidon.webclient.api.HttpClientConfig; /** * HTTP/2 full webclient configuration. diff --git a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientConfigSupport.java b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientConfigSupport.java similarity index 94% rename from nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientConfigSupport.java rename to webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientConfigSupport.java index 3ea64e4b183..e4a9c9c243a 100644 --- a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientConfigSupport.java +++ b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientConfigSupport.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.helidon.nima.http2.webclient; +package io.helidon.webclient.http2; import io.helidon.builder.api.Prototype; -import io.helidon.nima.http2.WindowSize; +import io.helidon.http.http2.WindowSize; class Http2ClientConfigSupport { static class ProtocolConfigDecorator implements Prototype.BuilderDecorator> { diff --git a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientConnection.java b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientConnection.java similarity index 94% rename from nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientConnection.java rename to webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientConnection.java index abac2907bc3..8a1f6d21ad6 100644 --- a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientConnection.java +++ b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientConnection.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2.webclient; +package io.helidon.webclient.http2; import java.io.UncheckedIOException; import java.util.HashMap; @@ -32,27 +32,27 @@ import io.helidon.common.buffers.DataReader; import io.helidon.common.buffers.DataWriter; import io.helidon.common.socket.SocketContext; -import io.helidon.nima.http2.ConnectionFlowControl; -import io.helidon.nima.http2.Http2ConnectionWriter; -import io.helidon.nima.http2.Http2ErrorCode; -import io.helidon.nima.http2.Http2Exception; -import io.helidon.nima.http2.Http2Flag; -import io.helidon.nima.http2.Http2FrameData; -import io.helidon.nima.http2.Http2FrameHeader; -import io.helidon.nima.http2.Http2FrameListener; -import io.helidon.nima.http2.Http2FrameTypes; -import io.helidon.nima.http2.Http2GoAway; -import io.helidon.nima.http2.Http2Headers; -import io.helidon.nima.http2.Http2LoggingFrameListener; -import io.helidon.nima.http2.Http2Ping; -import io.helidon.nima.http2.Http2RstStream; -import io.helidon.nima.http2.Http2Setting; -import io.helidon.nima.http2.Http2Settings; -import io.helidon.nima.http2.Http2StreamState; -import io.helidon.nima.http2.Http2Util; -import io.helidon.nima.http2.Http2WindowUpdate; -import io.helidon.nima.http2.WindowSize; -import io.helidon.nima.webclient.api.ClientConnection; +import io.helidon.http.http2.ConnectionFlowControl; +import io.helidon.http.http2.Http2ConnectionWriter; +import io.helidon.http.http2.Http2ErrorCode; +import io.helidon.http.http2.Http2Exception; +import io.helidon.http.http2.Http2Flag; +import io.helidon.http.http2.Http2FrameData; +import io.helidon.http.http2.Http2FrameHeader; +import io.helidon.http.http2.Http2FrameListener; +import io.helidon.http.http2.Http2FrameTypes; +import io.helidon.http.http2.Http2GoAway; +import io.helidon.http.http2.Http2Headers; +import io.helidon.http.http2.Http2LoggingFrameListener; +import io.helidon.http.http2.Http2Ping; +import io.helidon.http.http2.Http2RstStream; +import io.helidon.http.http2.Http2Setting; +import io.helidon.http.http2.Http2Settings; +import io.helidon.http.http2.Http2StreamState; +import io.helidon.http.http2.Http2Util; +import io.helidon.http.http2.Http2WindowUpdate; +import io.helidon.http.http2.WindowSize; +import io.helidon.webclient.api.ClientConnection; import static java.lang.System.Logger.Level.DEBUG; import static java.lang.System.Logger.Level.TRACE; diff --git a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientConnectionHandler.java b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientConnectionHandler.java similarity index 95% rename from nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientConnectionHandler.java rename to webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientConnectionHandler.java index 84e720ef167..386095dc6c7 100644 --- a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientConnectionHandler.java +++ b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientConnectionHandler.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2.webclient; +package io.helidon.webclient.http2; import java.util.Base64; import java.util.Collections; @@ -29,20 +29,20 @@ import java.util.function.Function; import io.helidon.common.buffers.BufferData; -import io.helidon.common.http.Http; -import io.helidon.nima.http2.Http2Flag; -import io.helidon.nima.http2.Http2Settings; -import io.helidon.nima.http2.webclient.Http2ConnectionAttemptResult.Result; -import io.helidon.nima.webclient.api.ClientConnection; -import io.helidon.nima.webclient.api.ClientUri; -import io.helidon.nima.webclient.api.ConnectionKey; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.api.TcpClientConnection; -import io.helidon.nima.webclient.api.WebClient; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientRequest; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webclient.http1.UpgradeResponse; +import io.helidon.http.Http; +import io.helidon.http.http2.Http2Flag; +import io.helidon.http.http2.Http2Settings; +import io.helidon.webclient.api.ClientConnection; +import io.helidon.webclient.api.ClientUri; +import io.helidon.webclient.api.ConnectionKey; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.api.TcpClientConnection; +import io.helidon.webclient.api.WebClient; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientRequest; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webclient.http1.UpgradeResponse; +import io.helidon.webclient.http2.Http2ConnectionAttemptResult.Result; import static java.lang.System.Logger.Level.TRACE; diff --git a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientImpl.java b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientImpl.java similarity index 91% rename from nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientImpl.java rename to webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientImpl.java index a1fc9956f1f..e3b63d3a713 100644 --- a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientImpl.java +++ b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientImpl.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package io.helidon.nima.http2.webclient; +package io.helidon.webclient.http2; -import io.helidon.common.http.Http; import io.helidon.common.uri.UriQueryWriteable; -import io.helidon.nima.webclient.api.ClientRequest; -import io.helidon.nima.webclient.api.ClientUri; -import io.helidon.nima.webclient.api.ConnectionKey; -import io.helidon.nima.webclient.api.FullClientRequest; -import io.helidon.nima.webclient.api.WebClient; -import io.helidon.nima.webclient.spi.HttpClientSpi; +import io.helidon.http.Http; +import io.helidon.webclient.api.ClientRequest; +import io.helidon.webclient.api.ClientUri; +import io.helidon.webclient.api.ConnectionKey; +import io.helidon.webclient.api.FullClientRequest; +import io.helidon.webclient.api.WebClient; +import io.helidon.webclient.spi.HttpClientSpi; class Http2ClientImpl implements Http2Client, HttpClientSpi { private final WebClient webClient; diff --git a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientProtocolConfigBlueprint.java b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientProtocolConfigBlueprint.java similarity index 96% rename from nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientProtocolConfigBlueprint.java rename to webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientProtocolConfigBlueprint.java index 7ca79778b9d..c66735b7bd4 100644 --- a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientProtocolConfigBlueprint.java +++ b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientProtocolConfigBlueprint.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.nima.http2.webclient; +package io.helidon.webclient.http2; import java.time.Duration; import io.helidon.builder.api.Prototype; import io.helidon.config.metadata.Configured; import io.helidon.config.metadata.ConfiguredOption; -import io.helidon.nima.webclient.spi.ProtocolConfig; +import io.helidon.webclient.spi.ProtocolConfig; @Prototype.Blueprint(decorator = Http2ClientConfigSupport.ProtocolConfigDecorator.class) @Configured @@ -77,7 +77,7 @@ default String type() { /** * Configure INITIAL_WINDOW_SIZE setting for new HTTP/2 connections. * Sends to the server the size of the largest frame payload client is willing to receive. - * Defaults to {@value io.helidon.nima.http2.WindowSize#DEFAULT_WIN_SIZE}. + * Defaults to {@value io.helidon.http.http2.WindowSize#DEFAULT_WIN_SIZE}. * * @return units of octets */ diff --git a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientRequest.java b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientRequest.java similarity index 96% rename from nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientRequest.java rename to webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientRequest.java index 7e725df859d..cb74a2a2233 100644 --- a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientRequest.java +++ b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientRequest.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.nima.http2.webclient; +package io.helidon.webclient.http2; import java.time.Duration; import io.helidon.common.buffers.BufferData; -import io.helidon.nima.webclient.api.ClientRequest; +import io.helidon.webclient.api.ClientRequest; /** * Request of HTTP/2 client. diff --git a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientRequestImpl.java b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientRequestImpl.java similarity index 96% rename from nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientRequestImpl.java rename to webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientRequestImpl.java index f0808622291..684f98ac280 100644 --- a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientRequestImpl.java +++ b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientRequestImpl.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2.webclient; +package io.helidon.webclient.http2; import java.net.URI; import java.time.Duration; @@ -22,12 +22,12 @@ import java.util.concurrent.CompletableFuture; import io.helidon.common.buffers.BufferData; -import io.helidon.common.http.Http; -import io.helidon.nima.webclient.api.ClientRequestBase; -import io.helidon.nima.webclient.api.ClientUri; -import io.helidon.nima.webclient.api.FullClientRequest; -import io.helidon.nima.webclient.api.WebClientServiceRequest; -import io.helidon.nima.webclient.api.WebClientServiceResponse; +import io.helidon.http.Http; +import io.helidon.webclient.api.ClientRequestBase; +import io.helidon.webclient.api.ClientUri; +import io.helidon.webclient.api.FullClientRequest; +import io.helidon.webclient.api.WebClientServiceRequest; +import io.helidon.webclient.api.WebClientServiceResponse; class Http2ClientRequestImpl extends ClientRequestBase implements Http2ClientRequest, Http2StreamConfig, FullClientRequest { diff --git a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientResponse.java b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientResponse.java similarity index 88% rename from nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientResponse.java rename to webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientResponse.java index c644e268ffc..153d16090f3 100644 --- a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientResponse.java +++ b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientResponse.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.helidon.nima.http2.webclient; +package io.helidon.webclient.http2; -import io.helidon.nima.webclient.api.HttpClientResponse; +import io.helidon.webclient.api.HttpClientResponse; /** * Response of HTTP/2 client. diff --git a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientResponseImpl.java b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientResponseImpl.java similarity index 90% rename from nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientResponseImpl.java rename to webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientResponseImpl.java index 1cddbf2ec8f..4109a7742d8 100644 --- a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientResponseImpl.java +++ b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientResponseImpl.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2.webclient; +package io.helidon.webclient.http2; import java.io.IOException; import java.io.InputStream; @@ -23,13 +23,13 @@ import java.util.concurrent.atomic.AtomicBoolean; import io.helidon.common.buffers.BufferData; -import io.helidon.common.http.ClientRequestHeaders; -import io.helidon.common.http.ClientResponseHeaders; -import io.helidon.common.http.Http; -import io.helidon.nima.http.media.MediaContext; -import io.helidon.nima.http.media.ReadableEntity; -import io.helidon.nima.webclient.api.ClientResponseEntity; -import io.helidon.nima.webclient.api.ClientUri; +import io.helidon.http.ClientRequestHeaders; +import io.helidon.http.ClientResponseHeaders; +import io.helidon.http.Http; +import io.helidon.http.media.MediaContext; +import io.helidon.http.media.ReadableEntity; +import io.helidon.webclient.api.ClientResponseEntity; +import io.helidon.webclient.api.ClientUri; class Http2ClientResponseImpl implements Http2ClientResponse { private final Http.Status responseStatus; diff --git a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientSpiProvider.java b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientSpiProvider.java similarity index 89% rename from nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientSpiProvider.java rename to webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientSpiProvider.java index 5a7b4e9b616..75e28bbbe32 100644 --- a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientSpiProvider.java +++ b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientSpiProvider.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.helidon.nima.http2.webclient; +package io.helidon.webclient.http2; -import io.helidon.nima.webclient.api.WebClient; -import io.helidon.nima.webclient.spi.HttpClientSpi; -import io.helidon.nima.webclient.spi.HttpClientSpiProvider; +import io.helidon.webclient.api.WebClient; +import io.helidon.webclient.spi.HttpClientSpi; +import io.helidon.webclient.spi.HttpClientSpiProvider; /** * {@link java.util.ServiceLoader} provider implementation for HTTP/2 protocol. diff --git a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientStream.java b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientStream.java similarity index 93% rename from nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientStream.java rename to webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientStream.java index ad54622890e..38f80a3358f 100644 --- a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ClientStream.java +++ b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ClientStream.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2.webclient; +package io.helidon.webclient.http2; import java.io.IOException; import java.io.OutputStream; @@ -26,27 +26,27 @@ import io.helidon.common.buffers.BufferData; import io.helidon.common.socket.SocketContext; -import io.helidon.nima.http2.Http2ErrorCode; -import io.helidon.nima.http2.Http2Exception; -import io.helidon.nima.http2.Http2Flag; -import io.helidon.nima.http2.Http2FrameData; -import io.helidon.nima.http2.Http2FrameHeader; -import io.helidon.nima.http2.Http2FrameListener; -import io.helidon.nima.http2.Http2FrameType; -import io.helidon.nima.http2.Http2FrameTypes; -import io.helidon.nima.http2.Http2Headers; -import io.helidon.nima.http2.Http2HuffmanDecoder; -import io.helidon.nima.http2.Http2LoggingFrameListener; -import io.helidon.nima.http2.Http2Priority; -import io.helidon.nima.http2.Http2RstStream; -import io.helidon.nima.http2.Http2Setting; -import io.helidon.nima.http2.Http2Settings; -import io.helidon.nima.http2.Http2Stream; -import io.helidon.nima.http2.Http2StreamState; -import io.helidon.nima.http2.Http2WindowUpdate; -import io.helidon.nima.http2.StreamFlowControl; -import io.helidon.nima.http2.WindowSize; -import io.helidon.nima.webclient.api.ReleasableResource; +import io.helidon.http.http2.Http2ErrorCode; +import io.helidon.http.http2.Http2Exception; +import io.helidon.http.http2.Http2Flag; +import io.helidon.http.http2.Http2FrameData; +import io.helidon.http.http2.Http2FrameHeader; +import io.helidon.http.http2.Http2FrameListener; +import io.helidon.http.http2.Http2FrameType; +import io.helidon.http.http2.Http2FrameTypes; +import io.helidon.http.http2.Http2Headers; +import io.helidon.http.http2.Http2HuffmanDecoder; +import io.helidon.http.http2.Http2LoggingFrameListener; +import io.helidon.http.http2.Http2Priority; +import io.helidon.http.http2.Http2RstStream; +import io.helidon.http.http2.Http2Setting; +import io.helidon.http.http2.Http2Settings; +import io.helidon.http.http2.Http2Stream; +import io.helidon.http.http2.Http2StreamState; +import io.helidon.http.http2.Http2WindowUpdate; +import io.helidon.http.http2.StreamFlowControl; +import io.helidon.http.http2.WindowSize; +import io.helidon.webclient.api.ReleasableResource; import static java.lang.System.Logger.Level.DEBUG; diff --git a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ConnectionAttemptResult.java b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ConnectionAttemptResult.java similarity index 89% rename from nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ConnectionAttemptResult.java rename to webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ConnectionAttemptResult.java index c8004d798c3..77dbe39c0fc 100644 --- a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ConnectionAttemptResult.java +++ b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ConnectionAttemptResult.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.helidon.nima.http2.webclient; +package io.helidon.webclient.http2; -import io.helidon.nima.webclient.api.HttpClientResponse; +import io.helidon.webclient.api.HttpClientResponse; record Http2ConnectionAttemptResult(Result result, Http2ClientStream stream, diff --git a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ConnectionCache.java b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ConnectionCache.java similarity index 91% rename from nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ConnectionCache.java rename to webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ConnectionCache.java index e5f5af23f44..8dd1538bd26 100644 --- a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ConnectionCache.java +++ b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ConnectionCache.java @@ -14,17 +14,17 @@ * limitations under the License. */ -package io.helidon.nima.http2.webclient; +package io.helidon.webclient.http2; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; import io.helidon.common.configurable.LruCache; -import io.helidon.nima.webclient.api.ClientUri; -import io.helidon.nima.webclient.api.ConnectionKey; -import io.helidon.nima.webclient.http1.Http1ClientRequest; -import io.helidon.nima.webclient.http1.Http1ClientResponse; +import io.helidon.webclient.api.ClientUri; +import io.helidon.webclient.api.ConnectionKey; +import io.helidon.webclient.http1.Http1ClientRequest; +import io.helidon.webclient.http1.Http1ClientResponse; final class Http2ConnectionCache { //todo Gracefully close connections in channel cache diff --git a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ProtocolProvider.java b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ProtocolProvider.java similarity index 91% rename from nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ProtocolProvider.java rename to webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ProtocolProvider.java index 03281665aa1..f429d791951 100644 --- a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2ProtocolProvider.java +++ b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2ProtocolProvider.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.helidon.nima.http2.webclient; +package io.helidon.webclient.http2; -import io.helidon.nima.webclient.api.WebClient; -import io.helidon.nima.webclient.spi.ClientProtocolProvider; +import io.helidon.webclient.api.WebClient; +import io.helidon.webclient.spi.ClientProtocolProvider; class Http2ProtocolProvider implements ClientProtocolProvider { static final String CONFIG_KEY = "h2"; diff --git a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2StreamConfig.java b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2StreamConfig.java similarity index 94% rename from nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2StreamConfig.java rename to webclient/http2/src/main/java/io/helidon/webclient/http2/Http2StreamConfig.java index 594a850a512..9b3d267da02 100644 --- a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/Http2StreamConfig.java +++ b/webclient/http2/src/main/java/io/helidon/webclient/http2/Http2StreamConfig.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2.webclient; +package io.helidon.webclient.http2; import java.time.Duration; diff --git a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/LockingStreamIdSequence.java b/webclient/http2/src/main/java/io/helidon/webclient/http2/LockingStreamIdSequence.java similarity index 96% rename from nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/LockingStreamIdSequence.java rename to webclient/http2/src/main/java/io/helidon/webclient/http2/LockingStreamIdSequence.java index 32bb2d50725..51b605286e5 100644 --- a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/LockingStreamIdSequence.java +++ b/webclient/http2/src/main/java/io/helidon/webclient/http2/LockingStreamIdSequence.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.http2.webclient; +package io.helidon.webclient.http2; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.locks.Lock; diff --git a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/StreamBuffer.java b/webclient/http2/src/main/java/io/helidon/webclient/http2/StreamBuffer.java similarity index 96% rename from nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/StreamBuffer.java rename to webclient/http2/src/main/java/io/helidon/webclient/http2/StreamBuffer.java index ae5aba22de9..1644845de73 100644 --- a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/StreamBuffer.java +++ b/webclient/http2/src/main/java/io/helidon/webclient/http2/StreamBuffer.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2.webclient; +package io.helidon.webclient.http2; import java.time.Duration; import java.util.ArrayDeque; @@ -24,7 +24,7 @@ import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; -import io.helidon.nima.http2.Http2FrameData; +import io.helidon.http.http2.Http2FrameData; class StreamBuffer { diff --git a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/StreamTimeoutException.java b/webclient/http2/src/main/java/io/helidon/webclient/http2/StreamTimeoutException.java similarity index 95% rename from nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/StreamTimeoutException.java rename to webclient/http2/src/main/java/io/helidon/webclient/http2/StreamTimeoutException.java index e8214036c07..9703c5a1dd7 100644 --- a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/StreamTimeoutException.java +++ b/webclient/http2/src/main/java/io/helidon/webclient/http2/StreamTimeoutException.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2.webclient; +package io.helidon.webclient.http2; import java.time.Duration; diff --git a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/UpgradeRedirectException.java b/webclient/http2/src/main/java/io/helidon/webclient/http2/UpgradeRedirectException.java similarity index 95% rename from nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/UpgradeRedirectException.java rename to webclient/http2/src/main/java/io/helidon/webclient/http2/UpgradeRedirectException.java index 6fef921112b..ab33bcb584b 100644 --- a/nima/http2/webclient/src/main/java/io/helidon/nima/http2/webclient/UpgradeRedirectException.java +++ b/webclient/http2/src/main/java/io/helidon/webclient/http2/UpgradeRedirectException.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.http2.webclient; +package io.helidon.webclient.http2; class UpgradeRedirectException extends RuntimeException { private final String redirectUri; diff --git a/webclient/http2/src/main/java/io/helidon/webclient/http2/package-info.java b/webclient/http2/src/main/java/io/helidon/webclient/http2/package-info.java new file mode 100644 index 00000000000..15e0b6ac7ea --- /dev/null +++ b/webclient/http2/src/main/java/io/helidon/webclient/http2/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebClient HTTP/2 Support. + */ +package io.helidon.webclient.http2; diff --git a/webclient/http2/src/main/java/module-info.java b/webclient/http2/src/main/java/module-info.java new file mode 100644 index 00000000000..ae9d8823335 --- /dev/null +++ b/webclient/http2/src/main/java/module-info.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.common.features.api.Feature; +import io.helidon.common.features.api.HelidonFlavor; + +/** + * Helidon WebClient HTTP/2 Support. + */ +@Feature(value = "HTTP/2", + description = "WebClient HTTP/2 support", + in = HelidonFlavor.SE, + path = {"WebClient", "HTTP/2"} +) +module io.helidon.webclient.http2 { + requires static io.helidon.common.features.api; + requires static io.helidon.config.metadata; + + requires transitive io.helidon.builder.api; + requires transitive io.helidon.http.http2; + requires transitive io.helidon.webclient; + requires transitive io.helidon.common.pki; + + exports io.helidon.webclient.http2; +} diff --git a/nima/http2/webclient/src/test/java/io/helidon/nima/http2/webclient/Http2WebClientTest.java b/webclient/http2/src/test/java/io/helidon/webclient/http2/Http2WebClientTest.java similarity index 93% rename from nima/http2/webclient/src/test/java/io/helidon/nima/http2/webclient/Http2WebClientTest.java rename to webclient/http2/src/test/java/io/helidon/webclient/http2/Http2WebClientTest.java index 7461e353786..002cef7ba4b 100644 --- a/nima/http2/webclient/src/test/java/io/helidon/nima/http2/webclient/Http2WebClientTest.java +++ b/webclient/http2/src/test/java/io/helidon/webclient/http2/Http2WebClientTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.http2.webclient; +package io.helidon.webclient.http2; import java.io.IOException; import java.io.InputStream; @@ -31,18 +31,17 @@ import io.helidon.common.LazyValue; import io.helidon.common.configurable.Resource; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.common.pki.Keys; -import io.helidon.nima.common.tls.Tls; -import io.helidon.nima.http2.webserver.Http2Config; -import io.helidon.nima.http2.webserver.Http2ConnectionSelector; -import io.helidon.nima.http2.webserver.Http2Route; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.api.WebClient; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.http1.Http1Route; +import io.helidon.common.tls.Tls; +import io.helidon.webserver.http2.Http2Config; +import io.helidon.webserver.http2.Http2ConnectionSelector; +import io.helidon.webserver.http2.Http2Route; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.http1.Http1Route; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assumptions; @@ -52,10 +51,10 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -import static io.helidon.common.http.Http.HeaderNames.USER_AGENT; -import static io.helidon.common.http.Http.Method.GET; -import static io.helidon.common.http.Http.Method.POST; -import static io.helidon.common.http.Http.Method.PUT; +import static io.helidon.http.Http.HeaderNames.USER_AGENT; +import static io.helidon.http.Http.Method.GET; +import static io.helidon.http.Http.Method.POST; +import static io.helidon.http.Http.Method.PUT; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; diff --git a/nima/http2/webclient/src/test/resources/certificate.p12 b/webclient/http2/src/test/resources/certificate.p12 similarity index 100% rename from nima/http2/webclient/src/test/resources/certificate.p12 rename to webclient/http2/src/test/resources/certificate.p12 diff --git a/webclient/http2/src/test/resources/logging-test.properties b/webclient/http2/src/test/resources/logging-test.properties new file mode 100644 index 00000000000..1e0d92c5a92 --- /dev/null +++ b/webclient/http2/src/test/resources/logging-test.properties @@ -0,0 +1,26 @@ +# +# Copyright (c) 2022, 2023 Oracle and/or its affiliates. +# +# 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. +# + +# Send messages to the console +handlers=java.util.logging.ConsoleHandler +java.util.logging.ConsoleHandler.level=FINEST +java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter +# java.util.logging.SimpleFormatter.format = [%1$tc] %5$s %6$s%n +java.util.logging.SimpleFormatter.format=%1$tH:%1$tM:%1$tS %4$s %3$s %5$s%6$s%n +#java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$s %3$s %5$s%6$s%n + +# Global logging level. Can be overridden by specific loggers +.level=INFO diff --git a/webclient/metrics/pom.xml b/webclient/metrics/pom.xml new file mode 100644 index 00000000000..1e35b63ed50 --- /dev/null +++ b/webclient/metrics/pom.xml @@ -0,0 +1,80 @@ + + + + + 4.0.0 + + io.helidon.webclient + helidon-webclient-project + 4.0.0-SNAPSHOT + + + helidon-webclient-metrics + Helidon WebClient Metrics + Helidon WebClient Metrics support + + + + io.helidon.webclient + helidon-webclient + + + io.helidon.config + helidon-config + + + org.eclipse.microprofile.metrics + microprofile-metrics-api + + + io.helidon.metrics + helidon-metrics-api + + + io.helidon.common.features + helidon-common-features-api + true + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + + + + io.helidon.common.features + helidon-common-features-api + ${helidon.version} + + + + + + diff --git a/nima/webclient/metrics/src/main/java/io/helidon/nima/webclient/metrics/WebClientCounter.java b/webclient/metrics/src/main/java/io/helidon/webclient/metrics/WebClientCounter.java similarity index 89% rename from nima/webclient/metrics/src/main/java/io/helidon/nima/webclient/metrics/WebClientCounter.java rename to webclient/metrics/src/main/java/io/helidon/webclient/metrics/WebClientCounter.java index ae01e9c504e..a7ce70c574d 100644 --- a/nima/webclient/metrics/src/main/java/io/helidon/nima/webclient/metrics/WebClientCounter.java +++ b/webclient/metrics/src/main/java/io/helidon/webclient/metrics/WebClientCounter.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.webclient.metrics; +package io.helidon.webclient.metrics; -import io.helidon.common.http.Http; -import io.helidon.nima.webclient.api.WebClientServiceRequest; -import io.helidon.nima.webclient.api.WebClientServiceResponse; +import io.helidon.http.Http; +import io.helidon.webclient.api.WebClientServiceRequest; +import io.helidon.webclient.api.WebClientServiceResponse; import org.eclipse.microprofile.metrics.Counter; import org.eclipse.microprofile.metrics.Metadata; diff --git a/nima/webclient/metrics/src/main/java/io/helidon/nima/webclient/metrics/WebClientGaugeInProgress.java b/webclient/metrics/src/main/java/io/helidon/webclient/metrics/WebClientGaugeInProgress.java similarity index 89% rename from nima/webclient/metrics/src/main/java/io/helidon/nima/webclient/metrics/WebClientGaugeInProgress.java rename to webclient/metrics/src/main/java/io/helidon/webclient/metrics/WebClientGaugeInProgress.java index ba936579f39..4d3305634a5 100644 --- a/nima/webclient/metrics/src/main/java/io/helidon/nima/webclient/metrics/WebClientGaugeInProgress.java +++ b/webclient/metrics/src/main/java/io/helidon/webclient/metrics/WebClientGaugeInProgress.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.webclient.metrics; +package io.helidon.webclient.metrics; import java.util.concurrent.atomic.AtomicLong; -import io.helidon.nima.webclient.api.WebClientServiceRequest; -import io.helidon.nima.webclient.api.WebClientServiceResponse; +import io.helidon.webclient.api.WebClientServiceRequest; +import io.helidon.webclient.api.WebClientServiceResponse; /** * Gauge which counts all requests in progress. diff --git a/nima/webclient/metrics/src/main/java/io/helidon/nima/webclient/metrics/WebClientMeter.java b/webclient/metrics/src/main/java/io/helidon/webclient/metrics/WebClientMeter.java similarity index 88% rename from nima/webclient/metrics/src/main/java/io/helidon/nima/webclient/metrics/WebClientMeter.java rename to webclient/metrics/src/main/java/io/helidon/webclient/metrics/WebClientMeter.java index 289a514bcda..6375a79e5ff 100644 --- a/nima/webclient/metrics/src/main/java/io/helidon/nima/webclient/metrics/WebClientMeter.java +++ b/webclient/metrics/src/main/java/io/helidon/webclient/metrics/WebClientMeter.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.webclient.metrics; +package io.helidon.webclient.metrics; -import io.helidon.common.http.Http; -import io.helidon.nima.webclient.api.WebClientServiceRequest; -import io.helidon.nima.webclient.api.WebClientServiceResponse; +import io.helidon.http.Http; +import io.helidon.webclient.api.WebClientServiceRequest; +import io.helidon.webclient.api.WebClientServiceResponse; import org.eclipse.microprofile.metrics.Metadata; diff --git a/nima/webclient/metrics/src/main/java/io/helidon/nima/webclient/metrics/WebClientMetric.java b/webclient/metrics/src/main/java/io/helidon/webclient/metrics/WebClientMetric.java similarity index 97% rename from nima/webclient/metrics/src/main/java/io/helidon/nima/webclient/metrics/WebClientMetric.java rename to webclient/metrics/src/main/java/io/helidon/webclient/metrics/WebClientMetric.java index d1732810bd6..b3dc70e9617 100644 --- a/nima/webclient/metrics/src/main/java/io/helidon/nima/webclient/metrics/WebClientMetric.java +++ b/webclient/metrics/src/main/java/io/helidon/webclient/metrics/WebClientMetric.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.webclient.metrics; +package io.helidon.webclient.metrics; import java.util.Arrays; import java.util.Collection; @@ -22,12 +22,12 @@ import java.util.stream.Collectors; import io.helidon.common.config.Config; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.metrics.api.Registry; import io.helidon.metrics.api.RegistryFactory; -import io.helidon.nima.webclient.api.WebClientServiceRequest; -import io.helidon.nima.webclient.api.WebClientServiceResponse; -import io.helidon.nima.webclient.spi.WebClientService; +import io.helidon.webclient.api.WebClientServiceRequest; +import io.helidon.webclient.api.WebClientServiceResponse; +import io.helidon.webclient.spi.WebClientService; import org.eclipse.microprofile.metrics.Metadata; import org.eclipse.microprofile.metrics.MetadataBuilder; diff --git a/nima/webclient/metrics/src/main/java/io/helidon/nima/webclient/metrics/WebClientMetricType.java b/webclient/metrics/src/main/java/io/helidon/webclient/metrics/WebClientMetricType.java similarity index 97% rename from nima/webclient/metrics/src/main/java/io/helidon/nima/webclient/metrics/WebClientMetricType.java rename to webclient/metrics/src/main/java/io/helidon/webclient/metrics/WebClientMetricType.java index 3e759393281..f592108b315 100644 --- a/nima/webclient/metrics/src/main/java/io/helidon/nima/webclient/metrics/WebClientMetricType.java +++ b/webclient/metrics/src/main/java/io/helidon/webclient/metrics/WebClientMetricType.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.webclient.metrics; +package io.helidon.webclient.metrics; import java.util.function.Function; diff --git a/nima/webclient/metrics/src/main/java/io/helidon/nima/webclient/metrics/WebClientMetrics.java b/webclient/metrics/src/main/java/io/helidon/webclient/metrics/WebClientMetrics.java similarity index 94% rename from nima/webclient/metrics/src/main/java/io/helidon/nima/webclient/metrics/WebClientMetrics.java rename to webclient/metrics/src/main/java/io/helidon/webclient/metrics/WebClientMetrics.java index 7852408b8eb..5466c409716 100644 --- a/nima/webclient/metrics/src/main/java/io/helidon/nima/webclient/metrics/WebClientMetrics.java +++ b/webclient/metrics/src/main/java/io/helidon/webclient/metrics/WebClientMetrics.java @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.webclient.metrics; +package io.helidon.webclient.metrics; import java.util.ArrayList; import java.util.List; import java.util.ListIterator; import io.helidon.common.config.Config; -import io.helidon.nima.webclient.api.WebClientServiceRequest; -import io.helidon.nima.webclient.api.WebClientServiceResponse; -import io.helidon.nima.webclient.spi.WebClientService; +import io.helidon.webclient.api.WebClientServiceRequest; +import io.helidon.webclient.api.WebClientServiceResponse; +import io.helidon.webclient.spi.WebClientService; /** * Container object for all metrics created by the config. diff --git a/nima/webclient/metrics/src/main/java/io/helidon/nima/webclient/metrics/WebClientMetricsProvider.java b/webclient/metrics/src/main/java/io/helidon/webclient/metrics/WebClientMetricsProvider.java similarity index 84% rename from nima/webclient/metrics/src/main/java/io/helidon/nima/webclient/metrics/WebClientMetricsProvider.java rename to webclient/metrics/src/main/java/io/helidon/webclient/metrics/WebClientMetricsProvider.java index 2808dbda64e..1cb7e64c9db 100644 --- a/nima/webclient/metrics/src/main/java/io/helidon/nima/webclient/metrics/WebClientMetricsProvider.java +++ b/webclient/metrics/src/main/java/io/helidon/webclient/metrics/WebClientMetricsProvider.java @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.webclient.metrics; +package io.helidon.webclient.metrics; import io.helidon.common.config.Config; -import io.helidon.nima.webclient.spi.WebClientService; -import io.helidon.nima.webclient.spi.WebClientServiceProvider; +import io.helidon.webclient.spi.WebClientService; +import io.helidon.webclient.spi.WebClientServiceProvider; /** * Client metrics SPI provider implementation. * * @deprecated This class should only be used via {@link java.util.ServiceLoader}. - * Use {@link io.helidon.nima.webclient.metrics.WebClientMetrics} instead + * Use {@link WebClientMetrics} instead */ @Deprecated public class WebClientMetricsProvider implements WebClientServiceProvider { diff --git a/nima/webclient/metrics/src/main/java/io/helidon/nima/webclient/metrics/WebClientTimer.java b/webclient/metrics/src/main/java/io/helidon/webclient/metrics/WebClientTimer.java similarity index 90% rename from nima/webclient/metrics/src/main/java/io/helidon/nima/webclient/metrics/WebClientTimer.java rename to webclient/metrics/src/main/java/io/helidon/webclient/metrics/WebClientTimer.java index fd7b74ec1b7..0a83dea87ac 100644 --- a/nima/webclient/metrics/src/main/java/io/helidon/nima/webclient/metrics/WebClientTimer.java +++ b/webclient/metrics/src/main/java/io/helidon/webclient/metrics/WebClientTimer.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.webclient.metrics; +package io.helidon.webclient.metrics; import java.time.Duration; -import io.helidon.common.http.Http; -import io.helidon.nima.webclient.api.WebClientServiceRequest; -import io.helidon.nima.webclient.api.WebClientServiceResponse; +import io.helidon.http.Http; +import io.helidon.webclient.api.WebClientServiceRequest; +import io.helidon.webclient.api.WebClientServiceResponse; import org.eclipse.microprofile.metrics.Metadata; import org.eclipse.microprofile.metrics.Timer; diff --git a/webclient/metrics/src/main/java/io/helidon/webclient/metrics/package-info.java b/webclient/metrics/src/main/java/io/helidon/webclient/metrics/package-info.java new file mode 100644 index 00000000000..3c381999377 --- /dev/null +++ b/webclient/metrics/src/main/java/io/helidon/webclient/metrics/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * + * 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. + */ +/** + * Helidon WebClient Metrics Support. + */ +package io.helidon.webclient.metrics; diff --git a/webclient/metrics/src/main/java/module-info.java b/webclient/metrics/src/main/java/module-info.java new file mode 100644 index 00000000000..b9849ab56a6 --- /dev/null +++ b/webclient/metrics/src/main/java/module-info.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.common.features.api.Feature; +import io.helidon.common.features.api.HelidonFlavor; +import io.helidon.webclient.metrics.WebClientMetricsProvider; +import io.helidon.webclient.spi.WebClientServiceProvider; + +/** + * Helidon WebClient Metrics Support. + */ +@Feature(value = "Metrics", + description = "WebClient metrics support", + in = HelidonFlavor.SE, + path = {"WebClient", "Metrics"} +) +module io.helidon.webclient.metrics { + requires io.helidon.webclient; + requires microprofile.metrics.api; + requires io.helidon.metrics.api; + requires io.helidon.common.features.api; + provides WebClientServiceProvider + with WebClientMetricsProvider; +} diff --git a/webclient/pom.xml b/webclient/pom.xml new file mode 100644 index 00000000000..d398d155a86 --- /dev/null +++ b/webclient/pom.xml @@ -0,0 +1,54 @@ + + + + + 4.0.0 + + io.helidon + helidon-project + 4.0.0-SNAPSHOT + + io.helidon.webclient + helidon-webclient-project + Helidon WebClient Project + + pom + + + api + dns-resolver + http1 + http2 + metrics + security + sse + tracing + webclient + websocket + + + + + tests + + tests + + + + diff --git a/webclient/security/pom.xml b/webclient/security/pom.xml new file mode 100644 index 00000000000..d6e68e0cb08 --- /dev/null +++ b/webclient/security/pom.xml @@ -0,0 +1,75 @@ + + + + 4.0.0 + + io.helidon.webclient + helidon-webclient-project + 4.0.0-SNAPSHOT + + + helidon-webclient-security + Helidon WebClient Security + + + + io.helidon.webclient + helidon-webclient + + + io.helidon.security + helidon-security + + + io.helidon.security.providers + helidon-security-providers-common + + + io.helidon.common.features + helidon-common-features-api + true + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + + + + io.helidon.common.features + helidon-common-features-api + ${helidon.version} + + + + + + + diff --git a/nima/webclient/security/src/main/java/io/helidon/nima/webclient/security/WebClientSecurity.java b/webclient/security/src/main/java/io/helidon/webclient/security/WebClientSecurity.java similarity index 96% rename from nima/webclient/security/src/main/java/io/helidon/nima/webclient/security/WebClientSecurity.java rename to webclient/security/src/main/java/io/helidon/webclient/security/WebClientSecurity.java index d8e63c25dbf..3965463295a 100644 --- a/nima/webclient/security/src/main/java/io/helidon/nima/webclient/security/WebClientSecurity.java +++ b/webclient/security/src/main/java/io/helidon/webclient/security/WebClientSecurity.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.webclient.security; +package io.helidon.webclient.security; import java.lang.System.Logger.Level; import java.util.List; @@ -23,11 +23,8 @@ import io.helidon.common.context.Context; import io.helidon.common.context.Contexts; -import io.helidon.common.http.ClientRequestHeaders; -import io.helidon.common.http.Http; -import io.helidon.nima.webclient.api.WebClientServiceRequest; -import io.helidon.nima.webclient.api.WebClientServiceResponse; -import io.helidon.nima.webclient.spi.WebClientService; +import io.helidon.http.ClientRequestHeaders; +import io.helidon.http.Http; import io.helidon.security.EndpointConfig; import io.helidon.security.OutboundSecurityClientBuilder; import io.helidon.security.OutboundSecurityResponse; @@ -38,6 +35,9 @@ import io.helidon.tracing.Span; import io.helidon.tracing.SpanContext; import io.helidon.tracing.Tracer; +import io.helidon.webclient.api.WebClientServiceRequest; +import io.helidon.webclient.api.WebClientServiceResponse; +import io.helidon.webclient.spi.WebClientService; /** * Client service for security propagation. diff --git a/nima/webclient/security/src/main/java/io/helidon/nima/webclient/security/WebClientSecurityProvider.java b/webclient/security/src/main/java/io/helidon/webclient/security/WebClientSecurityProvider.java similarity index 84% rename from nima/webclient/security/src/main/java/io/helidon/nima/webclient/security/WebClientSecurityProvider.java rename to webclient/security/src/main/java/io/helidon/webclient/security/WebClientSecurityProvider.java index bf872e0be0d..c48610e6a36 100644 --- a/nima/webclient/security/src/main/java/io/helidon/nima/webclient/security/WebClientSecurityProvider.java +++ b/webclient/security/src/main/java/io/helidon/webclient/security/WebClientSecurityProvider.java @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.webclient.security; +package io.helidon.webclient.security; import io.helidon.common.config.Config; -import io.helidon.nima.webclient.spi.WebClientService; -import io.helidon.nima.webclient.spi.WebClientServiceProvider; +import io.helidon.webclient.spi.WebClientService; +import io.helidon.webclient.spi.WebClientServiceProvider; /** * Client security SPI provider. * * @deprecated This class should only be used via {@link java.util.ServiceLoader}. - * Use {@link io.helidon.nima.webclient.security.WebClientSecurity} instead + * Use {@link WebClientSecurity} instead */ @Deprecated public class WebClientSecurityProvider implements WebClientServiceProvider { diff --git a/webclient/security/src/main/java/io/helidon/webclient/security/package-info.java b/webclient/security/src/main/java/io/helidon/webclient/security/package-info.java new file mode 100644 index 00000000000..f9e8eb44790 --- /dev/null +++ b/webclient/security/src/main/java/io/helidon/webclient/security/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebClient Security Support. + */ +package io.helidon.webclient.security; diff --git a/webclient/security/src/main/java/module-info.java b/webclient/security/src/main/java/module-info.java new file mode 100644 index 00000000000..b810e619f50 --- /dev/null +++ b/webclient/security/src/main/java/module-info.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.common.features.api.Feature; +import io.helidon.common.features.api.HelidonFlavor; + +/** + * Helidon WebClient Security Support. + */ +@Feature(value = "Security", + description = "WebClient security support", + in = HelidonFlavor.SE, + path = {"WebClient", "Security"} +) +module io.helidon.webclient.security { + requires static io.helidon.common.features.api; + + requires io.helidon.webclient; + requires io.helidon.security; + requires io.helidon.security.providers.common; + + exports io.helidon.webclient.security; + + provides io.helidon.webclient.spi.WebClientServiceProvider + with io.helidon.webclient.security.WebClientSecurityProvider; +} \ No newline at end of file diff --git a/webclient/sse/pom.xml b/webclient/sse/pom.xml new file mode 100644 index 00000000000..7eec12727ae --- /dev/null +++ b/webclient/sse/pom.xml @@ -0,0 +1,65 @@ + + + + 4.0.0 + + io.helidon.webclient + helidon-webclient-project + 4.0.0-SNAPSHOT + + + helidon-webclient-sse + Helidon WebClient SSE + + + + io.helidon.common + helidon-common + + + io.helidon.common + helidon-common-media-type + + + io.helidon.webclient + helidon-webclient + + + io.helidon.http + helidon-http-sse + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + org.mockito + mockito-core + test + + + diff --git a/nima/sse/webclient/src/main/java/io/helidon/nima/sse/webclient/SseSource.java b/webclient/sse/src/main/java/io/helidon/webclient/sse/SseSource.java similarity index 88% rename from nima/sse/webclient/src/main/java/io/helidon/nima/sse/webclient/SseSource.java rename to webclient/sse/src/main/java/io/helidon/webclient/sse/SseSource.java index 397ca1e0c2f..72dd47c28ba 100644 --- a/nima/sse/webclient/src/main/java/io/helidon/nima/sse/webclient/SseSource.java +++ b/webclient/sse/src/main/java/io/helidon/webclient/sse/SseSource.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.helidon.nima.sse.webclient; +package io.helidon.webclient.sse; import io.helidon.common.GenericType; -import io.helidon.nima.sse.SseEvent; -import io.helidon.nima.webclient.spi.Source; +import io.helidon.http.sse.SseEvent; +import io.helidon.webclient.spi.Source; /** * A source for {@link SseEvent}s. diff --git a/nima/sse/webclient/src/main/java/io/helidon/nima/sse/webclient/SseSourceHandlerProvider.java b/webclient/sse/src/main/java/io/helidon/webclient/sse/SseSourceHandlerProvider.java similarity index 94% rename from nima/sse/webclient/src/main/java/io/helidon/nima/sse/webclient/SseSourceHandlerProvider.java rename to webclient/sse/src/main/java/io/helidon/webclient/sse/SseSourceHandlerProvider.java index ee9438368cf..510081a97f3 100644 --- a/nima/sse/webclient/src/main/java/io/helidon/nima/sse/webclient/SseSourceHandlerProvider.java +++ b/webclient/sse/src/main/java/io/helidon/webclient/sse/SseSourceHandlerProvider.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.sse.webclient; +package io.helidon.webclient.sse; import java.io.BufferedReader; import java.io.IOException; @@ -26,11 +26,11 @@ import io.helidon.common.GenericType; import io.helidon.common.media.type.MediaTypes; -import io.helidon.nima.http.media.MediaContext; -import io.helidon.nima.sse.SseEvent; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.spi.Source; -import io.helidon.nima.webclient.spi.SourceHandlerProvider; +import io.helidon.http.media.MediaContext; +import io.helidon.http.sse.SseEvent; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.spi.Source; +import io.helidon.webclient.spi.SourceHandlerProvider; /** * A handler for SSE sources. diff --git a/webclient/sse/src/main/java/io/helidon/webclient/sse/package-info.java b/webclient/sse/src/main/java/io/helidon/webclient/sse/package-info.java new file mode 100644 index 00000000000..0ba2be65cc0 --- /dev/null +++ b/webclient/sse/src/main/java/io/helidon/webclient/sse/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebClient SSE Support. + */ +package io.helidon.webclient.sse; diff --git a/webclient/sse/src/main/java/module-info.java b/webclient/sse/src/main/java/module-info.java new file mode 100644 index 00000000000..845add00586 --- /dev/null +++ b/webclient/sse/src/main/java/module-info.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.webclient.sse.SseSourceHandlerProvider; +import io.helidon.webclient.spi.SourceHandlerProvider; + +/** + * Helidon WebClient SSE Support. + */ +module io.helidon.webclient.sse { + requires transitive io.helidon.common; + requires transitive io.helidon.common.media.type; + requires transitive io.helidon.http.sse; + requires io.helidon.webclient; + + provides SourceHandlerProvider with SseSourceHandlerProvider; + + exports io.helidon.webclient.sse; +} diff --git a/webclient/tests/http1/pom.xml b/webclient/tests/http1/pom.xml new file mode 100644 index 00000000000..fb47f78e7aa --- /dev/null +++ b/webclient/tests/http1/pom.xml @@ -0,0 +1,66 @@ + + + + 4.0.0 + + io.helidon.webclient.tests + helidon-webclient-tests-project + 4.0.0-SNAPSHOT + + + helidon-webclient-tests-http1 + Helidon WebClient Tests HTTP/1 + WebClient HTTP/1 tests + + + + io.helidon.webclient + helidon-webclient + + + io.helidon.webclient + helidon-webclient-http2 + + + io.helidon.webserver + helidon-webserver + test + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-params + test + + + org.hamcrest + hamcrest-all + test + + + diff --git a/webclient/tests/http1/src/test/java/io/helidon/webclient/http1/Http1ClientTest.java b/webclient/tests/http1/src/test/java/io/helidon/webclient/http1/Http1ClientTest.java new file mode 100644 index 00000000000..2d7a2d0f41a --- /dev/null +++ b/webclient/tests/http1/src/test/java/io/helidon/webclient/http1/Http1ClientTest.java @@ -0,0 +1,554 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.webclient.http1; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.UncheckedIOException; +import java.net.SocketTimeoutException; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.TimeUnit; + +import io.helidon.common.GenericType; +import io.helidon.http.Headers; +import io.helidon.http.Http; +import io.helidon.http.WritableHeaders; +import io.helidon.http.media.EntityReader; +import io.helidon.http.media.EntityWriter; +import io.helidon.http.media.MediaContext; +import io.helidon.http.media.MediaContextConfig; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webclient.api.ClientConnection; +import io.helidon.webclient.api.ClientResponseTyped; +import io.helidon.webclient.api.HttpClientRequest; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.api.Proxy; +import io.helidon.webclient.api.WebClient; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; + +import org.junit.jupiter.api.Test; + +import static io.helidon.common.testing.http.junit5.HttpHeaderMatcher.hasHeader; +import static io.helidon.common.testing.http.junit5.HttpHeaderMatcher.noHeader; +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.core.IsNot.not; +import static org.junit.jupiter.api.Assertions.assertThrows; + +/* +This class uses package local API to validate connection cache, and at the same time benefits from @ServerTest +that is why this tests is in this module, but in the wrong package + */ +@ServerTest +class Http1ClientTest { + private static final Http.Header REQ_CHUNKED_HEADER = Http.Headers.createCached( + Http.HeaderNames.create("X-Req-Chunked"), "true"); + private static final Http.Header REQ_EXPECT_100_HEADER_NAME = Http.Headers.createCached( + Http.HeaderNames.create("X-Req-Expect100"), "true"); + private static final Http.HeaderName REQ_CONTENT_LENGTH_HEADER_NAME = Http.HeaderNames.create("X-Req-ContentLength"); + private static final String EXPECTED_GET_AFTER_REDIRECT_STRING = "GET after redirect endpoint reached"; + private static final long NO_CONTENT_LENGTH = -1L; + + private final String baseURI; + private final WebClient injectedHttp1client; + + Http1ClientTest(WebServer webServer, WebClient client) { + baseURI = "http://localhost:" + webServer.port(); + injectedHttp1client = client; + } + + @SetUpRoute + static void routing(HttpRules rules) { + rules.put("/test", Http1ClientTest::responseHandler); + rules.put("/redirectKeepMethod", Http1ClientTest::redirectKeepMethod); + rules.put("/redirect", Http1ClientTest::redirect); + rules.get("/afterRedirect", Http1ClientTest::afterRedirectGet); + rules.put("/afterRedirect", Http1ClientTest::afterRedirectPut); + rules.put("/chunkresponse", Http1ClientTest::chunkResponseHandler); + rules.put("/delayedEndpoint", Http1ClientTest::delayedHandler); + } + + @Test + void testMaxHeaderSizeFail() { + Http1Client client = Http1Client.create(clientConfig -> clientConfig.baseUri(baseURI) + .protocolConfig(it -> it.maxHeaderSize(15))); + + validateFailedResponse(client, "Header size exceeded"); + } + + @Test + void testMaxHeaderSizeSuccess() { + Http1Client client = Http1Client.create(clientConfig -> clientConfig.baseUri(baseURI) + .protocolConfig(it -> it.maxHeaderSize(500))); + validateSuccessfulResponse(client); + } + + @Test + void testMaxStatusLineLengthFail() { + Http1Client client = Http1Client.create(clientConfig -> clientConfig.baseUri(baseURI) + .protocolConfig(it -> it.maxStatusLineLength(1))); + + validateFailedResponse(client, "HTTP Response did not contain HTTP status line"); + } + + @Test + void testMaxHeaderLineLengthSuccess() { + Http1Client client = Http1Client.create(clientConfig -> clientConfig.baseUri(baseURI) + .protocolConfig(it -> it.maxStatusLineLength(20))); + + validateSuccessfulResponse(client); + } + + @Test + void testMediaContext() { + Http1Client client = Http1Client.create(clientConfig -> clientConfig.baseUri(baseURI) + .mediaContext(new CustomizedMediaContext())); + + validateSuccessfulResponse(client); + } + + @Test + void testChunk() { + String[] requestEntityParts = {"First", "Second", "Third"}; + + HttpClientRequest request = getHttp1ClientRequest(Http.Method.PUT, "/test"); + HttpClientResponse response = getHttp1ClientResponseFromOutputStream(request, requestEntityParts); + + validateChunkTransfer(response, true, NO_CONTENT_LENGTH, String.join("", requestEntityParts)); + } + + @Test + void testChunkAndChunkResponse() { + String[] requestEntityParts = {"First", "Second", "Third"}; + + HttpClientRequest request = getHttp1ClientRequest(Http.Method.PUT, "/chunkresponse"); + HttpClientResponse response = getHttp1ClientResponseFromOutputStream(request, requestEntityParts); + + validateChunkTransfer(response, true, NO_CONTENT_LENGTH, String.join("", requestEntityParts)); + assertThat(response.headers(), hasHeader(Http.Headers.TRANSFER_ENCODING_CHUNKED)); + } + + @Test + void testNoChunk() { + String[] requestEntityParts = {"First"}; + long contentLength = requestEntityParts[0].length(); + + HttpClientRequest request = getHttp1ClientRequest(Http.Method.PUT, "/test") + .header(Http.HeaderNames.CONTENT_LENGTH, String.valueOf(contentLength)); + HttpClientResponse response = getHttp1ClientResponseFromOutputStream(request, requestEntityParts); + + validateChunkTransfer(response, false, contentLength, requestEntityParts[0]); + } + + @Test + void testForcedChunkNoContentLength() { + String[] requestEntityParts = {"First"}; + + HttpClientRequest request = getHttp1ClientRequest(Http.Method.PUT, "/test"); + HttpClientResponse response = getHttp1ClientResponseFromOutputStream(request, requestEntityParts); + + validateChunkTransfer(response, true, NO_CONTENT_LENGTH, requestEntityParts[0]); + } + + @Test + void testForcedChunkTransferEncodingChunked() { + String[] requestEntityParts = {"First"}; + + HttpClientRequest request = getHttp1ClientRequest(Http.Method.PUT, "/test") + .header(Http.Headers.TRANSFER_ENCODING_CHUNKED); + HttpClientResponse response = getHttp1ClientResponseFromOutputStream(request, requestEntityParts); + + validateChunkTransfer(response, true, NO_CONTENT_LENGTH, requestEntityParts[0]); + } + + @Test + void testExpect100() { + String[] requestEntityParts = {"First", "Second", "Third"}; + + WebClient client = WebClient.builder() + .baseUri(baseURI) + .sendExpectContinue(true) + .build(); + HttpClientRequest request = client.put("/test"); + + HttpClientResponse response = getHttp1ClientResponseFromOutputStream(request, requestEntityParts); + + validateChunkTransfer(response, true, NO_CONTENT_LENGTH, String.join("", requestEntityParts)); + assertThat(response.headers(), hasHeader(REQ_EXPECT_100_HEADER_NAME)); + } + + // validates that HEAD is not allowed with entity payload + @Test + void testHeadMethod() { + String path = "/test"; + assertThrows(IllegalArgumentException.class, () -> + injectedHttp1client.head(path).submit("Foo Bar")); + assertThrows(IllegalArgumentException.class, () -> + injectedHttp1client.head(path).outputStream(it -> { + it.write("Foo Bar".getBytes(StandardCharsets.UTF_8)); + it.close(); + })); + injectedHttp1client.head(path).request(); + } + + @Test + void testConnectionQueueDequeue() { + ClientConnection connectionNow = null; + ClientConnection connectionPrior = null; + for (int i = 0; i < 5; ++i) { + HttpClientRequest request = injectedHttp1client.put("/test"); + // connection will be dequeued if queue is not empty + WebClient webClient = WebClient.create(); + Http1ClientConfig clientConfig = Http1ClientConfig.create(); + Http1ClientImpl http1Client = new Http1ClientImpl(webClient, clientConfig); + connectionNow = http1Client + .connectionCache() + .connection(http1Client, + injectedHttp1client.prototype().tls(), + Proxy.noProxy(), + request.resolvedUri(), + request.headers(), + true); + request.connection(connectionNow); + HttpClientResponse response = request.request(); + // connection will be queued up + response.close(); + if (connectionPrior != null) { + assertThat(connectionNow, is(connectionPrior)); + } + connectionPrior = connectionNow; + } + } + + @Test + void testConnectionQueueSizeLimit() { + int connectionQueueSize = injectedHttp1client.prototype().connectionCacheSize(); + + List connectionList = new ArrayList<>(); + List responseList = new ArrayList<>(); + // create connections beyond the queue size limit + for (int i = 0; i < connectionQueueSize + 1; ++i) { + HttpClientRequest request = injectedHttp1client.put("/test"); + + WebClient webClient = WebClient.create(); + Http1ClientConfig clientConfig = Http1ClientConfig.create(); + Http1ClientImpl http1Client = new Http1ClientImpl(webClient, clientConfig); + + connectionList.add(http1Client + .connectionCache() + .connection(http1Client, + clientConfig.tls(), + Proxy.noProxy(), + request.resolvedUri(), + request.headers(), + true)); + request.connection(connectionList.get(i)); + responseList.add(request.request()); + } + + // Queue up all connections except the last one because it exceeded the queue size limit + for (HttpClientResponse response : responseList) { + response.close(); + } + + // dequeue all the created connections + ClientConnection connection = null; + HttpClientResponse response = null; + for (int i = 0; i < connectionQueueSize + 1; ++i) { + HttpClientRequest request = injectedHttp1client.put("/test"); + + WebClient webClient = WebClient.create(); + Http1ClientConfig clientConfig = Http1ClientConfig.create(); + Http1ClientImpl http1Client = new Http1ClientImpl(webClient, clientConfig); + + connection = http1Client + .connectionCache() + .connection(http1Client, + clientConfig.tls(), + Proxy.noProxy(), + request.resolvedUri(), + request.headers(), + true); + + request.connection(connection); + response = request.request(); + if (i < connectionQueueSize) { + // Verify connections that are dequeued + assertThat("Failed on connection index " + i, connection, is(connectionList.get(i))); + } else { + // Verify that the last connection was not dequeued but created as new, because it exceeded the queue size limit + assertThat(connection, is(not(connectionList.get(i)))); + } + } + + // The queue is currently empty so check if we can add the last created connection into it. + response.close(); + HttpClientRequest request = injectedHttp1client.put("/test"); + + WebClient webClient = WebClient.create(); + Http1ClientConfig clientConfig = Http1ClientConfig.create(); + Http1ClientImpl http1Client = new Http1ClientImpl(webClient, clientConfig); + + ClientConnection connectionNow = http1Client + .connectionCache() + .connection(http1Client, + clientConfig.tls(), + Proxy.noProxy(), + request.resolvedUri(), + request.headers(), + true); + + request.connection(connectionNow); + HttpClientResponse responseNow = request.request(); + // Verify that the connection was dequeued + assertThat(connectionNow, is(connection)); + } + + @Test + void testRedirect() { + try (HttpClientResponse response = injectedHttp1client.put("/redirect") + .followRedirects(false) + .submit("Test entity")) { + assertThat(response.status(), is(Http.Status.FOUND_302)); + } + + try (HttpClientResponse response = injectedHttp1client.put("/redirect") + .submit("Test entity")) { + assertThat(response.status(), is(Http.Status.OK_200)); + assertThat(response.lastEndpointUri().path().path(), is("/afterRedirect")); + assertThat(response.as(String.class), is(EXPECTED_GET_AFTER_REDIRECT_STRING)); + } + } + + @Test + void testRedirectKeepMethod() { + try (HttpClientResponse response = injectedHttp1client.put("/redirectKeepMethod") + .followRedirects(false) + .submit("Test entity")) { + assertThat(response.status(), is(Http.Status.TEMPORARY_REDIRECT_307)); + } + + try (HttpClientResponse response = injectedHttp1client.put("/redirectKeepMethod") + .submit("Test entity")) { + assertThat(response.lastEndpointUri().path().path(), is("/afterRedirect")); + assertThat(response.status(), is(Http.Status.NO_CONTENT_204)); + } + } + + @Test + void testReadTimeoutPerRequest() { + String testEntity = "Test entity"; + try (HttpClientResponse response = injectedHttp1client.put("/delayedEndpoint") + .submit(testEntity)) { + assertThat(response.status(), is(Http.Status.OK_200)); + assertThat(response.as(String.class), is(testEntity)); + } + + UncheckedIOException ste = assertThrows(UncheckedIOException.class, + () -> injectedHttp1client.put("/delayedEndpoint") + .readTimeout(Duration.ofMillis(1)) + .submit(testEntity)); + assertThat(ste.getCause(), instanceOf(SocketTimeoutException.class)); + } + + private static void validateSuccessfulResponse(Http1Client client) { + String requestEntity = "Sending Something"; + Http1ClientRequest request = client.put("/test"); + ClientResponseTyped response = request.submit(requestEntity, String.class); + + assertThat(response.status(), is(Http.Status.OK_200)); + assertThat(response.entity(), is(requestEntity)); + } + + private static void validateFailedResponse(Http1Client client, String errorMessage) { + String requestEntity = "Sending Something"; + Http1ClientRequest request = client.put("/test"); + IllegalStateException ie = assertThrows(IllegalStateException.class, () -> request.submit(requestEntity)); + assertThat(ie.getMessage(), containsString(errorMessage)); + } + + private static void validateChunkTransfer(HttpClientResponse response, boolean chunked, long contentLength, String entity) { + assertThat(response.status(), is(Http.Status.OK_200)); + if (contentLength == NO_CONTENT_LENGTH) { + assertThat(response.headers(), noHeader(REQ_CONTENT_LENGTH_HEADER_NAME)); + } else { + assertThat(response.headers(), hasHeader(REQ_CONTENT_LENGTH_HEADER_NAME, String.valueOf(contentLength))); + } + if (chunked) { + assertThat(response.headers(), hasHeader(REQ_CHUNKED_HEADER)); + } else { + assertThat(response.headers(), noHeader(REQ_CHUNKED_HEADER.headerName())); + } + String responseEntity = response.entity().as(String.class); + assertThat(responseEntity, is(entity)); + } + + private static void redirect(ServerRequest req, ServerResponse res) { + res.status(Http.Status.FOUND_302) + .header(Http.HeaderNames.LOCATION, "/afterRedirect") + .send(); + } + + private static void redirectKeepMethod(ServerRequest req, ServerResponse res) { + res.status(Http.Status.TEMPORARY_REDIRECT_307) + .header(Http.HeaderNames.LOCATION, "/afterRedirect") + .send(); + } + + private static void afterRedirectGet(ServerRequest req, ServerResponse res) { + if (req.content().hasEntity()) { + res.status(Http.Status.BAD_REQUEST_400) + .send("GET after redirect endpoint reached with entity"); + return; + } + res.send(EXPECTED_GET_AFTER_REDIRECT_STRING); + } + + private static void afterRedirectPut(ServerRequest req, ServerResponse res) { + String entity = req.content().as(String.class); + if (!entity.equals("Test entity")) { + res.status(Http.Status.BAD_REQUEST_400) + .send("Entity was not kept the same after the redirect"); + return; + } + res.status(Http.Status.NO_CONTENT_204) + .send(); + } + + private static void delayedHandler(ServerRequest req, ServerResponse res) throws IOException, InterruptedException { + TimeUnit.MILLISECONDS.sleep(10); + customHandler(req, res, false); + } + + private static void responseHandler(ServerRequest req, ServerResponse res) throws IOException { + customHandler(req, res, false); + } + + private static void chunkResponseHandler(ServerRequest req, ServerResponse res) throws IOException { + customHandler(req, res, true); + } + + private static void customHandler(ServerRequest req, ServerResponse res, boolean chunkResponse) throws IOException { + Headers reqHeaders = req.headers(); + if (reqHeaders.contains(Http.Headers.EXPECT_100)) { + res.headers().set(REQ_EXPECT_100_HEADER_NAME); + } + if (reqHeaders.contains(Http.HeaderNames.CONTENT_LENGTH)) { + res.headers().set(REQ_CONTENT_LENGTH_HEADER_NAME, reqHeaders.get(Http.HeaderNames.CONTENT_LENGTH).value()); + } + if (reqHeaders.contains(Http.Headers.TRANSFER_ENCODING_CHUNKED)) { + res.headers().set(REQ_CHUNKED_HEADER); + } + + try (InputStream inputStream = req.content().inputStream(); + OutputStream outputStream = res.outputStream()) { + if (!chunkResponse) { + new ByteArrayInputStream(inputStream.readAllBytes()).transferTo(outputStream); + } else { + // Break the entity into 3 parts and send them in chunks + int chunkParts = 3; + byte[] entity = inputStream.readAllBytes(); + int regularChunkLen = entity.length / chunkParts; + int lastChunkLen = regularChunkLen + entity.length % chunkParts; + for (int i = 0; i < chunkParts; i++) { + int chunkLen = (i != chunkParts - 1) ? regularChunkLen : lastChunkLen; + byte[] chunk = new byte[chunkLen]; + System.arraycopy(entity, i * regularChunkLen, chunk, 0, chunkLen); + outputStream.write(chunk); + outputStream.flush(); // will force chunked + } + } + } + } + + private static HttpClientResponse getHttp1ClientResponseFromOutputStream(HttpClientRequest request, + String[] requestEntityParts) { + + return request.outputStream(it -> { + for (String r : requestEntityParts) { + it.write(r.getBytes(StandardCharsets.UTF_8)); + } + it.close(); + }); + } + + private HttpClientRequest getHttp1ClientRequest(Http.Method method, String uriPath) { + return injectedHttp1client.method(method).uri(uriPath); + } + + private static class CustomizedMediaContext implements MediaContext { + private final MediaContext delegated = MediaContext.create(); + + @Override + public MediaContextConfig prototype() { + return delegated.prototype(); + } + + @Override + public EntityReader reader(GenericType type, Headers headers) { + return delegated.reader(type, headers); + } + + @Override + public EntityWriter writer(GenericType type, Headers requestHeaders, WritableHeaders responseHeaders) { + EntityWriter impl = delegated.writer(type, requestHeaders, responseHeaders); + + EntityWriter realWriter = new EntityWriter() { + @Override + public void write(GenericType type, + T object, + OutputStream outputStream, + Headers requestHeaders, + WritableHeaders responseHeaders) { + if (object instanceof String) { + String maxLen5 = ((String) object).substring(0, 5); + impl.write(type, (T) maxLen5, outputStream, requestHeaders, responseHeaders); + } else { + impl.write(type, object, outputStream, requestHeaders, responseHeaders); + } + } + + @Override + public void write(GenericType type, T object, OutputStream outputStream, WritableHeaders headers) { + impl.write(type, object, outputStream, headers); + } + }; + return realWriter; + } + + @Override + public EntityReader reader(GenericType type, Headers requestHeaders, Headers responseHeaders) { + return delegated.reader(type, requestHeaders, responseHeaders); + } + + @Override + public EntityWriter writer(GenericType type, WritableHeaders requestHeaders) { + return delegated.writer(type, requestHeaders); + } + } +} diff --git a/nima/tests/integration/webclient/webclient/src/test/java/io/helidon/nima/webclient/http1/ValidateHeadersTest.java b/webclient/tests/http1/src/test/java/io/helidon/webclient/http1/ValidateHeadersTest.java similarity index 86% rename from nima/tests/integration/webclient/webclient/src/test/java/io/helidon/nima/webclient/http1/ValidateHeadersTest.java rename to webclient/tests/http1/src/test/java/io/helidon/webclient/http1/ValidateHeadersTest.java index 5ba77ce59d9..9a60b29a6e4 100644 --- a/nima/tests/integration/webclient/webclient/src/test/java/io/helidon/nima/webclient/http1/ValidateHeadersTest.java +++ b/webclient/tests/http1/src/test/java/io/helidon/webclient/http1/ValidateHeadersTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.http1; +package io.helidon.webclient.http1; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -29,33 +29,32 @@ import java.util.stream.Stream; import java.util.concurrent.TimeUnit; +import io.helidon.http.Headers; +import io.helidon.http.Http; +import io.helidon.http.Http.HeaderName; +import io.helidon.http.ServerRequestHeaders; +import io.helidon.http.media.EntityReader; +import io.helidon.http.media.EntityWriter; +import io.helidon.http.media.MediaContext; +import io.helidon.http.media.MediaContextConfig; import io.helidon.common.GenericType; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderName; -import io.helidon.common.http.ServerRequestHeaders; -import io.helidon.nima.http.media.EntityReader; -import io.helidon.nima.http.media.EntityWriter; -import io.helidon.nima.http.media.MediaContext; -import io.helidon.nima.http.media.MediaContextConfig; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.api.ClientConnection; -import io.helidon.nima.webclient.api.ClientResponseTyped; -import io.helidon.nima.webclient.api.HttpClientRequest; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.api.Proxy; -import io.helidon.nima.webclient.api.WebClient; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; -import io.helidon.nima.webserver.http1.Http1Config; -import io.helidon.nima.webserver.http1.Http1ConnectionSelector; -import io.helidon.nima.webserver.spi.ServerConnectionSelector; - -import io.helidon.nima.testing.junit5.webserver.SetUpServer; +import io.helidon.webclient.api.ClientConnection; +import io.helidon.webclient.api.ClientResponseTyped; +import io.helidon.webclient.api.HttpClientRequest; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.api.Proxy; +import io.helidon.webclient.api.WebClient; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; +import io.helidon.webserver.http1.Http1Config; +import io.helidon.webserver.http1.Http1ConnectionSelector; +import io.helidon.webserver.spi.ServerConnectionSelector; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webserver.testing.junit5.SetUpServer; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; diff --git a/nima/tests/integration/webclient/webclient/src/test/java/io/helidon/nima/tests/integration/webclient/AuthHttpProxyTest.java b/webclient/tests/http1/src/test/java/io/helidon/webclient/tests/AuthHttpProxyTest.java similarity index 85% rename from nima/tests/integration/webclient/webclient/src/test/java/io/helidon/nima/tests/integration/webclient/AuthHttpProxyTest.java rename to webclient/tests/http1/src/test/java/io/helidon/webclient/tests/AuthHttpProxyTest.java index 0af5e09ea7c..7d9c944a994 100644 --- a/nima/tests/integration/webclient/webclient/src/test/java/io/helidon/nima/tests/integration/webclient/AuthHttpProxyTest.java +++ b/webclient/tests/http1/src/test/java/io/helidon/webclient/tests/AuthHttpProxyTest.java @@ -14,25 +14,25 @@ * limitations under the License. */ -package io.helidon.nima.tests.integration.webclient; - -import io.helidon.common.http.Http; -import io.helidon.nima.http2.webclient.Http2Client; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.api.HttpClient; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.api.Proxy; -import io.helidon.nima.webclient.api.Proxy.ProxyType; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRouting; +package io.helidon.webclient.tests; + +import io.helidon.http.Http; +import io.helidon.webclient.http2.Http2Client; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webclient.api.HttpClient; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.api.Proxy; +import io.helidon.webclient.api.Proxy.ProxyType; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.HttpRouting; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static io.helidon.common.http.Http.Method.GET; +import static io.helidon.http.Http.Method.GET; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.fail; diff --git a/nima/tests/integration/webclient/webclient/src/test/java/io/helidon/nima/tests/integration/webclient/AuthHttpsProxyTest.java b/webclient/tests/http1/src/test/java/io/helidon/webclient/tests/AuthHttpsProxyTest.java similarity index 85% rename from nima/tests/integration/webclient/webclient/src/test/java/io/helidon/nima/tests/integration/webclient/AuthHttpsProxyTest.java rename to webclient/tests/http1/src/test/java/io/helidon/webclient/tests/AuthHttpsProxyTest.java index 094ccbfae7d..4d139181854 100644 --- a/nima/tests/integration/webclient/webclient/src/test/java/io/helidon/nima/tests/integration/webclient/AuthHttpsProxyTest.java +++ b/webclient/tests/http1/src/test/java/io/helidon/webclient/tests/AuthHttpsProxyTest.java @@ -14,30 +14,30 @@ * limitations under the License. */ -package io.helidon.nima.tests.integration.webclient; +package io.helidon.webclient.tests; import io.helidon.common.configurable.Resource; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.common.pki.Keys; -import io.helidon.nima.common.tls.Tls; -import io.helidon.nima.http2.webclient.Http2Client; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.api.HttpClient; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.api.Proxy; -import io.helidon.nima.webclient.api.Proxy.ProxyType; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig.Builder; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.common.tls.Tls; +import io.helidon.webclient.http2.Http2Client; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webclient.api.HttpClient; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.api.Proxy; +import io.helidon.webclient.api.Proxy.ProxyType; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig.Builder; +import io.helidon.webserver.http.HttpRouting; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static io.helidon.common.http.Http.Method.GET; +import static io.helidon.http.Http.Method.GET; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.fail; diff --git a/nima/tests/integration/webclient/webclient/src/test/java/io/helidon/nima/tests/integration/webclient/CookieTest.java b/webclient/tests/http1/src/test/java/io/helidon/webclient/tests/CookieTest.java similarity index 92% rename from nima/tests/integration/webclient/webclient/src/test/java/io/helidon/nima/tests/integration/webclient/CookieTest.java rename to webclient/tests/http1/src/test/java/io/helidon/webclient/tests/CookieTest.java index 77b640c9646..e4e215cabf7 100644 --- a/nima/tests/integration/webclient/webclient/src/test/java/io/helidon/nima/tests/integration/webclient/CookieTest.java +++ b/webclient/tests/http1/src/test/java/io/helidon/webclient/tests/CookieTest.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package io.helidon.nima.tests.integration.webclient; +package io.helidon.webclient.tests; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.config.Config; import io.helidon.config.ConfigSources; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; diff --git a/webclient/tests/http1/src/test/java/io/helidon/webclient/tests/HeadersTest.java b/webclient/tests/http1/src/test/java/io/helidon/webclient/tests/HeadersTest.java new file mode 100644 index 00000000000..5d5c3fd15c7 --- /dev/null +++ b/webclient/tests/http1/src/test/java/io/helidon/webclient/tests/HeadersTest.java @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.webclient.tests; + +import java.util.Optional; + +import io.helidon.http.ClientResponseHeaders; +import io.helidon.http.Headers; +import io.helidon.http.Http; +import io.helidon.http.HttpMediaType; +import io.helidon.common.media.type.ParserMode; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.api.WebClient; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; + +import org.junit.jupiter.api.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static org.junit.jupiter.api.Assertions.fail; + +@ServerTest +class HeadersTest { + + private final WebClient client; + + HeadersTest(WebClient client) { + this.client = client; + } + + @SetUpRoute + static void routing(HttpRules rules) { + rules.register("/test", new TestService()); + } + + + // Verify that invalid content type is present in response headers and is accessible + @Test + public void testInvalidContentType() { + try (HttpClientResponse res = client.method(Http.Method.GET) + .path("/test/invalidContentType") + .request()) { + ClientResponseHeaders h = res.headers(); + Http.Header contentType = h.get(Http.HeaderNames.CONTENT_TYPE); + assertThat(res.status(), is(Http.Status.OK_200)); + assertThat(contentType.value(), is(TestService.INVALID_CONTENT_TYPE_VALUE)); + } + } + + // Verify that "Content-Type: text" header parsing fails in strict mode + @Test + public void testInvalidTextContentTypeStrict() { + try (HttpClientResponse res = client.method(Http.Method.GET) + .path("/test/invalidTextContentType") + .request()) { + assertThat(res.status(), is(Http.Status.OK_200)); + Headers h = res.headers(); + // Raw protocol data value + Http.Header rawContentType = h.get(Http.HeaderNames.CONTENT_TYPE); + assertThat(rawContentType.value(), is(TestService.INVALID_CONTENT_TYPE_TEXT)); + // Media type parsed value is invalid, IllegalArgumentException shall be thrown + try { + Optional httpMediaType = h.contentType(); + fail("Content-Type: text parsing must throw an exception in strict mode, got: " + httpMediaType); + } catch (IllegalArgumentException ex) { + assertThat(ex.getMessage(), is("Cannot parse media type: text")); + } + } + } + + // Verify that "Content-Type: text" header parsing returns text/plain in relaxed mode + @Test + public void testInvalidTextContentTypeRelaxed() { + WebClient client = WebClient.builder() + .from(this.client.prototype()) + .mediaTypeParserMode(ParserMode.RELAXED) + .build(); + try (HttpClientResponse res = client.method(Http.Method.GET) + .path("/test/invalidTextContentType") + .request()) { + assertThat(res.status(), is(Http.Status.OK_200)); + Headers h = res.headers(); + // Raw protocol data value + Http.Header rawContentType = h.get(Http.HeaderNames.CONTENT_TYPE); + assertThat(rawContentType.value(), is(TestService.INVALID_CONTENT_TYPE_TEXT)); + // Media type parsed value + Optional contentType = h.contentType(); + assertThat(contentType.isPresent(), is(true)); + assertThat(contentType.get().text(), is(TestService.RELAXED_CONTENT_TYPE_TEXT)); + } + } + + static final class TestService implements HttpService { + + TestService() { + } + + @Override + public void routing(HttpRules rules) { + rules + .get("/invalidContentType", this::invalidContentType) + .get("/invalidTextContentType", this::invalidTextContentType); + } + + private static final String INVALID_CONTENT_TYPE_VALUE = "invalid header value"; + + private void invalidContentType(ServerRequest request, ServerResponse response) { + response.header(Http.HeaderNames.CONTENT_TYPE, INVALID_CONTENT_TYPE_VALUE) + .send(); + } + + private static final String INVALID_CONTENT_TYPE_TEXT = "text"; + private static final String RELAXED_CONTENT_TYPE_TEXT = "text/plain"; + + // Returns Content-Type: text instead of text/plain + private void invalidTextContentType(ServerRequest request, ServerResponse response) { + response.header(Http.HeaderNames.CONTENT_TYPE, INVALID_CONTENT_TYPE_TEXT) + .send(); + } + + } + +} diff --git a/nima/tests/integration/webclient/webclient/src/test/java/io/helidon/nima/tests/integration/webclient/HttpProxy.java b/webclient/tests/http1/src/test/java/io/helidon/webclient/tests/HttpProxy.java similarity index 99% rename from nima/tests/integration/webclient/webclient/src/test/java/io/helidon/nima/tests/integration/webclient/HttpProxy.java rename to webclient/tests/http1/src/test/java/io/helidon/webclient/tests/HttpProxy.java index 232a6a7dbe3..adbe700a0b8 100644 --- a/nima/tests/integration/webclient/webclient/src/test/java/io/helidon/nima/tests/integration/webclient/HttpProxy.java +++ b/webclient/tests/http1/src/test/java/io/helidon/webclient/tests/HttpProxy.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.tests.integration.webclient; +package io.helidon.webclient.tests; import java.io.IOException; import java.lang.System.Logger.Level; diff --git a/nima/tests/integration/webclient/webclient/src/test/java/io/helidon/nima/tests/integration/webclient/HttpProxyTest.java b/webclient/tests/http1/src/test/java/io/helidon/webclient/tests/HttpProxyTest.java similarity index 90% rename from nima/tests/integration/webclient/webclient/src/test/java/io/helidon/nima/tests/integration/webclient/HttpProxyTest.java rename to webclient/tests/http1/src/test/java/io/helidon/webclient/tests/HttpProxyTest.java index 915c1d64708..1f8e8cc5ab3 100644 --- a/nima/tests/integration/webclient/webclient/src/test/java/io/helidon/nima/tests/integration/webclient/HttpProxyTest.java +++ b/webclient/tests/http1/src/test/java/io/helidon/webclient/tests/HttpProxyTest.java @@ -14,28 +14,28 @@ * limitations under the License. */ -package io.helidon.nima.tests.integration.webclient; +package io.helidon.webclient.tests; import java.net.InetSocketAddress; import java.net.ProxySelector; -import io.helidon.common.http.Http; -import io.helidon.nima.http2.webclient.Http2Client; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.api.HttpClient; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.api.Proxy; -import io.helidon.nima.webclient.api.Proxy.ProxyType; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.http.Http; +import io.helidon.webclient.http2.Http2Client; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webclient.api.HttpClient; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.api.Proxy; +import io.helidon.webclient.api.Proxy.ProxyType; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.HttpRouting; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static io.helidon.common.http.Http.Method.GET; +import static io.helidon.http.Http.Method.GET; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/nima/tests/integration/webclient/webclient/src/test/java/io/helidon/nima/tests/integration/webclient/HttpsProxyTest.java b/webclient/tests/http1/src/test/java/io/helidon/webclient/tests/HttpsProxyTest.java similarity index 87% rename from nima/tests/integration/webclient/webclient/src/test/java/io/helidon/nima/tests/integration/webclient/HttpsProxyTest.java rename to webclient/tests/http1/src/test/java/io/helidon/webclient/tests/HttpsProxyTest.java index 29ff2b733f2..ef87a79b4e5 100644 --- a/nima/tests/integration/webclient/webclient/src/test/java/io/helidon/nima/tests/integration/webclient/HttpsProxyTest.java +++ b/webclient/tests/http1/src/test/java/io/helidon/webclient/tests/HttpsProxyTest.java @@ -14,34 +14,34 @@ * limitations under the License. */ -package io.helidon.nima.tests.integration.webclient; +package io.helidon.webclient.tests; import java.io.IOException; import java.net.InetSocketAddress; import java.net.ProxySelector; import io.helidon.common.configurable.Resource; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.common.pki.Keys; -import io.helidon.nima.common.tls.Tls; -import io.helidon.nima.http2.webclient.Http2Client; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.api.HttpClient; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.api.Proxy; -import io.helidon.nima.webclient.api.Proxy.ProxyType; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig.Builder; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.common.tls.Tls; +import io.helidon.webclient.http2.Http2Client; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webclient.api.HttpClient; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.api.Proxy; +import io.helidon.webclient.api.Proxy.ProxyType; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig.Builder; +import io.helidon.webserver.http.HttpRouting; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import static io.helidon.common.http.Http.Method.GET; +import static io.helidon.http.Http.Method.GET; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; diff --git a/nima/tests/integration/webclient/webclient/src/test/resources/cookies.yaml b/webclient/tests/http1/src/test/resources/cookies.yaml similarity index 100% rename from nima/tests/integration/webclient/webclient/src/test/resources/cookies.yaml rename to webclient/tests/http1/src/test/resources/cookies.yaml diff --git a/webclient/tests/http1/src/test/resources/logging-test.properties b/webclient/tests/http1/src/test/resources/logging-test.properties new file mode 100644 index 00000000000..fe804c3ed3a --- /dev/null +++ b/webclient/tests/http1/src/test/resources/logging-test.properties @@ -0,0 +1,25 @@ +# +# Copyright (c) 2023 Oracle and/or its affiliates. +# +# 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. +# +handlers=java.util.logging.ConsoleHandler +java.util.logging.ConsoleHandler.level=INFO +java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter +java.util.logging.SimpleFormatter.format=%1$tH:%1$tM:%1$tS %4$s %3$s %5$s%6$s%n +# Global logging level. Can be overridden by specific loggers +.level=INFO +io.helidon.webclient.level=INFO +io.helidon.webclient.http1.ClientRequestImpl.level=INFO +io.helidon.webclient.http1.Http1ClientConnection.level=INFO +io.helidon.common.testing.http.junit5.level=INFO diff --git a/nima/tests/integration/webclient/webclient/src/test/resources/server.p12 b/webclient/tests/http1/src/test/resources/server.p12 similarity index 100% rename from nima/tests/integration/webclient/webclient/src/test/resources/server.p12 rename to webclient/tests/http1/src/test/resources/server.p12 diff --git a/webclient/tests/http2/pom.xml b/webclient/tests/http2/pom.xml new file mode 100644 index 00000000000..40b7903b673 --- /dev/null +++ b/webclient/tests/http2/pom.xml @@ -0,0 +1,61 @@ + + + + 4.0.0 + + io.helidon.webclient.tests + helidon-webclient-tests-project + 4.0.0-SNAPSHOT + + + helidon-webclient-tests-http2 + Helidon WebClient Tests HTTP/2 + WebClient HTTP/2 tests + + + + io.helidon.webserver + helidon-webserver-http2 + + + io.helidon.webclient + helidon-webclient-http2 + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + io.vertx + vertx-core + test + + + diff --git a/webclient/tests/http2/src/main/resources/logging.properties b/webclient/tests/http2/src/main/resources/logging.properties new file mode 100644 index 00000000000..e49d44f43b3 --- /dev/null +++ b/webclient/tests/http2/src/main/resources/logging.properties @@ -0,0 +1,19 @@ +# +# Copyright (c) 2022, 2023 Oracle and/or its affiliates. +# +# 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. +# +handlers=java.util.logging.ConsoleHandler +java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS.%1$tL %5$s%6$s%n +# Global logging level. Can be overridden by specific loggers +.level=INFO diff --git a/nima/tests/integration/http2/client/src/test/java/io/helidon/nima/tests/integration/http2/client/ClientFlowControlTest.java b/webclient/tests/http2/src/test/java/io/helidon/webclient/tests/http2/ClientFlowControlTest.java similarity index 97% rename from nima/tests/integration/http2/client/src/test/java/io/helidon/nima/tests/integration/http2/client/ClientFlowControlTest.java rename to webclient/tests/http2/src/test/java/io/helidon/webclient/tests/http2/ClientFlowControlTest.java index 70f0160d2a7..aedffd1a5ec 100644 --- a/nima/tests/integration/http2/client/src/test/java/io/helidon/nima/tests/integration/http2/client/ClientFlowControlTest.java +++ b/webclient/tests/http2/src/test/java/io/helidon/webclient/tests/http2/ClientFlowControlTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.tests.integration.http2.client; +package io.helidon.webclient.tests.http2; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -30,11 +30,11 @@ import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicLong; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.http2.WindowSize; -import io.helidon.nima.http2.webclient.Http2Client; -import io.helidon.nima.http2.webclient.Http2ClientResponse; +import io.helidon.http.http2.WindowSize; +import io.helidon.webclient.http2.Http2Client; +import io.helidon.webclient.http2.Http2ClientResponse; import io.vertx.core.Vertx; import io.vertx.core.http.HttpServer; diff --git a/webclient/tests/http2/src/test/java/io/helidon/webclient/tests/http2/GetTest.java b/webclient/tests/http2/src/test/java/io/helidon/webclient/tests/http2/GetTest.java new file mode 100644 index 00000000000..150a5532036 --- /dev/null +++ b/webclient/tests/http2/src/test/java/io/helidon/webclient/tests/http2/GetTest.java @@ -0,0 +1,177 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.webclient.tests.http2; + +import java.io.IOException; +import java.io.OutputStream; +import java.io.UncheckedIOException; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; +import java.util.Optional; +import java.util.OptionalLong; +import java.util.Random; + +import io.helidon.http.Http; +import io.helidon.http.Http.HeaderName; +import io.helidon.http.Http.HeaderNames; +import io.helidon.webserver.http2.Http2Route; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webserver.http.Handler; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; + +import org.junit.jupiter.api.Test; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +@ServerTest +class GetTest { + private static final byte[] BYTES = new byte[256]; + private static final String REQUEST_HEADER_NAME_STRING = "X-REquEst-HEADeR"; + private static final String REQUEST_HEADER_VALUE_STRING = "some nice value"; + private static final String RESPONSE_HEADER_NAME_STRING = "X-REsponSE-HeADER"; + private static final String RESPONSE_HEADER_VALUE_STRING = "another nice value"; + private static final HeaderName REQUEST_HEADER_NAME = Http.HeaderNames.create(REQUEST_HEADER_NAME_STRING); + private static final HeaderName RESPONSE_HEADER_NAME = HeaderNames.create(RESPONSE_HEADER_NAME_STRING); + private static final Http.Header RESPONSE_HEADER_VALUE = Http.Headers.createCached(RESPONSE_HEADER_NAME, + RESPONSE_HEADER_VALUE_STRING); + + static { + Random random = new Random(); + random.nextBytes(BYTES); + } + + private final HttpClient httpClient; + private final URI uri; + + public GetTest(URI uri) { + this.httpClient = HttpClient.newBuilder() + .version(HttpClient.Version.HTTP_2) + .connectTimeout(Duration.ofSeconds(10)) + .build(); + this.uri = uri; + } + + @SetUpRoute + static void routing(HttpRouting.Builder router) { + // enforce http/2 so we know if upgrade failed + router.route(Http2Route.route(Http.Method.GET, "/string", Handler.create(Routes::string))) + .route(Http.Method.GET, "/bytes", Routes::bytes) + .route(Http.Method.GET, "/chunked", Routes::chunked) + .route(Http.Method.GET, "/headers", Routes::headers); + } + + @Test + void testStringRoute() throws IOException, InterruptedException { + HttpRequest request = HttpRequest.newBuilder() + .GET() + .uri(uri.resolve("/string")) + .build(); + HttpResponse response = httpClient.send(request, HttpResponse.BodyHandlers.ofString()); + + assertThat(response.statusCode(), is(Http.Status.OK_200.code())); + assertThat(response.body(), is("Hello")); + + java.net.http.HttpHeaders headers = response.headers(); + assertThat(headers.firstValueAsLong(HeaderNames.CONTENT_LENGTH.defaultCase()), + is(OptionalLong.of(5))); + } + + @Test + void testByteRoute() throws IOException, InterruptedException { + HttpRequest request = HttpRequest.newBuilder() + .GET() + .uri(uri.resolve("/bytes")) + .build(); + HttpResponse response = httpClient.send(request, HttpResponse.BodyHandlers.ofByteArray()); + + assertThat(response.statusCode(), is(Http.Status.OK_200.code())); + assertThat(response.body(), is(BYTES)); + java.net.http.HttpHeaders headers = response.headers(); + assertThat(headers.firstValueAsLong(HeaderNames.CONTENT_LENGTH.defaultCase()), + is(OptionalLong.of(BYTES.length))); + } + + @Test + void testChunkedRoute() throws IOException, InterruptedException { + HttpRequest request = HttpRequest.newBuilder() + .GET() + .uri(uri.resolve("/chunked")) + .timeout(Duration.ofSeconds(5)) + .build(); + HttpResponse response = httpClient.send(request, HttpResponse.BodyHandlers.ofByteArray()); + + assertThat(response.statusCode(), is(Http.Status.OK_200.code())); + assertThat(response.body(), is(BYTES)); + java.net.http.HttpHeaders headers = response.headers(); + assertThat(headers.firstValueAsLong(HeaderNames.CONTENT_LENGTH.defaultCase()), + is(OptionalLong.of(BYTES.length))); + } + + @Test + void testHeadersRoute() throws IOException, InterruptedException { + HttpRequest request = HttpRequest.newBuilder() + .GET() + .uri(uri.resolve("/headers")) + .header(REQUEST_HEADER_NAME_STRING, REQUEST_HEADER_VALUE_STRING) + .build(); + + HttpResponse response = httpClient.send(request, HttpResponse.BodyHandlers.ofString()); + + assertThat(response.statusCode(), is(Http.Status.OK_200.code())); + assertThat(response.body(), is("Hello")); + + java.net.http.HttpHeaders headers = response.headers(); + assertThat(headers.firstValueAsLong(Http.HeaderNames.CONTENT_LENGTH.defaultCase()), + is(OptionalLong.of(5))); + assertThat("Should contain echoed request header", + headers.firstValue(REQUEST_HEADER_NAME_STRING), is(Optional.of(REQUEST_HEADER_VALUE_STRING))); + assertThat("Should contain response header", + headers.firstValue(RESPONSE_HEADER_NAME_STRING), is(Optional.of(RESPONSE_HEADER_VALUE_STRING))); + } + + private static class Routes { + private static String string() { + return "Hello"; + } + + private static byte[] bytes() { + return BYTES; + } + + private static void chunked(ServerRequest req, ServerResponse res) { + try (OutputStream outputStream = res.outputStream()) { + outputStream.write(BYTES); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } + + private static void headers(ServerRequest req, ServerResponse res) { + res.header(req.headers().get(REQUEST_HEADER_NAME)); + res.header(RESPONSE_HEADER_VALUE); + res.send("Hello"); + } + } + +} diff --git a/webclient/tests/http2/src/test/java/io/helidon/webclient/tests/http2/HeadersTest.java b/webclient/tests/http2/src/test/java/io/helidon/webclient/tests/http2/HeadersTest.java new file mode 100644 index 00000000000..5cd771740dd --- /dev/null +++ b/webclient/tests/http2/src/test/java/io/helidon/webclient/tests/http2/HeadersTest.java @@ -0,0 +1,199 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.webclient.tests.http2; + +import java.time.Duration; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeoutException; + +import io.helidon.http.Headers; +import io.helidon.http.Http; +import io.helidon.logging.common.LogConfig; +import io.helidon.webclient.http2.Http2Client; +import io.helidon.webclient.http2.Http2ClientResponse; + +import io.vertx.core.MultiMap; +import io.vertx.core.Vertx; +import io.vertx.core.http.Http2Settings; +import io.vertx.core.http.HttpServer; +import io.vertx.core.http.HttpServerOptions; +import io.vertx.core.http.HttpServerResponse; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import static java.util.concurrent.TimeUnit.MILLISECONDS; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.is; + +class HeadersTest { + + private static final Duration TIMEOUT = Duration.ofSeconds(10); + private static final String DATA = "Helidon!!!".repeat(10); + private static final Vertx vertx = Vertx.vertx(); + private static final ExecutorService exec = Executors.newVirtualThreadPerTaskExecutor(); + private static HttpServer server; + private static int port; + + @BeforeAll + static void beforeAll() throws ExecutionException, InterruptedException, TimeoutException { + LogConfig.configureRuntime(); + server = vertx.createHttpServer(new HttpServerOptions() + .setInitialSettings(new Http2Settings() + .setMaxHeaderListSize(Integer.MAX_VALUE) + ) + ) + .requestHandler(req -> { + HttpServerResponse res = req.response(); + switch (req.path()) { + case "/trailer" -> { + res.putHeader("test", "before"); + res.write(DATA); + res.putTrailer("Trailer-header", "trailer-test"); + res.end(); + } + case "/cont-in" -> { + for (int i = 0; i < 500; i++) { + res.headers().add("test-header-" + i, DATA); + } + res.write(DATA); + res.end(); + } + case "/cont-out" -> { + MultiMap headers = req.headers(); + StringBuilder sb = new StringBuilder(); + for (Map.Entry header : headers) { + if (!header.getKey().startsWith("test-header-")) continue; + sb.append(header.getKey() + "=" + header.getValue() + "\n"); + } + + res.write(sb.toString()); + res.end(); + } + default -> res.setStatusCode(404).end(); + } + }) + .listen(0) + .toCompletionStage() + .toCompletableFuture() + .get(TIMEOUT.toMillis(), MILLISECONDS); + + port = server.actualPort(); + } + + @AfterAll + static void afterAll() { + server.close(); + vertx.close(); + exec.shutdown(); + try { + if (!exec.awaitTermination(TIMEOUT.toMillis(), MILLISECONDS)) { + exec.shutdownNow(); + } + } catch (InterruptedException e) { + exec.shutdownNow(); + } + } + + @Test + //FIXME: #6544 trailer headers are not implemented yet + @Disabled + void trailerHeader() { + try (Http2ClientResponse res = Http2Client.builder() + .baseUri("http://localhost:" + port + "/") + .build() + .method(Http.Method.GET) + .path("/trailer") + .priorKnowledge(true) + .request()) { + Headers h = res.headers(); + assertThat(h.first(Http.HeaderNames.create("test")).orElse(null), is("before")); + assertThat(res.as(String.class), is(DATA)); + assertThat(h.first(Http.HeaderNames.create("Trailer-header")).orElse(null), is("trailer-test")); + } + } + + @Test + void continuationInbound() { + try (Http2ClientResponse res = Http2Client.builder() + .baseUri("http://localhost:" + port + "/") + .build() + .method(Http.Method.GET) + .path("/cont-in") + .priorKnowledge(true) + .request()) { + + Headers h = res.headers(); + for (int i = 0; i < 500; i++) { + String name = "test-header-" + i; + assertThat("Headers " + name, h.first(Http.HeaderNames.create(name)).orElse(null), is(DATA)); + } + + assertThat(res.as(String.class), is(DATA)); + } + } + + @Test + void continuationOutbound() { + Set expected = new HashSet<>(500); + try (Http2ClientResponse res = Http2Client.builder() + .baseUri("http://localhost:" + port + "/") + .build() + .method(Http.Method.GET) + .path("/cont-out") + .priorKnowledge(true) + .headers(hv -> { + for (int i = 0; i < 500; i++) { + hv.add(Http.Headers.createCached("test-header-" + i, DATA + i)); + expected.add("test-header-" + i + "=" + DATA + i); + } + }) + .request()) { + String actual = res.as(String.class); + assertThat(List.of(actual.split("\\n")), containsInAnyOrder(expected.toArray(new String[0]))); + } + } + + @Test + void continuationOutboundPost() { + Set expected = new HashSet<>(500); + try (Http2ClientResponse res = Http2Client.builder() + .baseUri("http://localhost:" + port + "/") + .build() + .method(Http.Method.POST) + .path("/cont-out") + .priorKnowledge(true) + .headers(hv -> { + for (int i = 0; i < 500; i++) { + hv.add(Http.Headers.createCached("test-header-" + i, DATA + i)); + expected.add("test-header-" + i + "=" + DATA + i); + } + }) + .submit(DATA)) { + String actual = res.as(String.class); + assertThat(List.of(actual.split("\\n")), containsInAnyOrder(expected.toArray(new String[0]))); + } + } +} diff --git a/nima/tests/integration/http2/client/src/test/java/io/helidon/nima/tests/integration/http2/client/Http2ClientTest.java b/webclient/tests/http2/src/test/java/io/helidon/webclient/tests/http2/Http2ClientTest.java similarity index 85% rename from nima/tests/integration/http2/client/src/test/java/io/helidon/nima/tests/integration/http2/client/Http2ClientTest.java rename to webclient/tests/http2/src/test/java/io/helidon/webclient/tests/http2/Http2ClientTest.java index caaac611a32..578340c9f41 100644 --- a/nima/tests/integration/http2/client/src/test/java/io/helidon/nima/tests/integration/http2/client/Http2ClientTest.java +++ b/webclient/tests/http2/src/test/java/io/helidon/webclient/tests/http2/Http2ClientTest.java @@ -14,25 +14,25 @@ * limitations under the License. */ -package io.helidon.nima.tests.integration.http2.client; +package io.helidon.webclient.tests.http2; import io.helidon.common.configurable.Resource; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.Header; -import io.helidon.common.http.Http.HeaderNames; +import io.helidon.http.Http; +import io.helidon.http.Http.Header; +import io.helidon.http.Http.HeaderNames; import io.helidon.common.pki.Keys; -import io.helidon.nima.common.tls.Tls; -import io.helidon.nima.http2.webclient.Http2Client; -import io.helidon.nima.http2.webclient.Http2ClientResponse; -import io.helidon.nima.http2.webserver.Http2Route; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.common.tls.Tls; +import io.helidon.webclient.http2.Http2Client; +import io.helidon.webclient.http2.Http2ClientResponse; +import io.helidon.webserver.http2.Http2Route; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.http.HttpRouting; import org.junit.jupiter.api.Test; diff --git a/webclient/tests/http2/src/test/java/io/helidon/webclient/tests/http2/PostTest.java b/webclient/tests/http2/src/test/java/io/helidon/webclient/tests/http2/PostTest.java new file mode 100644 index 00000000000..7435c002850 --- /dev/null +++ b/webclient/tests/http2/src/test/java/io/helidon/webclient/tests/http2/PostTest.java @@ -0,0 +1,196 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.webclient.tests.http2; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.UncheckedIOException; +import java.util.OptionalLong; +import java.util.Random; + +import io.helidon.http.Headers; +import io.helidon.http.Http; +import io.helidon.http.Http.HeaderName; +import io.helidon.http.Http.HeaderNames; +import io.helidon.webclient.http2.Http2Client; +import io.helidon.webclient.http2.Http2ClientResponse; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.Handler; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import static io.helidon.common.testing.http.junit5.HttpHeaderMatcher.hasHeader; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +class PostTest { + private static final byte[] BYTES = new byte[256]; + private static final HeaderName REQUEST_HEADER_NAME = HeaderNames.create("X-REquEst-HEADeR"); + private static final String REQUEST_HEADER_VALUE_STRING = "some nice value"; + private static final Http.Header REQUEST_HEADER_VALUE = Http.Headers.createCached(REQUEST_HEADER_NAME, REQUEST_HEADER_VALUE_STRING); + private static final HeaderName RESPONSE_HEADER_NAME = HeaderNames.create("X-REsponSE-HeADER"); + private static final String RESPONSE_HEADER_VALUE_STRING = "another nice value"; + private static final Http.Header RESPONSE_HEADER_VALUE = Http.Headers.create(RESPONSE_HEADER_NAME, + RESPONSE_HEADER_VALUE_STRING); + + private static WebServer server; + private static Http2Client client; + + static { + Random random = new Random(); + random.nextBytes(BYTES); + } + + @BeforeAll + static void startServer() { + server = WebServer.builder() + .host("localhost") + .port(-1) + .routing(routing -> routing + .route(Http.Method.POST, "/string", Handler.create(String.class, Routes::string)) + .route(Http.Method.POST, "/bytes", Handler.create(byte[].class, Routes::bytes)) + .route(Http.Method.POST, "/chunked", Routes::chunked) + .route(Http.Method.POST, "/headers", Routes::headers) + .route(Http.Method.POST, "/close", Routes::close) + ) + .build() + .start(); + + client = Http2Client.builder() + .baseUri("http://localhost:" + server.port()) + .protocolConfig(it -> it.priorKnowledge(true)) + .build(); + } + + @AfterAll + static void stopServer() { + if (server != null) { + server.stop(); + } + } + + @Test + void testStringRoute() { + Http2ClientResponse response = client + .method(Http.Method.POST) + .uri("/string") + .submit("Hello"); + + assertThat(response.status(), is(Http.Status.OK_200)); + String entity = response.entity().as(String.class); + assertThat(entity, is("Hello")); + Headers headers = response.headers(); + assertThat("Should have correct length", headers.contentLength(), is(OptionalLong.of(5))); + } + + @Test + void testByteRoute() { + Http2ClientResponse response = client + .method(Http.Method.POST) + .uri("/bytes") + .submit(BYTES); + + assertThat(response.status(), is(Http.Status.OK_200)); + byte[] entity = response.entity().as(byte[].class); + assertThat(entity, is(BYTES)); + Headers headers = response.headers(); + assertThat(headers.contentLength(), is(OptionalLong.of(BYTES.length))); + } + + @Test + void testChunkedRoute() { + Http2ClientResponse response = client + .method(Http.Method.POST) + .uri("/chunked") + .outputStream(outputStream -> { + outputStream.write(BYTES); + outputStream.close(); + }); + + assertThat(response.status(), is(Http.Status.OK_200)); + byte[] entity = response.entity().as(byte[].class); + assertThat(entity, is(BYTES)); + } + + @Test + void testHeadersRoute() { + Http2ClientResponse response = client + .method(Http.Method.POST) + .uri("/headers") + .header(REQUEST_HEADER_VALUE) + .submit("Hello"); + + assertThat(response.status(), is(Http.Status.OK_200)); + String entity = response.entity().as(String.class); + assertThat(entity, is("Hello")); + Headers headers = response.headers(); + assertThat(headers.contentLength(), is(OptionalLong.of(5))); + assertThat(headers, hasHeader(REQUEST_HEADER_VALUE)); + assertThat(headers, hasHeader(RESPONSE_HEADER_VALUE)); + } + + @Test + void testCloseRoute() { + Http2ClientResponse response = client + .method(Http.Method.POST) + .uri("/close") + .submit("Hello"); + + assertThat(response.status(), is(Http.Status.NO_CONTENT_204)); + String entity = response.entity().as(String.class); + assertThat(entity, is("")); + } + + private static class Routes { + public static void close(ServerRequest req, ServerResponse res) { + res.status(Http.Status.NO_CONTENT_204); + res.send(); + } + + private static String string(String request) { + return request; + } + + private static byte[] bytes(byte[] bytes) { + return bytes; + } + + private static void chunked(ServerRequest req, ServerResponse res) { + byte[] buffer = new byte[512]; + try (InputStream inputStream = req.content().inputStream(); OutputStream outputStream = res.outputStream()) { + int read; + while ((read = inputStream.read(buffer)) > 0) { + outputStream.write(buffer, 0, read); + } + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } + + private static void headers(ServerRequest req, ServerResponse res) { + res.header(req.headers().get(REQUEST_HEADER_NAME)); + res.header(RESPONSE_HEADER_VALUE); + res.send(req.content().as(String.class)); + } + } + +} diff --git a/nima/tests/integration/http2/client/src/test/resources/certificate.p12 b/webclient/tests/http2/src/test/resources/certificate.p12 similarity index 100% rename from nima/tests/integration/http2/client/src/test/resources/certificate.p12 rename to webclient/tests/http2/src/test/resources/certificate.p12 diff --git a/webclient/tests/http2/src/test/resources/logging-test.properties b/webclient/tests/http2/src/test/resources/logging-test.properties new file mode 100644 index 00000000000..46d1954e0fb --- /dev/null +++ b/webclient/tests/http2/src/test/resources/logging-test.properties @@ -0,0 +1,21 @@ +# +# Copyright (c) 2023 Oracle and/or its affiliates. +# +# 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. +# +handlers=java.util.logging.ConsoleHandler +java.util.logging.ConsoleHandler.level=FINEST +java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS.%1$tL %5$s%6$s%n +# Global logging level. Can be overridden by specific loggers +.level=INFO +io.helidon.webclient.level=INFO diff --git a/webclient/tests/pom.xml b/webclient/tests/pom.xml new file mode 100644 index 00000000000..6c10a413f26 --- /dev/null +++ b/webclient/tests/pom.xml @@ -0,0 +1,51 @@ + + + + + 4.0.0 + + io.helidon.webclient + helidon-webclient-project + 4.0.0-SNAPSHOT + + + io.helidon.webclient.tests + helidon-webclient-tests-project + Helidon WebClient Tests Project + + pom + + + http1 + http2 + webclient + + + + true + true + true + true + true + true + true + + diff --git a/webclient/tests/webclient/pom.xml b/webclient/tests/webclient/pom.xml new file mode 100644 index 00000000000..fda5e141aaf --- /dev/null +++ b/webclient/tests/webclient/pom.xml @@ -0,0 +1,119 @@ + + + + 4.0.0 + + io.helidon.webclient.tests + helidon-webclient-tests-project + 4.0.0-SNAPSHOT + + + helidon-webclient-tests-webclient + Helidon WebClient Tests Legacy + + + + io.helidon.webserver + helidon-webserver + + + io.helidon.webclient + helidon-webclient + + + io.helidon.webclient + helidon-webclient-security + + + io.helidon.webserver + helidon-webserver-security + + + io.helidon.webserver + helidon-webserver-tracing + + + io.helidon.config + helidon-config-yaml + + + io.helidon.health + helidon-health + + + io.helidon.health + helidon-health-checks + + + io.helidon.metrics + helidon-metrics + + + io.helidon.security.providers + helidon-security-providers-abac + + + io.helidon.security.providers + helidon-security-providers-http-auth + + + io.helidon.tracing.providers + helidon-tracing-providers-opentracing + + + io.helidon.http.media + helidon-http-media-jsonp + + + helidon-common-testing-junit5 + io.helidon.common.testing + test + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 + test + + + io.helidon.webclient + helidon-webclient-metrics + test + + + io.helidon.webclient + helidon-webclient-tracing + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + io.opentracing + opentracing-mock + test + + + diff --git a/webclient/tests/webclient/src/main/java/io/helidon/webclient/tests/GreetService.java b/webclient/tests/webclient/src/main/java/io/helidon/webclient/tests/GreetService.java new file mode 100644 index 00000000000..0f060347fa1 --- /dev/null +++ b/webclient/tests/webclient/src/main/java/io/helidon/webclient/tests/GreetService.java @@ -0,0 +1,268 @@ +/* + * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.webclient.tests; + +import java.lang.System.Logger.Level; +import java.security.Principal; +import java.util.Collections; +import java.util.Objects; +import java.util.Optional; +import java.util.concurrent.atomic.AtomicReference; + +import io.helidon.common.context.Context; +import io.helidon.common.context.Contexts; +import io.helidon.http.Http; +import io.helidon.common.parameters.Parameters; +import io.helidon.common.uri.UriFragment; +import io.helidon.config.Config; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webclient.security.WebClientSecurity; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; +import io.helidon.security.SecurityContext; + +import jakarta.json.Json; +import jakarta.json.JsonBuilderFactory; +import jakarta.json.JsonException; +import jakarta.json.JsonObject; + +/** + * A simple service to greet you. Examples: + *

      + * Get default greeting message: + * curl -X GET http://localhost:8080/greet + *

      + * Get greeting message for Joe: + * curl -X GET http://localhost:8080/greet/Joe + *

      + * Change greeting + * curl -X PUT -H "Content-Type: application/json" -d '{"greeting" : "Howdy"}' http://localhost:8080/greet/greeting + *

      + * The message is returned as a JSON object + */ + +public class GreetService implements HttpService { + + private static final JsonBuilderFactory JSON = Json.createBuilderFactory(Collections.emptyMap()); + private static final System.Logger LOGGER = System.getLogger(GreetService.class.getName()); + + /** + * The config value for the key {@code greeting}. + */ + private final AtomicReference greeting = new AtomicReference<>(); + private final Http1Client outboundClient = Http1Client.builder() + .servicesDiscoverServices(false) + .addService(WebClientSecurity.create()) + .build(); + + GreetService(Config config) { + greeting.set(config.get("app.greeting").asString().orElse("Ciao")); + } + + /** + * A service registers itself by updating the routing rules. + * + * @param rules the routing rules. + */ + @Override + public void routing(HttpRules rules) { + rules + .get("/", this::getDefaultMessageHandler) + .get("/redirect", this::redirect) + .get("/redirectPath", this::redirectPath) + .get("/redirect/infinite", this::redirectInfinite) + .post("/form", this::form) + .post("/form/content", this::formContent) + .post("/contentLength", this::contentLength) + .put("/contentLength", this::contentLength) + .get("/contentLength", this::contentLength) + .get("/secure/basic", this::basicAuth) + .get("/secure/basic/outbound", this::basicAuthOutbound) + .get("/valuesPropagated", this::valuesPropagated) + .get("/obtainedQuery", this::obtainedQuery) + .get("/pattern with space", this::getDefaultMessageHandler) + .put("/greeting", this::updateGreetingHandler) + .get("/contextCheck", this::contextCheck); + } + + private void contentLength(ServerRequest serverRequest, ServerResponse serverResponse) { + serverRequest.headers().contentLength() + .ifPresentOrElse(value -> serverResponse.send(Http.HeaderNames.CONTENT_LENGTH + " is " + value), + () -> serverResponse.send("No " + Http.HeaderNames.CONTENT_LENGTH + " has been set")); + } + + private void basicAuthOutbound(ServerRequest request, ServerResponse response) { + + try (Http1ClientResponse clientResponse = outboundClient.get("http://localhost:" + + request.requestedUri().port() + + "/greet/secure/basic") + .request()) { + response.status(clientResponse.status()); + if (clientResponse.status() == Http.Status.OK_200) { + response.send(clientResponse.entity().as(String.class)); + } else { + response.send(); + } + } + } + + private void valuesPropagated(ServerRequest serverRequest, ServerResponse serverResponse) { + String queryParam = serverRequest.query().first("param").orElse("Query param not present"); + String fragment = serverRequest.prologue().fragment().value(); + serverResponse.status(Http.Status.OK_200); + serverResponse.send(queryParam + " " + fragment); + } + + private void obtainedQuery(ServerRequest serverRequest, ServerResponse serverResponse) { + String queryParam = serverRequest.query().first("param").orElse("Query param not present"); + String queryValue = serverRequest.query().first(queryParam).orElse("Query " + queryParam + " param not present"); + UriFragment uriFragment = serverRequest.prologue().fragment(); + String fragment = uriFragment.hasValue() ? uriFragment.value() : null; + serverResponse.status(Http.Status.OK_200); + serverResponse.send(queryValue + " " + (fragment == null ? "" : fragment)); + } + + private void basicAuth(ServerRequest serverRequest, ServerResponse response) { + String name = serverRequest.context() + .get(SecurityContext.class) + .flatMap(SecurityContext::userPrincipal) + .map(Principal::getName) + .orElse("Anonymous"); + + sendResponse(response, name); + } + + /** + * Return a worldly greeting message. + * + * @param request the server request + * @param response the server response + */ + private void getDefaultMessageHandler(ServerRequest request, + ServerResponse response) { + sendResponse(response, "World"); + } + + /** + * Return a greeting message using the name that was provided. + * + * @param request the server request + * @param response the server response + */ + private void redirect(ServerRequest request, ServerResponse response) { + response.headers().add(Http.HeaderNames.LOCATION, "http://localhost:" + request.requestedUri().port() + "/greet"); + response.status(Http.Status.MOVED_PERMANENTLY_301).send(); + } + + private void redirectPath(ServerRequest request, ServerResponse response) { + response.headers().add(Http.HeaderNames.LOCATION, "/greet"); + response.status(Http.Status.MOVED_PERMANENTLY_301).send(); + } + + private void redirectInfinite(ServerRequest request, ServerResponse response) { + response.headers().add(Http.HeaderNames.LOCATION, "http://localhost:" + request.requestedUri().port() + "/greet/redirect/infinite"); + response.status(Http.Status.MOVED_PERMANENTLY_301).send(); + } + + private void form(ServerRequest req, ServerResponse res) { + Parameters form = req.content().as(Parameters.class); + res.send("Hi " + form.first("name").orElse("unknown")); + } + + private void formContent(ServerRequest req, ServerResponse res) { + Parameters form = req.content().as(Parameters.class); + res.send(form); + } + + /** + * Set the greeting to use in future messages. + * + * @param request the server request + * @param response the server response + */ + private void updateGreetingHandler(ServerRequest request, + ServerResponse response) { + try { + JsonObject jsonObject = request.content().as(JsonObject.class); + updateGreetingFromJson(jsonObject, response); + } catch (JsonException ex) { + LOGGER.log(Level.DEBUG, "Invalid JSON", ex); + JsonObject jsonErrorObject = JSON.createObjectBuilder() + .add("error", "Invalid JSON") + .build(); + response.status(Http.Status.BAD_REQUEST_400).send(jsonErrorObject); + } + } + + private void sendResponse(ServerResponse response, String name) { + String msg = String.format("%s %s!", greeting.get(), name); + + JsonObject returnObject = JSON.createObjectBuilder() + .add("message", msg) + .build(); + response.send(returnObject); + } + + private void updateGreetingFromJson(JsonObject jo, ServerResponse response) { + + if (!jo.containsKey("greeting")) { + JsonObject jsonErrorObject = JSON.createObjectBuilder() + .add("error", "No greeting provided") + .build(); + response.status(Http.Status.BAD_REQUEST_400) + .send(jsonErrorObject); + return; + } + + greeting.set(jo.getString("greeting")); + response.status(Http.Status.NO_CONTENT_204).send(); + } + + /** + * Checks the existence of a {@code Context} object in a WebClient thread. + * + * @param request the request + * @param response the response + */ + private void contextCheck(ServerRequest request, ServerResponse response) { + Http1Client webClient = Http1Client.builder() + .baseUri("http://localhost:" + request.requestedUri().port() + "/") + .build(); + + Optional context = Contexts.context(); + + // Verify that context was propagated with auth enabled + if (context.isEmpty()) { + response.status(Http.Status.INTERNAL_SERVER_ERROR_500).send(); + return; + } + + // Register instance in context + context.get().register(this); + + // Ensure context is available in webclient threads + try (Http1ClientResponse ignored = webClient.get().request()) { + Context singleContext = Contexts.context().orElseThrow(); + Objects.requireNonNull(singleContext.get(GreetService.class)); + response.status(Http.Status.OK_200); + response.send(); + } + } +} diff --git a/webclient/tests/webclient/src/main/java/io/helidon/webclient/tests/Main.java b/webclient/tests/webclient/src/main/java/io/helidon/webclient/tests/Main.java new file mode 100644 index 00000000000..5e8845af9ba --- /dev/null +++ b/webclient/tests/webclient/src/main/java/io/helidon/webclient/tests/Main.java @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.webclient.tests; + +import io.helidon.config.Config; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.context.ContextFeature; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.tracing.TracingFeature; +import io.helidon.webserver.security.SecurityFeature; +import io.helidon.tracing.providers.opentracing.OpenTracing; + +import io.opentracing.Tracer; + +/** + * The application main class. + */ +public final class Main { + + /** + * Cannot be instantiated. + */ + private Main() { + } + + public static void main(String[] args) { + startServer(); + } + + /** + * Start the server. + * + * @return the created {@link WebServer} instance + */ + static WebServer startServer() { + return startServer(null); + } + + /** + * Start the server. + * + * @param tracer tracer, may be {@code null} + * @return the created {@link WebServer} instance + */ + static WebServer startServer(Tracer tracer) { + WebServerConfig.Builder builder = WebServer.builder(); + setup(builder, tracer); + WebServer server = builder.build().start(); + System.out.println("WEB server is up! http://localhost:" + server.port() + "/greet"); + return server; + } + + /** + * Set up the server. + * + * @param builder server builder + * @param tracer tracer, may be {@code null} + */ + static void setup(WebServerConfig.Builder builder, Tracer tracer) { + Config config = Config.create(); + builder.config(config.get("server")); + builder.routing(routing -> routing(routing, config, tracer)); + } + + /** + * Set up routing. + * + * @param config configuration of this server + * @param tracer tracer, may be {@code null} + */ + static void routing(HttpRouting.Builder routing, Config config, Tracer tracer) { + GreetService greetService = new GreetService(config); + routing.addFeature(ContextFeature.create()) + .addFeature(SecurityFeature.create(config.get("security"))) + .register("/greet", greetService); + if (tracer != null) { + routing.addFeature(TracingFeature.create(OpenTracing.create(tracer))); + } + } +} diff --git a/webclient/tests/webclient/src/main/resources/application.yaml b/webclient/tests/webclient/src/main/resources/application.yaml new file mode 100644 index 00000000000..1d90c020837 --- /dev/null +++ b/webclient/tests/webclient/src/main/resources/application.yaml @@ -0,0 +1,59 @@ +# +# Copyright (c) 2020, 2023 Oracle and/or its affiliates. +# +# 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. +# + +app: + greeting: "Hello" + +server: + port: -1 + host: 0.0.0.0 + +client: + follow-redirects: true + max-redirects: 5 + services: + tracing: + security: + +security: + providers: + # enable the "ABAC" security provider (also handles RBAC) + - abac: + # enabled the HTTP Basic authentication provider + - http-basic-auth: + realm: "helidon" + users: + - login: "jack" + password: "password" + roles: ["admin"] + - login: "jill" + password: "password" + roles: ["user"] + - login: "joe" + password: "password" + outbound: + - name: "propagate-to-all-targets" + web-server: + paths: + - path: "/greet/secure/basic" + authenticate: true + roles-allowed: ["user", "admin"] + - path: "/greet/secure/basic/outbound" + authenticate: true + roles-allowed: ["user", "admin"] + - path: "/greet/contextCheck" + authenticate: true + roles-allowed: ["user", "admin"] diff --git a/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/CertificateHelper.java b/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/CertificateHelper.java new file mode 100644 index 00000000000..1de62d353b9 --- /dev/null +++ b/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/CertificateHelper.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.helidon.webclient.tests; + +import java.util.Optional; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +class CertificateHelper { + + private static final Pattern CN_PATTERN = Pattern.compile("(.*)CN=(.*?)(,.*)?"); + + private CertificateHelper() { + } + + static Optional clientCertificateName(String name) { + Matcher matcher = CN_PATTERN.matcher(name); + if (matcher.matches()) { + String cn = matcher.group(2); + if (!cn.isBlank()) { + return Optional.of(cn); + } + } + return Optional.empty(); + } +} diff --git a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/ContextCheckTest.java b/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/ContextCheckTest.java similarity index 85% rename from tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/ContextCheckTest.java rename to webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/ContextCheckTest.java index b511862f3ae..9b422aaa156 100644 --- a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/ContextCheckTest.java +++ b/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/ContextCheckTest.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.tests.integration.webclient; +package io.helidon.webclient.tests; -import io.helidon.common.http.Http; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.WebServer; +import io.helidon.http.Http; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.WebServer; import io.helidon.security.providers.httpauth.HttpBasicAuthProvider; import org.junit.jupiter.api.Test; diff --git a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/FormTest.java b/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/FormTest.java similarity index 94% rename from tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/FormTest.java rename to webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/FormTest.java index 8aaa9c5115b..94dc241cd84 100644 --- a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/FormTest.java +++ b/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/FormTest.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.tests.integration.webclient; +package io.helidon.webclient.tests; import java.util.List; -import io.helidon.common.http.HttpMediaType; +import io.helidon.http.HttpMediaType; import io.helidon.common.media.type.MediaTypes; import io.helidon.common.parameters.Parameters; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.WebServer; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.WebServer; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; diff --git a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/HeaderTest.java b/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/HeaderTest.java similarity index 88% rename from tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/HeaderTest.java rename to webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/HeaderTest.java index e91b14f70e9..da55a81d76a 100644 --- a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/HeaderTest.java +++ b/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/HeaderTest.java @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.tests.integration.webclient; +package io.helidon.webclient.tests; import java.util.List; -import io.helidon.common.http.Http; -import io.helidon.nima.webclient.api.WebClientServiceRequest; -import io.helidon.nima.webclient.api.WebClientServiceResponse; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webclient.spi.WebClientService; -import io.helidon.nima.webserver.WebServer; +import io.helidon.http.Http; +import io.helidon.webclient.api.WebClientServiceRequest; +import io.helidon.webclient.api.WebClientServiceResponse; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webclient.spi.WebClientService; +import io.helidon.webserver.WebServer; import jakarta.json.JsonObject; import org.junit.jupiter.api.Test; diff --git a/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/MediaContextTest.java b/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/MediaContextTest.java new file mode 100644 index 00000000000..a3bf30fe241 --- /dev/null +++ b/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/MediaContextTest.java @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.helidon.webclient.tests; + +import java.io.InputStream; +import java.util.Collections; + +import io.helidon.http.Http; +import io.helidon.http.media.MediaContext; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.WebServer; + +import jakarta.json.Json; +import jakarta.json.JsonBuilderFactory; +import jakarta.json.JsonObject; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.MethodOrderer.OrderAnnotation; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestMethodOrder; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.not; +import static org.hamcrest.Matchers.nullValue; +import static org.hamcrest.Matchers.startsWith; +import static org.junit.jupiter.api.Assertions.assertAll; +import static org.junit.jupiter.api.Assertions.assertThrows; + +/** + * Tests for MediaContext functionality in WebClient. + */ +@TestMethodOrder(OrderAnnotation.class) +public class MediaContextTest extends TestParent { + + private static final JsonBuilderFactory JSON_BUILDER = Json.createBuilderFactory(Collections.emptyMap()); + private static final String DEFAULT_GREETING; + private static final JsonObject JSON_GREETING; + private static final JsonObject JSON_NEW_GREETING; + + static { + DEFAULT_GREETING = CONFIG.get("app.greeting").asString().orElse("Hello"); + + JSON_GREETING = JSON_BUILDER.createObjectBuilder() + .add("message", DEFAULT_GREETING + " World!") + .build(); + + JSON_NEW_GREETING = JSON_BUILDER.createObjectBuilder() + .add("greeting", "Hola") + .build(); + } + + MediaContextTest(WebServer server) { + super(server); + } + + @Test + @Order(1) + public void testInputStream() { + try (Http1ClientResponse res = client.get().request()) { + InputStream is = res.inputStream(); + assertAll( + () -> assertThat(res.status(), is(Http.Status.OK_200)), + () -> assertThat(new String(is.readAllBytes()), is("{\"message\":\"Hello World!\"}")) + ); + } + } + + @Test + @Order(2) + public void testMediaSupportDefaults() { + Http1Client client = Http1Client.builder() + .baseUri("http://localhost:" + server.port() + "/greet") + .build(); + + String greeting = client.get().requestEntity(String.class); + assertThat(greeting, is(JSON_GREETING.toString())); + } + + @Test + @Order(3) + public void testMediaSupportWithoutDefaults() { + Http1Client client = Http1Client.builder() + .baseUri("http://localhost:" + server.port() + "/greet") + .mediaContext(MediaContext.builder() + .registerDefaults(false) + .mediaSupportsDiscoverServices(false) + .build()) + .build(); + + IllegalArgumentException ex = assertThrows(IllegalArgumentException.class, () -> + client.get().request().as(String.class)); + assertThat(ex.getMessage(), startsWith("No client response media support for class")); + } + + @Test + @Order(4) + @Disabled("https://github.com/helidon-io/helidon/issues/7205") + public void testReaderRegisteredOnClient() { + Http1Client client = Http1Client.builder() + .baseUri("http://localhost:" + server.port() + "/greet") + .mediaContext(MediaContext.builder() + //.addMediaReader(JsonpSupport.create().reader()) + .mediaSupportsDiscoverServices(false) + .build()) + .build(); + + JsonObject jsonObject = client.get().requestEntity(JsonObject.class); + assertThat(jsonObject, is(not(nullValue()))); + + IllegalArgumentException ex = assertThrows(IllegalArgumentException.class, () -> + client.put() + .path("/greeting") + .submit(JSON_NEW_GREETING) + .close()); + assertThat(ex.getMessage(), startsWith("No client request media writer for class")); + } + + @Test + @Order(5) + @Disabled("https://github.com/helidon-io/helidon/issues/7205") + public void testWriterRegisteredOnClient() { + Http1Client client = Http1Client.builder() + .baseUri("http://localhost:" + server.port() + "/greet") + .mediaContext(MediaContext.builder() + //.addMediaWriter(JsonpSupport.create().writer()) + .mediaSupportsDiscoverServices(false) + .build()) + .build(); + + IllegalArgumentException ex = assertThrows(IllegalArgumentException.class, () -> { + try (Http1ClientResponse response = client.put() + .path("/greeting") + .submit(JSON_NEW_GREETING)) { + response.as(JsonObject.class); + } + }); + assertThat(ex.getMessage(), startsWith("No client response media support for interface")); + } +} diff --git a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/MetricsTest.java b/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/MetricsTest.java similarity index 95% rename from tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/MetricsTest.java rename to webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/MetricsTest.java index d166916e95a..d715867b5c2 100644 --- a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/MetricsTest.java +++ b/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/MetricsTest.java @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.tests.integration.webclient; +package io.helidon.webclient.tests; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.metrics.api.Registry; import io.helidon.metrics.api.RegistryFactory; -import io.helidon.nima.webclient.api.WebClientServiceResponse; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.metrics.WebClientMetrics; -import io.helidon.nima.webclient.spi.WebClientService; -import io.helidon.nima.webserver.WebServer; +import io.helidon.webclient.api.WebClientServiceResponse; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.metrics.WebClientMetrics; +import io.helidon.webclient.spi.WebClientService; +import io.helidon.webserver.WebServer; import org.eclipse.microprofile.metrics.Counter; import org.eclipse.microprofile.metrics.Gauge; diff --git a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/MutualTlsTest.java b/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/MutualTlsTest.java similarity index 94% rename from tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/MutualTlsTest.java rename to webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/MutualTlsTest.java index a71521ed731..c039298bcb8 100644 --- a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/MutualTlsTest.java +++ b/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/MutualTlsTest.java @@ -13,22 +13,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.tests.integration.webclient; +package io.helidon.webclient.tests; import java.io.UncheckedIOException; import java.security.Principal; import java.util.concurrent.atomic.AtomicBoolean; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.config.Config; import io.helidon.config.ConfigSources; -import io.helidon.nima.common.tls.Tls; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.common.tls.Tls; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.http.HttpRouting; import org.junit.jupiter.api.Test; diff --git a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/RequestTest.java b/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/RequestTest.java similarity index 94% rename from tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/RequestTest.java rename to webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/RequestTest.java index 798cdf2d601..82c22774363 100644 --- a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/RequestTest.java +++ b/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/RequestTest.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package io.helidon.tests.integration.webclient; +package io.helidon.webclient.tests; import java.net.URI; import java.util.Collections; -import io.helidon.common.http.Http; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.http1.Http1ClientRequest; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.WebServer; +import io.helidon.http.Http; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.http1.Http1ClientRequest; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.WebServer; import jakarta.json.Json; import jakarta.json.JsonBuilderFactory; diff --git a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/SecurityTest.java b/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/SecurityTest.java similarity index 87% rename from tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/SecurityTest.java rename to webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/SecurityTest.java index 2df32b03676..1e52940b07e 100644 --- a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/SecurityTest.java +++ b/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/SecurityTest.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.tests.integration.webclient; +package io.helidon.webclient.tests; -import io.helidon.common.http.Http; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webclient.security.WebClientSecurity; -import io.helidon.nima.webserver.WebServer; +import io.helidon.http.Http; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webclient.security.WebClientSecurity; +import io.helidon.webserver.WebServer; import io.helidon.security.providers.httpauth.HttpBasicAuthProvider; import jakarta.json.JsonObject; diff --git a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/StatusLineTest.java b/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/StatusLineTest.java similarity index 82% rename from tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/StatusLineTest.java rename to webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/StatusLineTest.java index becdac58f4f..3b868973b13 100644 --- a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/StatusLineTest.java +++ b/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/StatusLineTest.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package io.helidon.tests.integration.webclient; +package io.helidon.webclient.tests; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.api.WebClient; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRules; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.api.WebClient; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.HttpRules; import org.junit.jupiter.api.Test; diff --git a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/TestParent.java b/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/TestParent.java similarity index 82% rename from tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/TestParent.java rename to webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/TestParent.java index 7f094be6e21..ded9d286898 100644 --- a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/TestParent.java +++ b/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/TestParent.java @@ -14,21 +14,21 @@ * limitations under the License. */ -package io.helidon.tests.integration.webclient; +package io.helidon.webclient.tests; import java.util.stream.Stream; import io.helidon.common.context.Context; import io.helidon.config.Config; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.api.WebClient; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientConfig; -import io.helidon.nima.webclient.security.WebClientSecurity; -import io.helidon.nima.webclient.spi.WebClientService; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webclient.api.WebClient; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientConfig; +import io.helidon.webclient.security.WebClientSecurity; +import io.helidon.webclient.spi.WebClientService; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; import io.helidon.security.Security; import io.helidon.security.providers.common.OutboundTarget; import io.helidon.security.providers.httpauth.HttpBasicAuthProvider; diff --git a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/TlsTest.java b/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/TlsTest.java similarity index 89% rename from tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/TlsTest.java rename to webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/TlsTest.java index d396bcd5e1d..3a47c2570b3 100644 --- a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/TlsTest.java +++ b/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/TlsTest.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package io.helidon.tests.integration.webclient; +package io.helidon.webclient.tests; import io.helidon.common.buffers.DataReader.IncorrectNewLineException; import io.helidon.common.configurable.Resource; -import io.helidon.nima.common.tls.Tls; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; +import io.helidon.common.tls.Tls; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; import org.junit.jupiter.api.Test; diff --git a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/TracingPropagationTest.java b/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/TracingPropagationTest.java similarity index 88% rename from tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/TracingPropagationTest.java rename to webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/TracingPropagationTest.java index 09ed51f3ebb..55ea3cc84af 100644 --- a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/TracingPropagationTest.java +++ b/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/TracingPropagationTest.java @@ -14,23 +14,23 @@ * limitations under the License. */ -package io.helidon.tests.integration.webclient; +package io.helidon.webclient.tests; import java.net.URI; import java.util.List; import java.util.Map; import io.helidon.common.context.Context; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.config.Config; -import io.helidon.nima.http.media.MediaContext; -import io.helidon.nima.http.media.jsonp.JsonpSupport; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webclient.tracing.WebClientTracing; -import io.helidon.nima.webserver.WebServerConfig; +import io.helidon.http.media.MediaContext; +import io.helidon.http.media.jsonp.JsonpSupport; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webclient.tracing.WebClientTracing; +import io.helidon.webserver.WebServerConfig; import io.helidon.tracing.Tracer; import io.helidon.tracing.providers.opentracing.OpenTracing; @@ -112,7 +112,7 @@ void testTracingSuccess() { assertThat(tags.get(Tags.HTTP_METHOD.getKey()), is("GET")); assertThat(tags.get(Tags.HTTP_URL.getKey()), is(uri.toString())); assertThat(tags.get(Tags.HTTP_STATUS.getKey()), is(200)); - assertThat(tags.get(Tags.COMPONENT.getKey()), is("helidon-nima-webserver")); + assertThat(tags.get(Tags.COMPONENT.getKey()), is("helidon-webserver")); } private MockSpan findSpanWithParentId(List mockSpans, long parentId) { diff --git a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/TracingTest.java b/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/TracingTest.java similarity index 92% rename from tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/TracingTest.java rename to webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/TracingTest.java index be78b1b2cc6..029233e89b5 100644 --- a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/TracingTest.java +++ b/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/TracingTest.java @@ -14,18 +14,18 @@ * limitations under the License. */ -package io.helidon.tests.integration.webclient; +package io.helidon.webclient.tests; import java.util.List; import java.util.Map; import io.helidon.common.context.Context; -import io.helidon.nima.http.media.MediaContext; -import io.helidon.nima.http.media.jsonp.JsonpSupport; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webclient.tracing.WebClientTracing; -import io.helidon.nima.webserver.WebServer; +import io.helidon.http.media.MediaContext; +import io.helidon.http.media.jsonp.JsonpSupport; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webclient.tracing.WebClientTracing; +import io.helidon.webserver.WebServer; import io.helidon.tracing.Tracer; import io.helidon.tracing.providers.opentracing.OpenTracing; diff --git a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/UriPartTest.java b/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/UriPartTest.java similarity index 94% rename from tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/UriPartTest.java rename to webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/UriPartTest.java index ee92c8939ad..ad93aa404cd 100644 --- a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/UriPartTest.java +++ b/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/UriPartTest.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.tests.integration.webclient; - -import io.helidon.common.http.Http; -import io.helidon.nima.webclient.api.ClientResponseTyped; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.api.WebClient; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webserver.WebServer; +package io.helidon.webclient.tests; + +import io.helidon.http.Http; +import io.helidon.webclient.api.ClientResponseTyped; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.api.WebClient; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webserver.WebServer; import org.junit.jupiter.api.Test; diff --git a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/WebclientServiceValuePropagationTest.java b/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/WebclientServiceValuePropagationTest.java similarity index 88% rename from tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/WebclientServiceValuePropagationTest.java rename to webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/WebclientServiceValuePropagationTest.java index 10288aae780..37893913ff9 100644 --- a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/WebclientServiceValuePropagationTest.java +++ b/webclient/tests/webclient/src/test/java/io/helidon/webclient/tests/WebclientServiceValuePropagationTest.java @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.tests.integration.webclient; +package io.helidon.webclient.tests; import java.net.URI; -import io.helidon.nima.webclient.api.ClientUri; -import io.helidon.nima.webclient.api.WebClientServiceRequest; -import io.helidon.nima.webclient.api.WebClientServiceResponse; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.spi.WebClientService; -import io.helidon.nima.webserver.WebServer; +import io.helidon.webclient.api.ClientUri; +import io.helidon.webclient.api.WebClientServiceRequest; +import io.helidon.webclient.api.WebClientServiceResponse; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.spi.WebClientService; +import io.helidon.webserver.WebServer; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; diff --git a/tests/integration/webclient/src/test/resources/application-test.yaml b/webclient/tests/webclient/src/test/resources/application-test.yaml similarity index 100% rename from tests/integration/webclient/src/test/resources/application-test.yaml rename to webclient/tests/webclient/src/test/resources/application-test.yaml diff --git a/tests/integration/webclient/src/test/resources/client-no-ca/client.p12 b/webclient/tests/webclient/src/test/resources/client-no-ca/client.p12 similarity index 100% rename from tests/integration/webclient/src/test/resources/client-no-ca/client.p12 rename to webclient/tests/webclient/src/test/resources/client-no-ca/client.p12 diff --git a/tests/integration/webclient/src/test/resources/client-no-ca/server.p12 b/webclient/tests/webclient/src/test/resources/client-no-ca/server.p12 similarity index 100% rename from tests/integration/webclient/src/test/resources/client-no-ca/server.p12 rename to webclient/tests/webclient/src/test/resources/client-no-ca/server.p12 diff --git a/nima/tests/integration/webserver/mtls/src/main/resources/client.p12 b/webclient/tests/webclient/src/test/resources/client.p12 similarity index 100% rename from nima/tests/integration/webserver/mtls/src/main/resources/client.p12 rename to webclient/tests/webclient/src/test/resources/client.p12 diff --git a/tests/integration/webclient/src/test/resources/logging.properties b/webclient/tests/webclient/src/test/resources/logging.properties similarity index 100% rename from tests/integration/webclient/src/test/resources/logging.properties rename to webclient/tests/webclient/src/test/resources/logging.properties diff --git a/tests/integration/webclient/src/test/resources/second-valid/client.p12 b/webclient/tests/webclient/src/test/resources/second-valid/client.p12 similarity index 100% rename from tests/integration/webclient/src/test/resources/second-valid/client.p12 rename to webclient/tests/webclient/src/test/resources/second-valid/client.p12 diff --git a/tests/integration/webclient/src/test/resources/second-valid/server.p12 b/webclient/tests/webclient/src/test/resources/second-valid/server.p12 similarity index 100% rename from tests/integration/webclient/src/test/resources/second-valid/server.p12 rename to webclient/tests/webclient/src/test/resources/second-valid/server.p12 diff --git a/tests/integration/webclient/src/test/resources/server-invalid/client.p12 b/webclient/tests/webclient/src/test/resources/server-invalid/client.p12 similarity index 100% rename from tests/integration/webclient/src/test/resources/server-invalid/client.p12 rename to webclient/tests/webclient/src/test/resources/server-invalid/client.p12 diff --git a/tests/integration/webclient/src/test/resources/server-invalid/server.p12 b/webclient/tests/webclient/src/test/resources/server-invalid/server.p12 similarity index 100% rename from tests/integration/webclient/src/test/resources/server-invalid/server.p12 rename to webclient/tests/webclient/src/test/resources/server-invalid/server.p12 diff --git a/nima/tests/integration/webserver/mtls/src/main/resources/server.p12 b/webclient/tests/webclient/src/test/resources/server.p12 similarity index 100% rename from nima/tests/integration/webserver/mtls/src/main/resources/server.p12 rename to webclient/tests/webclient/src/test/resources/server.p12 diff --git a/webclient/tracing/pom.xml b/webclient/tracing/pom.xml new file mode 100644 index 00000000000..dee9a507224 --- /dev/null +++ b/webclient/tracing/pom.xml @@ -0,0 +1,90 @@ + + + + 4.0.0 + + io.helidon.webclient + helidon-webclient-project + 4.0.0-SNAPSHOT + + + helidon-webclient-tracing + Helidon WebClient Tracing + + + + io.helidon.webclient + helidon-webclient + + + io.helidon.tracing + helidon-tracing + + + io.helidon.common.features + helidon-common-features-api + true + + + io.helidon.config + helidon-config-metadata + true + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + io.helidon.common.testing + helidon-common-testing-http-junit5 + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + + + + io.helidon.common.features + helidon-common-features-api + ${helidon.version} + + + + + + diff --git a/nima/webclient/tracing/src/main/java/io/helidon/nima/webclient/tracing/WebClientTracing.java b/webclient/tracing/src/main/java/io/helidon/webclient/tracing/WebClientTracing.java similarity index 93% rename from nima/webclient/tracing/src/main/java/io/helidon/nima/webclient/tracing/WebClientTracing.java rename to webclient/tracing/src/main/java/io/helidon/webclient/tracing/WebClientTracing.java index 00149d7b65e..3c72a7f30ba 100644 --- a/nima/webclient/tracing/src/main/java/io/helidon/nima/webclient/tracing/WebClientTracing.java +++ b/webclient/tracing/src/main/java/io/helidon/webclient/tracing/WebClientTracing.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webclient.tracing; +package io.helidon.webclient.tracing; import java.util.List; import java.util.Map; @@ -22,18 +22,18 @@ import java.util.function.Function; import io.helidon.common.context.Context; -import io.helidon.common.http.ClientRequestHeaders; -import io.helidon.common.http.Http; -import io.helidon.nima.webclient.api.ClientUri; -import io.helidon.nima.webclient.api.WebClientServiceRequest; -import io.helidon.nima.webclient.api.WebClientServiceResponse; -import io.helidon.nima.webclient.spi.WebClientService; +import io.helidon.http.ClientRequestHeaders; +import io.helidon.http.Http; import io.helidon.tracing.HeaderConsumer; import io.helidon.tracing.HeaderProvider; import io.helidon.tracing.Span; import io.helidon.tracing.SpanContext; import io.helidon.tracing.Tag; import io.helidon.tracing.Tracer; +import io.helidon.webclient.api.ClientUri; +import io.helidon.webclient.api.WebClientServiceRequest; +import io.helidon.webclient.api.WebClientServiceResponse; +import io.helidon.webclient.spi.WebClientService; /** * Client service for tracing propagation. diff --git a/nima/webclient/tracing/src/main/java/io/helidon/nima/webclient/tracing/WebClientTracingProvider.java b/webclient/tracing/src/main/java/io/helidon/webclient/tracing/WebClientTracingProvider.java similarity index 84% rename from nima/webclient/tracing/src/main/java/io/helidon/nima/webclient/tracing/WebClientTracingProvider.java rename to webclient/tracing/src/main/java/io/helidon/webclient/tracing/WebClientTracingProvider.java index 9c20c0fee4b..6fa06cbb5f4 100644 --- a/nima/webclient/tracing/src/main/java/io/helidon/nima/webclient/tracing/WebClientTracingProvider.java +++ b/webclient/tracing/src/main/java/io/helidon/webclient/tracing/WebClientTracingProvider.java @@ -14,17 +14,17 @@ * limitations under the License. */ -package io.helidon.nima.webclient.tracing; +package io.helidon.webclient.tracing; import io.helidon.common.config.Config; -import io.helidon.nima.webclient.spi.WebClientService; -import io.helidon.nima.webclient.spi.WebClientServiceProvider; +import io.helidon.webclient.spi.WebClientService; +import io.helidon.webclient.spi.WebClientServiceProvider; /** * Client tracing SPI provider implementation. * * @deprecated This class should only be used via {@link java.util.ServiceLoader}. - * Use {@link io.helidon.nima.webclient.tracing.WebClientTracing} instead + * Use {@link WebClientTracing} instead */ @Deprecated public class WebClientTracingProvider implements WebClientServiceProvider { diff --git a/webclient/tracing/src/main/java/io/helidon/webclient/tracing/package-info.java b/webclient/tracing/src/main/java/io/helidon/webclient/tracing/package-info.java new file mode 100644 index 00000000000..c2e2f2efa59 --- /dev/null +++ b/webclient/tracing/src/main/java/io/helidon/webclient/tracing/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebClient Tracing Support. + */ +package io.helidon.webclient.tracing; diff --git a/webclient/tracing/src/main/java/module-info.java b/webclient/tracing/src/main/java/module-info.java new file mode 100644 index 00000000000..cee904e24d4 --- /dev/null +++ b/webclient/tracing/src/main/java/module-info.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.common.features.api.Feature; +import io.helidon.common.features.api.HelidonFlavor; +import io.helidon.webclient.spi.WebClientServiceProvider; +import io.helidon.webclient.tracing.WebClientTracingProvider; + +/** + * Helidon WebClient Tracing Support. + */ +@Feature(value = "Tracing", + description = "WebClient tracing support", + in = HelidonFlavor.SE, + path = {"WebClient", "Tracing"} +) +module io.helidon.webclient.tracing { + requires static io.helidon.common.features.api; + + requires io.helidon.webclient; + requires io.helidon.tracing; + + exports io.helidon.webclient.tracing; + + provides io.helidon.webclient.spi.WebClientServiceProvider + with io.helidon.webclient.tracing.WebClientTracingProvider; +} \ No newline at end of file diff --git a/nima/webclient/webclient/README.md b/webclient/webclient/README.md similarity index 100% rename from nima/webclient/webclient/README.md rename to webclient/webclient/README.md diff --git a/webclient/webclient/pom.xml b/webclient/webclient/pom.xml new file mode 100644 index 00000000000..5276b35181e --- /dev/null +++ b/webclient/webclient/pom.xml @@ -0,0 +1,46 @@ + + + + 4.0.0 + + io.helidon.webclient + helidon-webclient-project + 4.0.0-SNAPSHOT + + + helidon-webclient + Helidon WebClient + + + true + true + true + + + + + io.helidon.webclient + helidon-webclient-api + + + io.helidon.webclient + helidon-webclient-http1 + + + diff --git a/webclient/webclient/src/main/java/module-info.java b/webclient/webclient/src/main/java/module-info.java new file mode 100644 index 00000000000..9fae439a454 --- /dev/null +++ b/webclient/webclient/src/main/java/module-info.java @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebClient. + */ +module io.helidon.webclient { + requires transitive io.helidon.webclient.api; + requires transitive io.helidon.webclient.http1; +} diff --git a/webclient/websocket/etc/spotbugs/exclude.xml b/webclient/websocket/etc/spotbugs/exclude.xml new file mode 100644 index 00000000000..5eba4860720 --- /dev/null +++ b/webclient/websocket/etc/spotbugs/exclude.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + diff --git a/webclient/websocket/pom.xml b/webclient/websocket/pom.xml new file mode 100644 index 00000000000..b01df05e56c --- /dev/null +++ b/webclient/websocket/pom.xml @@ -0,0 +1,104 @@ + + + + 4.0.0 + + io.helidon.webclient + helidon-webclient-project + 4.0.0-SNAPSHOT + + + helidon-webclient-websocket + Helidon WebSocket Client + + + etc/spotbugs/exclude.xml + + + + + io.helidon.webclient + helidon-webclient + + + io.helidon.common + helidon-common-buffers + + + io.helidon.websocket + helidon-websocket + + + io.helidon.config + helidon-config-metadata + true + + + io.helidon.common.features + helidon-common-features-api + true + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + io.helidon.builder + helidon-builder-processor + ${helidon.version} + + + + + + io.helidon.builder + helidon-builder-processor + ${helidon.version} + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + + + + + diff --git a/nima/websocket/client/src/main/java/io/helidon/nima/websocket/client/ClientWsConnection.java b/webclient/websocket/src/main/java/io/helidon/webclient/websocket/ClientWsConnection.java similarity index 95% rename from nima/websocket/client/src/main/java/io/helidon/nima/websocket/client/ClientWsConnection.java rename to webclient/websocket/src/main/java/io/helidon/webclient/websocket/ClientWsConnection.java index e5c1be8bbf9..35f324ee8a8 100644 --- a/nima/websocket/client/src/main/java/io/helidon/nima/websocket/client/ClientWsConnection.java +++ b/webclient/websocket/src/main/java/io/helidon/webclient/websocket/ClientWsConnection.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.websocket.client; +package io.helidon.webclient.websocket; import java.nio.charset.StandardCharsets; import java.util.Optional; @@ -22,18 +22,18 @@ import io.helidon.common.buffers.BufferData; import io.helidon.common.buffers.DataReader; import io.helidon.common.socket.HelidonSocket; -import io.helidon.nima.webclient.api.ClientConnection; -import io.helidon.nima.websocket.ClientWsFrame; -import io.helidon.nima.websocket.ServerWsFrame; -import io.helidon.nima.websocket.WsCloseCodes; -import io.helidon.nima.websocket.WsCloseException; -import io.helidon.nima.websocket.WsListener; -import io.helidon.nima.websocket.WsOpCode; -import io.helidon.nima.websocket.WsSession; +import io.helidon.webclient.api.ClientConnection; +import io.helidon.websocket.ClientWsFrame; +import io.helidon.websocket.ServerWsFrame; +import io.helidon.websocket.WsCloseCodes; +import io.helidon.websocket.WsCloseException; +import io.helidon.websocket.WsListener; +import io.helidon.websocket.WsOpCode; +import io.helidon.websocket.WsSession; /** * Client WebSocket connection. This connection handles a single WebSocket interaction, using - * {@link io.helidon.nima.websocket.WsListener} to handle connection events. + * {@link io.helidon.websocket.WsListener} to handle connection events. */ public class ClientWsConnection implements WsSession, Runnable { private static final System.Logger LOGGER = System.getLogger(ClientWsConnection.class.getName()); diff --git a/nima/websocket/client/src/main/java/io/helidon/nima/websocket/client/WsClient.java b/webclient/websocket/src/main/java/io/helidon/webclient/websocket/WsClient.java similarity index 86% rename from nima/websocket/client/src/main/java/io/helidon/nima/websocket/client/WsClient.java rename to webclient/websocket/src/main/java/io/helidon/webclient/websocket/WsClient.java index d0ab7ffb3ca..1070e29ba50 100644 --- a/nima/websocket/client/src/main/java/io/helidon/nima/websocket/client/WsClient.java +++ b/webclient/websocket/src/main/java/io/helidon/webclient/websocket/WsClient.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package io.helidon.nima.websocket.client; +package io.helidon.webclient.websocket; import java.net.URI; import java.util.function.Consumer; import io.helidon.builder.api.RuntimeType; -import io.helidon.nima.webclient.api.WebClient; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.spi.Protocol; -import io.helidon.nima.websocket.WsListener; +import io.helidon.webclient.api.WebClient; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.spi.Protocol; +import io.helidon.websocket.WsListener; /** * WebSocket client. @@ -32,7 +32,7 @@ public interface WsClient extends RuntimeType.Api { /** * Protocol to use to obtain an instance of WebSocket specific clietn from - * {@link io.helidon.nima.webclient.api.WebClient#client(io.helidon.nima.webclient.spi.Protocol)}. + * {@link io.helidon.webclient.api.WebClient#client(io.helidon.webclient.spi.Protocol)}. */ Protocol PROTOCOL = WsProtocolProvider::new; @@ -72,7 +72,7 @@ static WsClient create(Consumer consumer) { /** * Starts a new WebSocket connection and runs it in a new virtual thread. - * This method returns when the connection is established and a new {@link io.helidon.nima.websocket.WsSession} is + * This method returns when the connection is established and a new {@link io.helidon.websocket.WsSession} is * started. * * @param uri URI to connect to @@ -82,7 +82,7 @@ static WsClient create(Consumer consumer) { /** * Starts a new WebSocket connection and runs it in a new virtual thread. - * This method returns when the connection is established and a new {@link io.helidon.nima.websocket.WsSession} is + * This method returns when the connection is established and a new {@link io.helidon.websocket.WsSession} is * started. * * @param path path to connect to, if client uses a base URI, this is resolved against the base URI diff --git a/nima/websocket/client/src/main/java/io/helidon/nima/websocket/client/WsClientConfigBlueprint.java b/webclient/websocket/src/main/java/io/helidon/webclient/websocket/WsClientConfigBlueprint.java similarity index 83% rename from nima/websocket/client/src/main/java/io/helidon/nima/websocket/client/WsClientConfigBlueprint.java rename to webclient/websocket/src/main/java/io/helidon/webclient/websocket/WsClientConfigBlueprint.java index d6512e3f9dd..55237b6fb7c 100644 --- a/nima/websocket/client/src/main/java/io/helidon/nima/websocket/client/WsClientConfigBlueprint.java +++ b/webclient/websocket/src/main/java/io/helidon/webclient/websocket/WsClientConfigBlueprint.java @@ -14,19 +14,19 @@ * limitations under the License. */ -package io.helidon.nima.websocket.client; +package io.helidon.webclient.websocket; import io.helidon.builder.api.Prototype; import io.helidon.config.metadata.Configured; import io.helidon.config.metadata.ConfiguredOption; -import io.helidon.nima.webclient.api.HttpClientConfig; +import io.helidon.webclient.api.HttpClientConfig; /** * WebSocket full webclient configuration. * The client configuration also contains all necessary configuration for HTTP, as WebSocket upgrades from HTTP. * - * @see io.helidon.nima.webclient.api.WebClient#client(io.helidon.nima.webclient.spi.Protocol, - * io.helidon.nima.webclient.spi.ProtocolConfig) + * @see io.helidon.webclient.api.WebClient#client(io.helidon.webclient.spi.Protocol, + * io.helidon.webclient.spi.ProtocolConfig) */ @Prototype.Blueprint @Configured diff --git a/nima/websocket/client/src/main/java/io/helidon/nima/websocket/client/WsClientException.java b/webclient/websocket/src/main/java/io/helidon/webclient/websocket/WsClientException.java similarity index 96% rename from nima/websocket/client/src/main/java/io/helidon/nima/websocket/client/WsClientException.java rename to webclient/websocket/src/main/java/io/helidon/webclient/websocket/WsClientException.java index aa6d1629f91..9b926639ccd 100644 --- a/nima/websocket/client/src/main/java/io/helidon/nima/websocket/client/WsClientException.java +++ b/webclient/websocket/src/main/java/io/helidon/webclient/websocket/WsClientException.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.websocket.client; +package io.helidon.webclient.websocket; /** * A WebSocket client exception. diff --git a/nima/websocket/client/src/main/java/io/helidon/nima/websocket/client/WsClientImpl.java b/webclient/websocket/src/main/java/io/helidon/webclient/websocket/WsClientImpl.java similarity index 92% rename from nima/websocket/client/src/main/java/io/helidon/nima/websocket/client/WsClientImpl.java rename to webclient/websocket/src/main/java/io/helidon/webclient/websocket/WsClientImpl.java index 55bb0f23c11..ab85b481ea9 100644 --- a/nima/websocket/client/src/main/java/io/helidon/nima/websocket/client/WsClientImpl.java +++ b/webclient/websocket/src/main/java/io/helidon/webclient/websocket/WsClientImpl.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.websocket.client; +package io.helidon.webclient.websocket; import java.net.URI; import java.nio.charset.StandardCharsets; @@ -25,19 +25,19 @@ import java.util.Random; import io.helidon.common.LazyValue; -import io.helidon.common.http.ClientRequestHeaders; -import io.helidon.common.http.ClientResponseHeaders; -import io.helidon.common.http.Http; import io.helidon.common.socket.SocketContext; import io.helidon.common.uri.UriInfo; -import io.helidon.nima.webclient.api.ClientConnection; -import io.helidon.nima.webclient.api.ClientUri; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.api.WebClient; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientRequest; -import io.helidon.nima.webclient.http1.UpgradeResponse; -import io.helidon.nima.websocket.WsListener; +import io.helidon.http.ClientRequestHeaders; +import io.helidon.http.ClientResponseHeaders; +import io.helidon.http.Http; +import io.helidon.webclient.api.ClientConnection; +import io.helidon.webclient.api.ClientUri; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.api.WebClient; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientRequest; +import io.helidon.webclient.http1.UpgradeResponse; +import io.helidon.websocket.WsListener; class WsClientImpl implements WsClient { /** diff --git a/nima/websocket/client/src/main/java/io/helidon/nima/websocket/client/WsClientProtocolConfigBlueprint.java b/webclient/websocket/src/main/java/io/helidon/webclient/websocket/WsClientProtocolConfigBlueprint.java similarity index 92% rename from nima/websocket/client/src/main/java/io/helidon/nima/websocket/client/WsClientProtocolConfigBlueprint.java rename to webclient/websocket/src/main/java/io/helidon/webclient/websocket/WsClientProtocolConfigBlueprint.java index 31f55324f77..febb7b58cf3 100644 --- a/nima/websocket/client/src/main/java/io/helidon/nima/websocket/client/WsClientProtocolConfigBlueprint.java +++ b/webclient/websocket/src/main/java/io/helidon/webclient/websocket/WsClientProtocolConfigBlueprint.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.nima.websocket.client; +package io.helidon.webclient.websocket; import java.util.List; import io.helidon.builder.api.Prototype; import io.helidon.config.metadata.Configured; import io.helidon.config.metadata.ConfiguredOption; -import io.helidon.nima.webclient.spi.ProtocolConfig; +import io.helidon.webclient.spi.ProtocolConfig; /** * Configuration of an HTTP/1.1 client. diff --git a/webclient/websocket/src/main/java/io/helidon/webclient/websocket/WsProtocolConfigProvider.java b/webclient/websocket/src/main/java/io/helidon/webclient/websocket/WsProtocolConfigProvider.java new file mode 100644 index 00000000000..e2cc20c6039 --- /dev/null +++ b/webclient/websocket/src/main/java/io/helidon/webclient/websocket/WsProtocolConfigProvider.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.webclient.websocket; + +import io.helidon.common.config.Config; +import io.helidon.webclient.spi.ProtocolConfigProvider; + +/** + * Implementation of protocol config provider. + */ +public class WsProtocolConfigProvider implements ProtocolConfigProvider { + /** + * Required to be used by {@link java.util.ServiceLoader}. + * + * @deprecated do not use directly, use WsClientProtocolConfig + */ + public WsProtocolConfigProvider() { + } + + @Override + public String configKey() { + return WsProtocolProvider.CONFIG_KEY; + } + + @Override + public WsClientProtocolConfig create(Config config, String name) { + return WsClientProtocolConfig.builder() + .config(config) + .name(name) + .build(); + } +} diff --git a/nima/websocket/client/src/main/java/io/helidon/nima/websocket/client/WsProtocolProvider.java b/webclient/websocket/src/main/java/io/helidon/webclient/websocket/WsProtocolProvider.java similarity index 84% rename from nima/websocket/client/src/main/java/io/helidon/nima/websocket/client/WsProtocolProvider.java rename to webclient/websocket/src/main/java/io/helidon/webclient/websocket/WsProtocolProvider.java index 12048591862..12da3959976 100644 --- a/nima/websocket/client/src/main/java/io/helidon/nima/websocket/client/WsProtocolProvider.java +++ b/webclient/websocket/src/main/java/io/helidon/webclient/websocket/WsProtocolProvider.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package io.helidon.nima.websocket.client; +package io.helidon.webclient.websocket; -import io.helidon.nima.webclient.api.WebClient; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.spi.ClientProtocolProvider; +import io.helidon.webclient.api.WebClient; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.spi.ClientProtocolProvider; /** * {@link java.util.ServiceLoader} provider implementation for WebSocket protocol. - * This supports method {@link io.helidon.nima.webclient.api.WebClient#client(io.helidon.nima.webclient.spi.Protocol)}. + * This supports method {@link io.helidon.webclient.api.WebClient#client(io.helidon.webclient.spi.Protocol)}. */ public class WsProtocolProvider implements ClientProtocolProvider { static final String CONFIG_KEY = "websocket"; diff --git a/webclient/websocket/src/main/java/io/helidon/webclient/websocket/package-info.java b/webclient/websocket/src/main/java/io/helidon/webclient/websocket/package-info.java new file mode 100644 index 00000000000..a2b7b3c43fb --- /dev/null +++ b/webclient/websocket/src/main/java/io/helidon/webclient/websocket/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebClient WebSocket Support. + */ +package io.helidon.webclient.websocket; diff --git a/webclient/websocket/src/main/java/module-info.java b/webclient/websocket/src/main/java/module-info.java new file mode 100644 index 00000000000..0dba2e4b437 --- /dev/null +++ b/webclient/websocket/src/main/java/module-info.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.common.features.api.Feature; +import io.helidon.common.features.api.HelidonFlavor; +import io.helidon.webclient.spi.ClientProtocolProvider; +import io.helidon.webclient.websocket.WsProtocolConfigProvider; +import io.helidon.webclient.websocket.WsProtocolProvider; + +/** + * Helidon WebClient WebSocket Support. + */ +@Feature(value = "WebSocket Client", + description = "WebClient WebSocket support", + in = HelidonFlavor.SE, + path = {"WebClient", "WebSocket"} +) +module io.helidon.webclient.websocket { + requires static io.helidon.common.features.api; + requires static io.helidon.config.metadata; + + requires io.helidon.websocket; + requires io.helidon.webclient; + + exports io.helidon.webclient.websocket; + + provides ClientProtocolProvider + with WsProtocolProvider; + provides io.helidon.webclient.spi.ProtocolConfigProvider + with WsProtocolConfigProvider; +} \ No newline at end of file diff --git a/webserver/access-log/pom.xml b/webserver/access-log/pom.xml new file mode 100644 index 00000000000..d139dd83d2d --- /dev/null +++ b/webserver/access-log/pom.xml @@ -0,0 +1,74 @@ + + + + 4.0.0 + + io.helidon.webserver + helidon-webserver-project + 4.0.0-SNAPSHOT + + + helidon-webserver-access-log + Helidon WebServer Access Log + + + + io.helidon.webserver + helidon-webserver + + + io.helidon.common.features + helidon-common-features-api + true + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + org.mockito + mockito-core + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + + + + + diff --git a/nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/AbstractLogEntry.java b/webserver/access-log/src/main/java/io/helidon/webserver/accesslog/AbstractLogEntry.java similarity index 98% rename from nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/AbstractLogEntry.java rename to webserver/access-log/src/main/java/io/helidon/webserver/accesslog/AbstractLogEntry.java index 842a3ba7fe7..afd559f248c 100644 --- a/nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/AbstractLogEntry.java +++ b/webserver/access-log/src/main/java/io/helidon/webserver/accesslog/AbstractLogEntry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022 Oracle and/or its affiliates. + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.webserver.accesslog; +package io.helidon.webserver.accesslog; import java.text.Normalizer; import java.util.function.Function; diff --git a/nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/AccessLogContext.java b/webserver/access-log/src/main/java/io/helidon/webserver/accesslog/AccessLogContext.java similarity index 88% rename from nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/AccessLogContext.java rename to webserver/access-log/src/main/java/io/helidon/webserver/accesslog/AccessLogContext.java index 015fcdde8ef..3132ed28483 100644 --- a/nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/AccessLogContext.java +++ b/webserver/access-log/src/main/java/io/helidon/webserver/accesslog/AccessLogContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022 Oracle and/or its affiliates. + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.webserver.accesslog; +package io.helidon.webserver.accesslog; import java.time.ZonedDateTime; -import io.helidon.nima.webserver.http.RoutingRequest; -import io.helidon.nima.webserver.http.RoutingResponse; +import io.helidon.webserver.http.RoutingRequest; +import io.helidon.webserver.http.RoutingResponse; /** * Context of the access log processing. diff --git a/nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/AccessLogEntry.java b/webserver/access-log/src/main/java/io/helidon/webserver/accesslog/AccessLogEntry.java similarity index 92% rename from nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/AccessLogEntry.java rename to webserver/access-log/src/main/java/io/helidon/webserver/accesslog/AccessLogEntry.java index 324e080a263..41a90cdbbc2 100644 --- a/nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/AccessLogEntry.java +++ b/webserver/access-log/src/main/java/io/helidon/webserver/accesslog/AccessLogEntry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022 Oracle and/or its affiliates. + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.webserver.accesslog; +package io.helidon.webserver.accesslog; /** * An entry generating data for access log. diff --git a/nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/AccessLogFeature.java b/webserver/access-log/src/main/java/io/helidon/webserver/accesslog/AccessLogFeature.java similarity index 97% rename from nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/AccessLogFeature.java rename to webserver/access-log/src/main/java/io/helidon/webserver/accesslog/AccessLogFeature.java index 6a178c0afdc..d6384598edd 100644 --- a/nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/AccessLogFeature.java +++ b/webserver/access-log/src/main/java/io/helidon/webserver/accesslog/AccessLogFeature.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.webserver.accesslog; +package io.helidon.webserver.accesslog; import java.time.Clock; import java.time.ZonedDateTime; @@ -25,11 +25,11 @@ import io.helidon.common.Weighted; import io.helidon.config.Config; -import io.helidon.nima.webserver.http.FilterChain; -import io.helidon.nima.webserver.http.HttpFeature; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.http.RoutingRequest; -import io.helidon.nima.webserver.http.RoutingResponse; +import io.helidon.webserver.http.FilterChain; +import io.helidon.webserver.http.HttpFeature; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.http.RoutingRequest; +import io.helidon.webserver.http.RoutingResponse; /** * Service that adds support for Access logging to Server. @@ -42,7 +42,7 @@ public final class AccessLogFeature implements HttpFeature, Weighted { * * @see AccessLogHandler */ - public static final String DEFAULT_LOGGER_NAME = "io.helidon.nima.webserver.AccessLog"; + public static final String DEFAULT_LOGGER_NAME = "io.helidon.webserver.AccessLog"; private static final Pattern HEADER_ENTRY_PATTERN = Pattern.compile("%\\{(.*?)}i"); private static final double WEIGHT = 1000; diff --git a/nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/AccessLogHandler.java b/webserver/access-log/src/main/java/io/helidon/webserver/accesslog/AccessLogHandler.java similarity index 80% rename from nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/AccessLogHandler.java rename to webserver/access-log/src/main/java/io/helidon/webserver/accesslog/AccessLogHandler.java index 63ebfac6adb..ff08b6bfe0b 100644 --- a/nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/AccessLogHandler.java +++ b/webserver/access-log/src/main/java/io/helidon/webserver/accesslog/AccessLogHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022 Oracle and/or its affiliates. + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.webserver.accesslog; +package io.helidon.webserver.accesslog; import java.io.IOException; import java.util.logging.FileHandler; @@ -28,14 +28,14 @@ *

      Java util logging configuration example using this handler: *

        * # Configure the log handler (uses the same configuration options as FileHandler, ignores formatter
      - * io.helidon.nima.webserver.accesslog.AccessLogHandler.level=FINEST
      - * io.helidon.nima.webserver.accesslog.AccessLogHandler.pattern=access.log
      - * io.helidon.nima.webserver.accesslog.AccessLogHandler.append=true
      + * io.helidon.webserver.accesslog.AccessLogHandler.level=FINEST
      + * io.helidon.webserver.accesslog.AccessLogHandler.pattern=access.log
      + * io.helidon.webserver.accesslog.AccessLogHandler.append=true
        *
        * # Configure the logger
      - * io.helidon.nima.webserver.AccessLog.level=INFO
      - * io.helidon.nima.webserver.AccessLog.useParentHandlers=false
      - * io.helidon.nima.webserver.AccessLog.handlers=io.helidon.nima.webserver.accesslog.AccessLogHandler
      + * io.helidon.webserver.AccessLog.level=INFO
      + * io.helidon.webserver.AccessLog.useParentHandlers=false
      + * io.helidon.webserver.AccessLog.handlers=io.helidon.webserver.accesslog.AccessLogHandler
        * 
      */ public class AccessLogHandler extends FileHandler { diff --git a/nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/HeaderLogEntry.java b/webserver/access-log/src/main/java/io/helidon/webserver/accesslog/HeaderLogEntry.java similarity index 95% rename from nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/HeaderLogEntry.java rename to webserver/access-log/src/main/java/io/helidon/webserver/accesslog/HeaderLogEntry.java index e0486c14dee..0d29ae87706 100644 --- a/nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/HeaderLogEntry.java +++ b/webserver/access-log/src/main/java/io/helidon/webserver/accesslog/HeaderLogEntry.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.nima.webserver.accesslog; +package io.helidon.webserver.accesslog; import java.util.List; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderName; +import io.helidon.http.Http; +import io.helidon.http.Http.HeaderName; /** * Access log entry for header values. diff --git a/nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/HostLogEntry.java b/webserver/access-log/src/main/java/io/helidon/webserver/accesslog/HostLogEntry.java similarity index 94% rename from nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/HostLogEntry.java rename to webserver/access-log/src/main/java/io/helidon/webserver/accesslog/HostLogEntry.java index 552ac58eca6..549e9fbdfa1 100644 --- a/nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/HostLogEntry.java +++ b/webserver/access-log/src/main/java/io/helidon/webserver/accesslog/HostLogEntry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022 Oracle and/or its affiliates. + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.webserver.accesslog; +package io.helidon.webserver.accesslog; /** * Access log entry for host (IP) values. diff --git a/nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/RequestLineLogEntry.java b/webserver/access-log/src/main/java/io/helidon/webserver/accesslog/RequestLineLogEntry.java similarity index 93% rename from nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/RequestLineLogEntry.java rename to webserver/access-log/src/main/java/io/helidon/webserver/accesslog/RequestLineLogEntry.java index 04996dbc71e..59e17649fe9 100644 --- a/nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/RequestLineLogEntry.java +++ b/webserver/access-log/src/main/java/io/helidon/webserver/accesslog/RequestLineLogEntry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022 Oracle and/or its affiliates. + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.webserver.accesslog; +package io.helidon.webserver.accesslog; -import io.helidon.common.http.HttpPrologue; +import io.helidon.http.HttpPrologue; /** * Access log entry for request line. diff --git a/nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/SizeLogEntry.java b/webserver/access-log/src/main/java/io/helidon/webserver/accesslog/SizeLogEntry.java similarity index 94% rename from nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/SizeLogEntry.java rename to webserver/access-log/src/main/java/io/helidon/webserver/accesslog/SizeLogEntry.java index f7387daf9dd..5ffaa7baf2e 100644 --- a/nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/SizeLogEntry.java +++ b/webserver/access-log/src/main/java/io/helidon/webserver/accesslog/SizeLogEntry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022 Oracle and/or its affiliates. + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.webserver.accesslog; +package io.helidon.webserver.accesslog; /** * Access log entry for entity size. diff --git a/nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/StatusLogEntry.java b/webserver/access-log/src/main/java/io/helidon/webserver/accesslog/StatusLogEntry.java similarity index 94% rename from nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/StatusLogEntry.java rename to webserver/access-log/src/main/java/io/helidon/webserver/accesslog/StatusLogEntry.java index 11e4b5ee8ff..6adba94e257 100644 --- a/nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/StatusLogEntry.java +++ b/webserver/access-log/src/main/java/io/helidon/webserver/accesslog/StatusLogEntry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022 Oracle and/or its affiliates. + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.webserver.accesslog; +package io.helidon.webserver.accesslog; /** * Access log entry for HTTP status. diff --git a/nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/TimeTakenLogEntry.java b/webserver/access-log/src/main/java/io/helidon/webserver/accesslog/TimeTakenLogEntry.java similarity index 95% rename from nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/TimeTakenLogEntry.java rename to webserver/access-log/src/main/java/io/helidon/webserver/accesslog/TimeTakenLogEntry.java index 46d26200b49..95f0b3ba345 100644 --- a/nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/TimeTakenLogEntry.java +++ b/webserver/access-log/src/main/java/io/helidon/webserver/accesslog/TimeTakenLogEntry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022 Oracle and/or its affiliates. + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.webserver.accesslog; +package io.helidon.webserver.accesslog; import java.util.concurrent.TimeUnit; diff --git a/nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/TimestampLogEntry.java b/webserver/access-log/src/main/java/io/helidon/webserver/accesslog/TimestampLogEntry.java similarity index 96% rename from nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/TimestampLogEntry.java rename to webserver/access-log/src/main/java/io/helidon/webserver/accesslog/TimestampLogEntry.java index 56fe465ff2a..f303bb3cbb4 100644 --- a/nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/TimestampLogEntry.java +++ b/webserver/access-log/src/main/java/io/helidon/webserver/accesslog/TimestampLogEntry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022 Oracle and/or its affiliates. + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.webserver.accesslog; +package io.helidon.webserver.accesslog; import java.time.format.DateTimeFormatter; diff --git a/nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/UserIdLogEntry.java b/webserver/access-log/src/main/java/io/helidon/webserver/accesslog/UserIdLogEntry.java similarity index 92% rename from nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/UserIdLogEntry.java rename to webserver/access-log/src/main/java/io/helidon/webserver/accesslog/UserIdLogEntry.java index d4d70f00663..81a65d6ec4a 100644 --- a/nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/UserIdLogEntry.java +++ b/webserver/access-log/src/main/java/io/helidon/webserver/accesslog/UserIdLogEntry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022 Oracle and/or its affiliates. + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.webserver.accesslog; +package io.helidon.webserver.accesslog; /** * Access log entry for user id. This always returns {@value NOT_AVAILABLE}. diff --git a/nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/UserLogEntry.java b/webserver/access-log/src/main/java/io/helidon/webserver/accesslog/UserLogEntry.java similarity index 95% rename from nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/UserLogEntry.java rename to webserver/access-log/src/main/java/io/helidon/webserver/accesslog/UserLogEntry.java index 80389cc62d2..2329dbcb7ec 100644 --- a/nima/webserver/access-log/src/main/java/io/helidon/nima/webserver/accesslog/UserLogEntry.java +++ b/webserver/access-log/src/main/java/io/helidon/webserver/accesslog/UserLogEntry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022 Oracle and/or its affiliates. + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.webserver.accesslog; +package io.helidon.webserver.accesslog; import java.security.Principal; import java.util.Optional; diff --git a/webserver/access-log/src/main/java/io/helidon/webserver/accesslog/package-info.java b/webserver/access-log/src/main/java/io/helidon/webserver/accesslog/package-info.java new file mode 100644 index 00000000000..30c718859ea --- /dev/null +++ b/webserver/access-log/src/main/java/io/helidon/webserver/accesslog/package-info.java @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebServer Access Log Support. + * + * @see io.helidon.webserver.accesslog.AccessLogFeature + */ +package io.helidon.webserver.accesslog; diff --git a/webserver/access-log/src/main/java/module-info.java b/webserver/access-log/src/main/java/module-info.java new file mode 100644 index 00000000000..a8aa9206625 --- /dev/null +++ b/webserver/access-log/src/main/java/module-info.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.common.features.api.Feature; +import io.helidon.common.features.api.HelidonFlavor; + +/** + * Helidon WebServer Access Log Support. + */ +@Feature(value = "Access Log", + description = "WebServer Access log support", + in = HelidonFlavor.SE, + path = {"WebServer", "AccessLog"} +) +module io.helidon.webserver.accesslog { + requires static io.helidon.common.features.api; + + requires java.logging; + + requires io.helidon.webserver; + requires io.helidon.common.security; + + exports io.helidon.webserver.accesslog; +} \ No newline at end of file diff --git a/nima/webserver/access-log/src/test/java/io/helidon/nima/webserver/accesslog/AccessLogFeatureTest.java b/webserver/access-log/src/test/java/io/helidon/webserver/accesslog/AccessLogFeatureTest.java similarity index 95% rename from nima/webserver/access-log/src/test/java/io/helidon/nima/webserver/accesslog/AccessLogFeatureTest.java rename to webserver/access-log/src/test/java/io/helidon/webserver/accesslog/AccessLogFeatureTest.java index 13aae150db6..7e9c87570b1 100644 --- a/nima/webserver/access-log/src/test/java/io/helidon/nima/webserver/accesslog/AccessLogFeatureTest.java +++ b/webserver/access-log/src/test/java/io/helidon/webserver/accesslog/AccessLogFeatureTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webserver.accesslog; +package io.helidon.webserver.accesslog; import java.security.Principal; import java.time.ZonedDateTime; @@ -22,18 +22,18 @@ import java.util.Optional; import io.helidon.common.context.Context; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderNames; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.ServerRequestHeaders; -import io.helidon.common.http.WritableHeaders; +import io.helidon.http.Http; +import io.helidon.http.Http.HeaderNames; +import io.helidon.http.HttpPrologue; +import io.helidon.http.ServerRequestHeaders; +import io.helidon.http.WritableHeaders; import io.helidon.common.security.SecurityContext; import io.helidon.common.socket.PeerInfo; import io.helidon.common.uri.UriFragment; import io.helidon.common.uri.UriPath; import io.helidon.common.uri.UriQuery; -import io.helidon.nima.webserver.http.RoutingRequest; -import io.helidon.nima.webserver.http.RoutingResponse; +import io.helidon.webserver.http.RoutingRequest; +import io.helidon.webserver.http.RoutingResponse; import org.junit.jupiter.api.Test; diff --git a/nima/webserver/access-log/src/test/java/io/helidon/nima/webserver/accesslog/TimestampLogEntryTest.java b/webserver/access-log/src/test/java/io/helidon/webserver/accesslog/TimestampLogEntryTest.java similarity index 92% rename from nima/webserver/access-log/src/test/java/io/helidon/nima/webserver/accesslog/TimestampLogEntryTest.java rename to webserver/access-log/src/test/java/io/helidon/webserver/accesslog/TimestampLogEntryTest.java index f2f9453e5a1..b2ef288fc49 100644 --- a/nima/webserver/access-log/src/test/java/io/helidon/nima/webserver/accesslog/TimestampLogEntryTest.java +++ b/webserver/access-log/src/test/java/io/helidon/webserver/accesslog/TimestampLogEntryTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022 Oracle and/or its affiliates. + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webserver.accesslog; +package io.helidon.webserver.accesslog; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; @@ -29,7 +29,7 @@ import static org.mockito.Mockito.when; /** - * Unit test for {@link io.helidon.nima.webserver.accesslog.TimestampLogEntry}. + * Unit test for {@link TimestampLogEntry}. */ class TimestampLogEntryTest { private static final ZonedDateTime TEST_TIME = ZonedDateTime.now(); diff --git a/webserver/benchmark/jmh/README.md b/webserver/benchmark/jmh/README.md new file mode 100644 index 00000000000..4f5d67e6ebc --- /dev/null +++ b/webserver/benchmark/jmh/README.md @@ -0,0 +1,34 @@ +Benchmarks +--- + +# JMH + +JMH tests are being executed with maven profile `mvn clean install -Pjmh`, baseline result is created if +file `benchmarks/jmh/jmh-baseline.json` doesn't exist. Baseline is used for current result comparison, if regression larger than +error margin(15% by default) +is detected, build fails. + +```shell +[ERROR] Failures: +[ERROR] JunitJMHRunnerTest.renderResult:69 +==================== HttpJMH.http2 (-31.41%) + Baseline ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ 44877.472 ops/s + Current ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ 30781.420 ops/s +HttpJMH.http2 regression detected. Error margin 10%(3078.14) +Expected: a value equal to or greater than <44877.471663551245> + but: <33859.562325823645> was less than <44877.471663551245> +[INFO] +[ERROR] Tests run: 2, Failures: 1, Errors: 0, Skipped: 0 +``` + +## Adding JMH tests + +New JMH tests classes should be created in `benchmarks/jmh/src/main/java/io/helidon/tests/benchmark/jmh/` +with simple name ending with `JMHTest`. + +## Troubleshooting + +When tests fails repeatedly without any code change, try regenerating baseline file +with `mvn clean install -Pjmh -Dwebserver.jmh.resetBaseline=true`. If that doesn't help, you can also set different error margin (in +percents) with +`mvn clean install -Pjmh -Dwebserver.jmh.errorMargin=15`. \ No newline at end of file diff --git a/webserver/benchmark/jmh/pom.xml b/webserver/benchmark/jmh/pom.xml new file mode 100644 index 00000000000..80c109eebcb --- /dev/null +++ b/webserver/benchmark/jmh/pom.xml @@ -0,0 +1,102 @@ + + + + 4.0.0 + + io.helidon.webserver.benchmark + helidon-webserver-benchmark-project + 4.0.0-SNAPSHOT + + + helidon-webserver-benchmark-jmh + Helidon WebServer Benchmarks JMH + + + + io.helidon.webserver + helidon-webserver + + + io.helidon.webserver + helidon-webserver-http2 + + + org.openjdk.jmh + jmh-core + + + org.openjdk.jmh + jmh-generator-annprocess + + + org.eclipse.parsson + parsson + runtime + + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-params + test + + + org.hamcrest + hamcrest-all + test + + + org.eclipse + yasson + test + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + + + + + jmh + + + + org.apache.maven.plugins + maven-surefire-plugin + + false + + + + + + + diff --git a/nima/tests/benchmark/jmh/src/main/java/io/helidon/nima/tests/benchmark/jmh/Http1ParsingJmhTest.java b/webserver/benchmark/jmh/src/main/java/io/helidon/webserver/benchmark/jmh/Http1ParsingJmhTest.java similarity index 92% rename from nima/tests/benchmark/jmh/src/main/java/io/helidon/nima/tests/benchmark/jmh/Http1ParsingJmhTest.java rename to webserver/benchmark/jmh/src/main/java/io/helidon/webserver/benchmark/jmh/Http1ParsingJmhTest.java index e520cd14ca7..647c063401e 100644 --- a/nima/tests/benchmark/jmh/src/main/java/io/helidon/nima/tests/benchmark/jmh/Http1ParsingJmhTest.java +++ b/webserver/benchmark/jmh/src/main/java/io/helidon/webserver/benchmark/jmh/Http1ParsingJmhTest.java @@ -14,18 +14,18 @@ * limitations under the License. */ -package io.helidon.nima.tests.benchmark.jmh; +package io.helidon.webserver.benchmark.jmh; import java.nio.charset.StandardCharsets; import java.util.Iterator; import java.util.List; import io.helidon.common.buffers.DataReader; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.WritableHeaders; -import io.helidon.nima.webserver.http1.Http1Headers; -import io.helidon.nima.webserver.http1.Http1Prologue; +import io.helidon.http.Http; +import io.helidon.http.HttpPrologue; +import io.helidon.http.WritableHeaders; +import io.helidon.webserver.http1.Http1Headers; +import io.helidon.webserver.http1.Http1Prologue; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Scope; diff --git a/nima/tests/benchmark/jmh/src/main/java/io/helidon/nima/tests/benchmark/jmh/HttpJmhTest.java b/webserver/benchmark/jmh/src/main/java/io/helidon/webserver/benchmark/jmh/HttpJmhTest.java similarity index 90% rename from nima/tests/benchmark/jmh/src/main/java/io/helidon/nima/tests/benchmark/jmh/HttpJmhTest.java rename to webserver/benchmark/jmh/src/main/java/io/helidon/webserver/benchmark/jmh/HttpJmhTest.java index 9eeb716d39d..c85e526fe97 100644 --- a/nima/tests/benchmark/jmh/src/main/java/io/helidon/nima/tests/benchmark/jmh/HttpJmhTest.java +++ b/webserver/benchmark/jmh/src/main/java/io/helidon/webserver/benchmark/jmh/HttpJmhTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.tests.benchmark.jmh; +package io.helidon.webserver.benchmark.jmh; import java.io.IOException; import java.net.URI; @@ -24,14 +24,14 @@ import java.nio.charset.StandardCharsets; import java.time.Duration; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderNames; +import io.helidon.http.Http; +import io.helidon.http.Http.HeaderNames; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.Handler; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; -import io.helidon.nima.webserver.http1.Http1Route; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.Handler; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; +import io.helidon.webserver.http1.Http1Route; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Scope; @@ -45,7 +45,7 @@ public class HttpJmhTest { private static final Http.Header CONTENT_TYPE = Http.Headers.createCached(Http.HeaderNames.CONTENT_TYPE, "text/plain; charset=UTF-8"); private static final Http.Header CONTENT_LENGTH = Http.Headers.createCached(HeaderNames.CONTENT_LENGTH, "13"); - private static final Http.Header SERVER = Http.Headers.createCached(Http.HeaderNames.SERVER, "Nima"); + private static final Http.Header SERVER = Http.Headers.createCached(Http.HeaderNames.SERVER, "Helidon"); private static final byte[] RESPONSE_BYTES = "Hello, World!".getBytes(StandardCharsets.UTF_8); private WebServer server; private int serverPort; diff --git a/nima/tests/benchmark/jmh/src/main/java/io/helidon/nima/tests/benchmark/jmh/HttpPrologueParsingJmhTest.java b/webserver/benchmark/jmh/src/main/java/io/helidon/webserver/benchmark/jmh/HttpPrologueParsingJmhTest.java similarity index 89% rename from nima/tests/benchmark/jmh/src/main/java/io/helidon/nima/tests/benchmark/jmh/HttpPrologueParsingJmhTest.java rename to webserver/benchmark/jmh/src/main/java/io/helidon/webserver/benchmark/jmh/HttpPrologueParsingJmhTest.java index cef01d45b87..cc056ef0b5c 100644 --- a/nima/tests/benchmark/jmh/src/main/java/io/helidon/nima/tests/benchmark/jmh/HttpPrologueParsingJmhTest.java +++ b/webserver/benchmark/jmh/src/main/java/io/helidon/webserver/benchmark/jmh/HttpPrologueParsingJmhTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.helidon.nima.tests.benchmark.jmh; +package io.helidon.webserver.benchmark.jmh; import java.nio.charset.StandardCharsets; import io.helidon.common.buffers.DataReader; -import io.helidon.common.http.HttpPrologue; -import io.helidon.nima.webserver.http1.Http1Prologue; +import io.helidon.http.HttpPrologue; +import io.helidon.webserver.http1.Http1Prologue; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Scope; diff --git a/nima/tests/benchmark/jmh/src/main/java/io/helidon/nima/tests/benchmark/jmh/HuJmhTest.java b/webserver/benchmark/jmh/src/main/java/io/helidon/webserver/benchmark/jmh/HuJmhTest.java similarity index 93% rename from nima/tests/benchmark/jmh/src/main/java/io/helidon/nima/tests/benchmark/jmh/HuJmhTest.java rename to webserver/benchmark/jmh/src/main/java/io/helidon/webserver/benchmark/jmh/HuJmhTest.java index e699cfec348..2e518132545 100644 --- a/nima/tests/benchmark/jmh/src/main/java/io/helidon/nima/tests/benchmark/jmh/HuJmhTest.java +++ b/webserver/benchmark/jmh/src/main/java/io/helidon/webserver/benchmark/jmh/HuJmhTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.tests.benchmark.jmh; +package io.helidon.webserver.benchmark.jmh; import java.util.Base64; import java.util.Random; diff --git a/webserver/benchmark/jmh/src/main/resources/logging.properties b/webserver/benchmark/jmh/src/main/resources/logging.properties new file mode 100644 index 00000000000..35b309813f0 --- /dev/null +++ b/webserver/benchmark/jmh/src/main/resources/logging.properties @@ -0,0 +1,20 @@ +# +# Copyright (c) 2022, 2023 Oracle and/or its affiliates. +# +# 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. +# +handlers=java.util.logging.ConsoleHandler +java.util.logging.ConsoleHandler.level=INFO +java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter +java.util.logging.SimpleFormatter.format=%1$tH:%1$tM:%1$tS %5$s%6$s%n +.level=SEVERE diff --git a/nima/tests/benchmark/jmh/src/test/java/io/helidon/nima/tests/benchmark/jmh/BaseLine.java b/webserver/benchmark/jmh/src/test/java/io/helidon/webserver/benchmark/jmh/BaseLine.java similarity index 97% rename from nima/tests/benchmark/jmh/src/test/java/io/helidon/nima/tests/benchmark/jmh/BaseLine.java rename to webserver/benchmark/jmh/src/test/java/io/helidon/webserver/benchmark/jmh/BaseLine.java index 9417fc72887..6092bfec091 100644 --- a/nima/tests/benchmark/jmh/src/test/java/io/helidon/nima/tests/benchmark/jmh/BaseLine.java +++ b/webserver/benchmark/jmh/src/test/java/io/helidon/webserver/benchmark/jmh/BaseLine.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.tests.benchmark.jmh; +package io.helidon.webserver.benchmark.jmh; import java.io.IOException; import java.io.OutputStream; diff --git a/nima/tests/benchmark/jmh/src/test/java/io/helidon/nima/tests/benchmark/jmh/Histogram.java b/webserver/benchmark/jmh/src/test/java/io/helidon/webserver/benchmark/jmh/Histogram.java similarity index 97% rename from nima/tests/benchmark/jmh/src/test/java/io/helidon/nima/tests/benchmark/jmh/Histogram.java rename to webserver/benchmark/jmh/src/test/java/io/helidon/webserver/benchmark/jmh/Histogram.java index df09c66d5f3..a8d6d7850aa 100644 --- a/nima/tests/benchmark/jmh/src/test/java/io/helidon/nima/tests/benchmark/jmh/Histogram.java +++ b/webserver/benchmark/jmh/src/test/java/io/helidon/webserver/benchmark/jmh/Histogram.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.tests.benchmark.jmh; +package io.helidon.webserver.benchmark.jmh; import java.util.ArrayList; import java.util.Collection; diff --git a/nima/tests/benchmark/jmh/src/test/java/io/helidon/nima/tests/benchmark/jmh/JunitJmhRunnerTest.java b/webserver/benchmark/jmh/src/test/java/io/helidon/webserver/benchmark/jmh/JunitJmhRunnerTest.java similarity index 93% rename from nima/tests/benchmark/jmh/src/test/java/io/helidon/nima/tests/benchmark/jmh/JunitJmhRunnerTest.java rename to webserver/benchmark/jmh/src/test/java/io/helidon/webserver/benchmark/jmh/JunitJmhRunnerTest.java index 74f1bedb576..324258fb5cc 100644 --- a/nima/tests/benchmark/jmh/src/test/java/io/helidon/nima/tests/benchmark/jmh/JunitJmhRunnerTest.java +++ b/webserver/benchmark/jmh/src/test/java/io/helidon/webserver/benchmark/jmh/JunitJmhRunnerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.tests.benchmark.jmh; +package io.helidon.webserver.benchmark.jmh; import java.io.File; import java.io.IOException; @@ -40,7 +40,7 @@ public class JunitJmhRunnerTest { private static final String ERROR_MARGIN_PERCENT_DEFAULT = "15"; private static final int ERROR_MARGIN = - Integer.parseInt(System.getProperty("nima.jmh.errorMargin", ERROR_MARGIN_PERCENT_DEFAULT)); + Integer.parseInt(System.getProperty("webserver.jmh.errorMargin", ERROR_MARGIN_PERCENT_DEFAULT)); static Stream httpBenchmarks() throws RunnerException, IOException { Options opt = new OptionsBuilder() @@ -57,7 +57,7 @@ static Stream httpBenchmarks() throws RunnerException, IOEx Collection runResults = new Runner(opt).run(); - boolean resetBaseline = Boolean.parseBoolean(System.getProperty("nima.jmh.resetBaseline", "false")); + boolean resetBaseline = Boolean.parseBoolean(System.getProperty("webserver.jmh.resetBaseline", "false")); File baseLineFile = Path.of("jmh-baseline.json").toFile(); Map baseLineMap; diff --git a/webserver/benchmark/pom.xml b/webserver/benchmark/pom.xml new file mode 100644 index 00000000000..f1a420f3935 --- /dev/null +++ b/webserver/benchmark/pom.xml @@ -0,0 +1,45 @@ + + + + 4.0.0 + + io.helidon.webserver + helidon-webserver-project + 4.0.0-SNAPSHOT + + + io.helidon.webserver.benchmark + helidon-webserver-benchmark-project + Helidon WebServer Benchmark Project + pom + + + jmh + + + + true + true + true + true + true + true + true + + diff --git a/webserver/context/pom.xml b/webserver/context/pom.xml new file mode 100644 index 00000000000..c0842c7aabf --- /dev/null +++ b/webserver/context/pom.xml @@ -0,0 +1,56 @@ + + + + 4.0.0 + + io.helidon.webserver + helidon-webserver-project + 4.0.0-SNAPSHOT + + + helidon-webserver-context + Helidon WebServer Context + Integration of Helidon Common Context with Helidon WebServer + + + + io.helidon.webserver + helidon-webserver + + + io.helidon.common + helidon-common-context + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + diff --git a/nima/webserver/context/src/main/java/io/helidon/nima/webserver/context/ContextFeature.java b/webserver/context/src/main/java/io/helidon/webserver/context/ContextFeature.java similarity index 83% rename from nima/webserver/context/src/main/java/io/helidon/nima/webserver/context/ContextFeature.java rename to webserver/context/src/main/java/io/helidon/webserver/context/ContextFeature.java index 82e76c55031..38d064bbc5a 100644 --- a/nima/webserver/context/src/main/java/io/helidon/nima/webserver/context/ContextFeature.java +++ b/webserver/context/src/main/java/io/helidon/webserver/context/ContextFeature.java @@ -14,19 +14,19 @@ * limitations under the License. */ -package io.helidon.nima.webserver.context; +package io.helidon.webserver.context; import io.helidon.common.Weighted; import io.helidon.common.context.Contexts; import io.helidon.config.Config; -import io.helidon.nima.webserver.http.FilterChain; -import io.helidon.nima.webserver.http.HttpFeature; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.http.RoutingRequest; -import io.helidon.nima.webserver.http.RoutingResponse; +import io.helidon.webserver.http.FilterChain; +import io.helidon.webserver.http.HttpFeature; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.http.RoutingRequest; +import io.helidon.webserver.http.RoutingResponse; /** - * Adds {@link io.helidon.common.context.Context} support to Níma WebServer. + * Adds {@link io.helidon.common.context.Context} support to Helidon WebServer. * When added to the processing, further processing will be executed in a request specific context. */ public class ContextFeature implements HttpFeature, Weighted { diff --git a/webserver/context/src/main/java/io/helidon/webserver/context/package-info.java b/webserver/context/src/main/java/io/helidon/webserver/context/package-info.java new file mode 100644 index 00000000000..58ee598f5aa --- /dev/null +++ b/webserver/context/src/main/java/io/helidon/webserver/context/package-info.java @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebServer Context Support. + * Integration of {@link io.helidon.common.context.Context} with {@link io.helidon.webserver.WebServer}. + * Register {@link io.helidon.webserver.context.ContextFeature} with + * {@link io.helidon.webserver.http.HttpRouting.Builder#addFilter(io.helidon.webserver.http.Filter) routing builder}. + * This will create a request specific context accessible through {@link io.helidon.common.context.Contexts#context()}. + */ +package io.helidon.webserver.context; diff --git a/webserver/context/src/main/java/module-info.java b/webserver/context/src/main/java/module-info.java new file mode 100644 index 00000000000..23ca47ce887 --- /dev/null +++ b/webserver/context/src/main/java/module-info.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebServer Context Support. + * Integration of {@link io.helidon.common.context.Context} with {@link io.helidon.webserver.WebServer}. + * Register {@link io.helidon.webserver.context.ContextFeature} with + * {@link io.helidon.webserver.http.HttpRouting.Builder#addFeature(java.util.function.Supplier)}. + * This will create a request specific context accessible through {@link io.helidon.common.context.Contexts#context()}. + */ +module io.helidon.webserver.context { + requires io.helidon.common.context; + requires io.helidon.common; + requires transitive io.helidon.config; + requires io.helidon.webserver; + + exports io.helidon.webserver.context; +} \ No newline at end of file diff --git a/nima/webserver/context/src/test/java/io/helidon/nima/webserver/context/ContextFeatureBase.java b/webserver/context/src/test/java/io/helidon/webserver/context/ContextFeatureBase.java similarity index 88% rename from nima/webserver/context/src/test/java/io/helidon/nima/webserver/context/ContextFeatureBase.java rename to webserver/context/src/test/java/io/helidon/webserver/context/ContextFeatureBase.java index 9a1bb76a713..3421e93b8a9 100644 --- a/nima/webserver/context/src/test/java/io/helidon/nima/webserver/context/ContextFeatureBase.java +++ b/webserver/context/src/test/java/io/helidon/webserver/context/ContextFeatureBase.java @@ -14,17 +14,17 @@ * limitations under the License. */ -package io.helidon.nima.webserver.context; +package io.helidon.webserver.context; import java.util.Optional; import io.helidon.common.context.Context; import io.helidon.common.context.Contexts; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import org.junit.jupiter.api.Test; diff --git a/nima/webserver/context/src/test/java/io/helidon/nima/webserver/context/ContextFeatureIT.java b/webserver/context/src/test/java/io/helidon/webserver/context/ContextFeatureIT.java similarity index 77% rename from nima/webserver/context/src/test/java/io/helidon/nima/webserver/context/ContextFeatureIT.java rename to webserver/context/src/test/java/io/helidon/webserver/context/ContextFeatureIT.java index fd93b08e2d7..816939d5476 100644 --- a/nima/webserver/context/src/test/java/io/helidon/nima/webserver/context/ContextFeatureIT.java +++ b/webserver/context/src/test/java/io/helidon/webserver/context/ContextFeatureIT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.helidon.nima.webserver.context; +package io.helidon.webserver.context; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.webclient.http1.Http1Client; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webclient.http1.Http1Client; @ServerTest class ContextFeatureIT extends ContextFeatureBase { diff --git a/nima/webserver/context/src/test/java/io/helidon/nima/webserver/context/ContextFeatureTest.java b/webserver/context/src/test/java/io/helidon/webserver/context/ContextFeatureTest.java similarity index 76% rename from nima/webserver/context/src/test/java/io/helidon/nima/webserver/context/ContextFeatureTest.java rename to webserver/context/src/test/java/io/helidon/webserver/context/ContextFeatureTest.java index 9875192e11c..21f98324aad 100644 --- a/nima/webserver/context/src/test/java/io/helidon/nima/webserver/context/ContextFeatureTest.java +++ b/webserver/context/src/test/java/io/helidon/webserver/context/ContextFeatureTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.helidon.nima.webserver.context; +package io.helidon.webserver.context; -import io.helidon.nima.testing.junit5.webserver.DirectClient; -import io.helidon.nima.testing.junit5.webserver.RoutingTest; +import io.helidon.webserver.testing.junit5.DirectClient; +import io.helidon.webserver.testing.junit5.RoutingTest; @RoutingTest class ContextFeatureTest extends ContextFeatureBase { diff --git a/webserver/cors/pom.xml b/webserver/cors/pom.xml new file mode 100644 index 00000000000..285f2c8ab0e --- /dev/null +++ b/webserver/cors/pom.xml @@ -0,0 +1,83 @@ + + + + 4.0.0 + + io.helidon.webserver + helidon-webserver-project + 4.0.0-SNAPSHOT + + + helidon-webserver-cors + Helidon WebServer CORS + Cross-origin resource sharing support + + + + io.helidon.webserver + helidon-webserver + + + io.helidon.config + helidon-config + + + io.helidon.cors + helidon-cors + + + io.helidon.common.features + helidon-common-features-api + true + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + + + + + diff --git a/nima/webserver/cors/src/main/java/io/helidon/nima/webserver/cors/CorsEnabledServiceHelper.java b/webserver/cors/src/main/java/io/helidon/webserver/cors/CorsEnabledServiceHelper.java similarity index 95% rename from nima/webserver/cors/src/main/java/io/helidon/nima/webserver/cors/CorsEnabledServiceHelper.java rename to webserver/cors/src/main/java/io/helidon/webserver/cors/CorsEnabledServiceHelper.java index 0f836fc3465..b2e0e1fa7e4 100644 --- a/nima/webserver/cors/src/main/java/io/helidon/nima/webserver/cors/CorsEnabledServiceHelper.java +++ b/webserver/cors/src/main/java/io/helidon/webserver/cors/CorsEnabledServiceHelper.java @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.webserver.cors; +package io.helidon.webserver.cors; import java.lang.System.Logger.Level; import io.helidon.config.Config; import io.helidon.cors.CrossOriginConfig; -import io.helidon.nima.webserver.http.Handler; +import io.helidon.webserver.http.Handler; /** - * Allows services (including Helidon Níma built-in services) to register CORS support easily. + * Allows services (including Helidon WebServer built-in services) to register CORS support easily. *

      * Callers use either {@link #create(String)} or {@link #create(String, CrossOriginConfig)} to initialize the helper for a * service. The helper uses the {@link CrossOriginConfig} instance to set up CORS behavior for the service. If the caller diff --git a/webserver/cors/src/main/java/io/helidon/webserver/cors/CorsServerRequestAdapter.java b/webserver/cors/src/main/java/io/helidon/webserver/cors/CorsServerRequestAdapter.java new file mode 100644 index 00000000000..d4c835ba9d3 --- /dev/null +++ b/webserver/cors/src/main/java/io/helidon/webserver/cors/CorsServerRequestAdapter.java @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.helidon.webserver.cors; + +import java.util.List; +import java.util.Optional; + +import io.helidon.cors.CorsRequestAdapter; +import io.helidon.http.Http.HeaderName; +import io.helidon.http.ServerRequestHeaders; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; + +/** + * Implementation of {@link CorsRequestAdapter} that adapts {@link ServerRequest}. + */ +class CorsServerRequestAdapter implements CorsRequestAdapter { + + private final ServerRequest request; + private final ServerResponse response; + private final ServerRequestHeaders headers; + + CorsServerRequestAdapter(ServerRequest req, ServerResponse res) { + this.request = req; + this.response = res; + this.headers = req.headers(); + } + + @Override + public String authority() { + return request.authority(); + } + + @Override + public String path() { + return request.path().path(); + } + + @Override + public Optional firstHeader(HeaderName key) { + if (headers.contains(key)) { + return Optional.of(headers.get(key).value()); + } + return Optional.empty(); + } + + @Override + public boolean headerContainsKey(HeaderName key) { + return headers.contains(key); + } + + @Override + public List allHeaders(HeaderName key) { + return headers.all(key, List::of); + } + + @Override + public String method() { + return request.prologue().method().text(); + } + + @Override + public void next() { + response.next(); + } + + @Override + public ServerRequest request() { + return request; + } + + @Override + public String toString() { + return String.format("RequestAdapterSe{path=%s, method=%s, headers=%s}", path(), method(), request.headers()); + } +} diff --git a/webserver/cors/src/main/java/io/helidon/webserver/cors/CorsServerResponseAdapter.java b/webserver/cors/src/main/java/io/helidon/webserver/cors/CorsServerResponseAdapter.java new file mode 100644 index 00000000000..bfb4aa97b36 --- /dev/null +++ b/webserver/cors/src/main/java/io/helidon/webserver/cors/CorsServerResponseAdapter.java @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.helidon.webserver.cors; + +import io.helidon.cors.CorsResponseAdapter; +import io.helidon.http.Http; +import io.helidon.http.Http.HeaderName; +import io.helidon.webserver.http.ServerResponse; + +/** + * Implementation of {@link CorsResponseAdapter} that adapts {@link ServerResponse}. + */ +class CorsServerResponseAdapter implements CorsResponseAdapter { + + private final ServerResponse serverResponse; + + CorsServerResponseAdapter(ServerResponse serverResponse) { + this.serverResponse = serverResponse; + } + + @Override + public CorsServerResponseAdapter header(HeaderName key, String value) { + serverResponse.header(key, value); + return this; + } + + @Override + public CorsServerResponseAdapter header(HeaderName key, Object value) { + serverResponse.header(key, value.toString()); + return this; + } + + @Override + public ServerResponse forbidden(String message) { + serverResponse.status(Http.Status.create(Http.Status.FORBIDDEN_403.code(), message)); + return serverResponse; + } + + @Override + public ServerResponse ok() { + serverResponse.status(Http.Status.OK_200); + return serverResponse; + } + + @Override + public int status() { + return serverResponse.status().code(); + } +} diff --git a/nima/webserver/cors/src/main/java/io/helidon/nima/webserver/cors/CorsSupport.java b/webserver/cors/src/main/java/io/helidon/webserver/cors/CorsSupport.java similarity index 88% rename from nima/webserver/cors/src/main/java/io/helidon/nima/webserver/cors/CorsSupport.java rename to webserver/cors/src/main/java/io/helidon/webserver/cors/CorsSupport.java index a8255754ed4..61c735bdf73 100644 --- a/nima/webserver/cors/src/main/java/io/helidon/nima/webserver/cors/CorsSupport.java +++ b/webserver/cors/src/main/java/io/helidon/webserver/cors/CorsSupport.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.webserver.cors; +package io.helidon.webserver.cors; import java.util.Optional; @@ -22,11 +22,11 @@ import io.helidon.cors.CorsResponseAdapter; import io.helidon.cors.CorsSupportBase; import io.helidon.cors.CorsSupportHelper; -import io.helidon.nima.webserver.http.Handler; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.Handler; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; /** * SE implementation of {@link CorsSupportBase}. @@ -91,8 +91,8 @@ public void handle(ServerRequest req, ServerResponse res) { res.next(); return; } - CorsRequestAdapter requestAdapter = new RequestAdapterNima(req, res); - CorsResponseAdapter responseAdapter = new ResponseAdapterNima(res); + CorsRequestAdapter requestAdapter = new CorsServerRequestAdapter(req, res); + CorsResponseAdapter responseAdapter = new CorsServerResponseAdapter(res); Optional responseOpt = helper().processRequest(requestAdapter, responseAdapter); @@ -124,7 +124,7 @@ public static class Builder extends CorsSupportBase.Builder + * Use {@link io.helidon.webserver.cors.CorsSupport} and its {@link io.helidon.webserver.cors.CorsSupport.Builder} to + * add CORS + * handling to resources in your application. + *

      + * Because Helidon WebServer does not use annotation processing to identify endpoints, you need to provide the CORS information for + * your application another way. You can use Helidon configuration, the Helidon WebServer CORS API, or a combination. + *

      Configuration

      + *

      Format

      + * CORS configuration looks like this: + *
      + * enabled: true    # the default
      + * allow-origins: ["http://foo.bar", "http://bar.foo"]
      + * allow-methods: ["DELETE", "PUT"]
      + * allow-headers: ["X-bar", "X-foo"]
      + * allow-credentials: true
      + * max-age: -1
      + * 
      + *

      Finding and applying CORS configuration

      + * Although Helidon WebServer prescribes the CORS config format, you can put it wherever you want in your application's configuration + * file. Your application code will retrieve the CORS config from its location within your configuration and then use that + * config node to prepare CORS support for your app. + * + * For example, if you set up this configuration + *
      + * narrow:
      + *   allow-origins: ["http://foo.bar", "http://bar.foo"]
      + *   allow-methods: ["DELETE", "PUT"]
      + *   allow-headers: ["X-bar", "X-foo"]
      + *   allow-credentials: true
      + *   max-age: -1
      + *
      + * wide:
      + *   enabled: false
      + *   allow-origins: ["*"]
      + *   allow-methods: ["*"]
      + *
      + * just-disabled:
      + *   enabled: false
      + * 
      + *

      + * in a resource called {@code myApp.yaml} then the following code would apply it to your app: + *

      + *
      {@code
      + *         Config myAppConfig = Config.builder().sources(ConfigSources.classpath("myApp.yaml")).build();
      + *         Routing.Builder builder = Routing.builder();
      + *         myAppConfig.get("narrow").ifPresent(c -> builder.any(
      + *                          "/greet", CorsSupport.create(c),
      + *                          (req, resp) -> resp.status(Http.Status.OK_200).send()));
      + *         myAppConfig.get("wide".ifPresent(c -> builder.get(
      + *                          "/greet", CorsSupport.create(c),
      + *                          (req, resp) -> resp.status(Http.Status.OK_200).send("Hello, World!")));
      + *     }
      + * This sets up more restrictive CORS behavior for more sensitive HTTP methods ({@code PUT} for example) and more liberal CORS + * behavior for {@code GET}. + * + *

      The Helidon WebServer CORS API

      + * You can define your application's CORS behavior programmatically -- together with configuration if you want -- by: + *
        + *
      • creating a {@link io.helidon.cors.CrossOriginConfig.Builder} instance,
      • + *
      • operating on the builder to prepare the CORS set-up you want,
      • + *
      • using the builder's {@code build()} method to create the {@code CrossOriginConfig} instance, and
      • + *
      + *

      + * The next example shows creating CORS information and associating it with the path {@code /cors3} within the app. + *

      + *         CrossOriginConfig corsForCORS3= CrossOriginConfig.builder()
      + *             .allowOrigins("http://foo.bar", "http://bar.foo")
      + *             .allowMethods("DELETE", "PUT")
      + *             .build();
      + *
      + *         Routing.Builder builder = Routing.builder()
      + *                 .register("/myapp",
      + *                           CorsSupport.builder()
      + *                                 .addCrossOrigin("/cors3", corsForCORS3) // links the CORS info with a path within the app
      + *                                 .build(),
      + *                           new MyApp());
      + * 
      + * Notice that you pass two services to the {@code register} method: the {@code CorsSupport} instance and your app + * instance. Helidon WebServer will process requests to the path you specify with those services in that order. + * Also, note that you have to make sure you use the same path in this API call and in your {@code MyApp} service if you adjust + * the routing there. + *

      + * Invoke {@code addCrossOrigin} multiple times to link more paths with CORS configuration. You can reuse one {@code + * CrossOriginConfig} object with more than one path if that meets your needs. + *

      + *

      + * Remember that the CORS protocol uses the {@code OPTIONS} HTTP method for preflight requests. If you use the handler-based + * methods on {@code Routing.Builder} be sure to invoke the {@code options} method as well (or {code any}) to set up routing for + * {@code OPTIONS} requests. + *

      + *

      + * Each {@code CorsSupport} instance can be enabled or disabled, either through configuration or using the API. + * By default, when an application creates a new {@code CorsSupport.Builder} instance that builder's {@code build()} method will + * create an enabled {@code CorsSupport} object. Any subsequent explicit setting on the builder, either expressly set by an + * {@code enabled} entry in configuration passed to {@code CorsSupport.Builder.config} or set by invoking + * {@code CorsSupport.Builder.enabled} follows the familiar "latest-wins" approach. + *

      + */ +package io.helidon.webserver.cors; diff --git a/webserver/cors/src/main/java/module-info.java b/webserver/cors/src/main/java/module-info.java new file mode 100644 index 00000000000..5b668396f41 --- /dev/null +++ b/webserver/cors/src/main/java/module-info.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.common.features.api.Feature; +import io.helidon.common.features.api.HelidonFlavor; + +/** + * Helidon WebServer CORS Support. + */ +@Feature(value = "CORS", + description = "WebServer CORS support", + in = HelidonFlavor.SE, + path = {"WebServer", "CORS"} +) +module io.helidon.webserver.cors { + requires static io.helidon.common.features.api; + + requires java.logging; + + requires transitive io.helidon.cors; + requires io.helidon.webserver; + + exports io.helidon.webserver.cors; +} \ No newline at end of file diff --git a/nima/webserver/cors/src/test/java/io/helidon/nima/webserver/cors/AbstractCorsTest.java b/webserver/cors/src/test/java/io/helidon/webserver/cors/AbstractCorsTest.java similarity index 91% rename from nima/webserver/cors/src/test/java/io/helidon/nima/webserver/cors/AbstractCorsTest.java rename to webserver/cors/src/test/java/io/helidon/webserver/cors/AbstractCorsTest.java index 4ace5a1d883..12b3dda01a7 100644 --- a/nima/webserver/cors/src/test/java/io/helidon/nima/webserver/cors/AbstractCorsTest.java +++ b/webserver/cors/src/test/java/io/helidon/webserver/cors/AbstractCorsTest.java @@ -13,28 +13,28 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.webserver.cors; +package io.helidon.webserver.cors; -import io.helidon.common.http.Http; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientRequest; -import io.helidon.nima.webclient.http1.Http1ClientResponse; +import io.helidon.http.Http; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientRequest; +import io.helidon.webclient.http1.Http1ClientResponse; import org.junit.jupiter.api.Test; -import static io.helidon.common.http.Http.HeaderNames.ACCESS_CONTROL_ALLOW_CREDENTIALS; -import static io.helidon.common.http.Http.HeaderNames.ACCESS_CONTROL_ALLOW_HEADERS; -import static io.helidon.common.http.Http.HeaderNames.ACCESS_CONTROL_ALLOW_METHODS; -import static io.helidon.common.http.Http.HeaderNames.ACCESS_CONTROL_ALLOW_ORIGIN; -import static io.helidon.common.http.Http.HeaderNames.ACCESS_CONTROL_MAX_AGE; -import static io.helidon.common.http.Http.HeaderNames.ACCESS_CONTROL_REQUEST_HEADERS; -import static io.helidon.common.http.Http.HeaderNames.ACCESS_CONTROL_REQUEST_METHOD; -import static io.helidon.common.http.Http.HeaderNames.ORIGIN; +import static io.helidon.http.Http.HeaderNames.ACCESS_CONTROL_ALLOW_CREDENTIALS; +import static io.helidon.http.Http.HeaderNames.ACCESS_CONTROL_ALLOW_HEADERS; +import static io.helidon.http.Http.HeaderNames.ACCESS_CONTROL_ALLOW_METHODS; +import static io.helidon.http.Http.HeaderNames.ACCESS_CONTROL_ALLOW_ORIGIN; +import static io.helidon.http.Http.HeaderNames.ACCESS_CONTROL_MAX_AGE; +import static io.helidon.http.Http.HeaderNames.ACCESS_CONTROL_REQUEST_HEADERS; +import static io.helidon.http.Http.HeaderNames.ACCESS_CONTROL_REQUEST_METHOD; +import static io.helidon.http.Http.HeaderNames.ORIGIN; import static io.helidon.common.testing.http.junit5.HttpHeaderMatcher.hasHeader; import static io.helidon.common.testing.http.junit5.HttpHeaderMatcher.noHeader; -import static io.helidon.nima.webserver.cors.CorsTestServices.SERVICE_1; -import static io.helidon.nima.webserver.cors.CorsTestServices.SERVICE_2; +import static io.helidon.webserver.cors.CorsTestServices.SERVICE_1; +import static io.helidon.webserver.cors.CorsTestServices.SERVICE_2; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; diff --git a/nima/webserver/cors/src/test/java/io/helidon/nima/webserver/cors/CorsRouting.java b/webserver/cors/src/test/java/io/helidon/webserver/cors/CorsRouting.java similarity index 92% rename from nima/webserver/cors/src/test/java/io/helidon/nima/webserver/cors/CorsRouting.java rename to webserver/cors/src/test/java/io/helidon/webserver/cors/CorsRouting.java index a16d1668f44..f405ebd33c9 100644 --- a/nima/webserver/cors/src/test/java/io/helidon/nima/webserver/cors/CorsRouting.java +++ b/webserver/cors/src/test/java/io/helidon/webserver/cors/CorsRouting.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package io.helidon.nima.webserver.cors; +package io.helidon.webserver.cors; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.config.Config; import io.helidon.config.ConfigSources; import io.helidon.cors.CrossOriginConfig; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webserver.http.HttpRules; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webserver.http.HttpRules; -import static io.helidon.nima.webserver.cors.CorsTestServices.SERVICE_3; +import static io.helidon.webserver.cors.CorsTestServices.SERVICE_3; abstract class CorsRouting { @SetUpRoute diff --git a/nima/webserver/cors/src/test/java/io/helidon/nima/webserver/cors/CorsTest.java b/webserver/cors/src/test/java/io/helidon/webserver/cors/CorsTest.java similarity index 78% rename from nima/webserver/cors/src/test/java/io/helidon/nima/webserver/cors/CorsTest.java rename to webserver/cors/src/test/java/io/helidon/webserver/cors/CorsTest.java index 0457123b2f3..c1f146cabf0 100644 --- a/nima/webserver/cors/src/test/java/io/helidon/nima/webserver/cors/CorsTest.java +++ b/webserver/cors/src/test/java/io/helidon/webserver/cors/CorsTest.java @@ -14,19 +14,19 @@ * limitations under the License. */ -package io.helidon.nima.webserver.cors; +package io.helidon.webserver.cors; -import io.helidon.common.http.Http; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.http1.Http1Client; +import io.helidon.http.Http; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.http1.Http1Client; import org.junit.jupiter.api.Test; -import static io.helidon.common.http.Http.HeaderNames.ACCESS_CONTROL_ALLOW_HEADERS; -import static io.helidon.common.http.Http.HeaderNames.ACCESS_CONTROL_ALLOW_METHODS; -import static io.helidon.common.http.Http.HeaderNames.ACCESS_CONTROL_ALLOW_ORIGIN; -import static io.helidon.common.http.Http.HeaderNames.ACCESS_CONTROL_MAX_AGE; +import static io.helidon.http.Http.HeaderNames.ACCESS_CONTROL_ALLOW_HEADERS; +import static io.helidon.http.Http.HeaderNames.ACCESS_CONTROL_ALLOW_METHODS; +import static io.helidon.http.Http.HeaderNames.ACCESS_CONTROL_ALLOW_ORIGIN; +import static io.helidon.http.Http.HeaderNames.ACCESS_CONTROL_MAX_AGE; import static io.helidon.common.testing.http.junit5.HttpHeaderMatcher.hasHeader; import static io.helidon.common.testing.http.junit5.HttpHeaderMatcher.noHeader; import static org.hamcrest.MatcherAssert.assertThat; diff --git a/nima/webserver/cors/src/test/java/io/helidon/nima/webserver/cors/CorsTestServices.java b/webserver/cors/src/test/java/io/helidon/webserver/cors/CorsTestServices.java similarity index 82% rename from nima/webserver/cors/src/test/java/io/helidon/nima/webserver/cors/CorsTestServices.java rename to webserver/cors/src/test/java/io/helidon/webserver/cors/CorsTestServices.java index 61611dde558..f62672deae1 100644 --- a/nima/webserver/cors/src/test/java/io/helidon/nima/webserver/cors/CorsTestServices.java +++ b/webserver/cors/src/test/java/io/helidon/webserver/cors/CorsTestServices.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022 Oracle and/or its affiliates. + * Copyright (c) 2020, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.webserver.cors; +package io.helidon.webserver.cors; import java.util.List; -import io.helidon.common.http.Http; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.Http; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; class CorsTestServices { diff --git a/nima/webserver/cors/src/test/java/io/helidon/nima/webserver/cors/MissingConfigTest.java b/webserver/cors/src/test/java/io/helidon/webserver/cors/MissingConfigTest.java similarity index 98% rename from nima/webserver/cors/src/test/java/io/helidon/nima/webserver/cors/MissingConfigTest.java rename to webserver/cors/src/test/java/io/helidon/webserver/cors/MissingConfigTest.java index e1cf18157c6..1ad8ed2936f 100644 --- a/nima/webserver/cors/src/test/java/io/helidon/nima/webserver/cors/MissingConfigTest.java +++ b/webserver/cors/src/test/java/io/helidon/webserver/cors/MissingConfigTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.webserver.cors; +package io.helidon.webserver.cors; import java.io.ByteArrayOutputStream; import java.util.Optional; diff --git a/nima/webserver/cors/src/test/java/io/helidon/nima/webserver/cors/TestDefaultCorsSupport.java b/webserver/cors/src/test/java/io/helidon/webserver/cors/TestDefaultCorsSupport.java similarity index 89% rename from nima/webserver/cors/src/test/java/io/helidon/nima/webserver/cors/TestDefaultCorsSupport.java rename to webserver/cors/src/test/java/io/helidon/webserver/cors/TestDefaultCorsSupport.java index ed866841bb9..2098b59e90f 100644 --- a/nima/webserver/cors/src/test/java/io/helidon/nima/webserver/cors/TestDefaultCorsSupport.java +++ b/webserver/cors/src/test/java/io/helidon/webserver/cors/TestDefaultCorsSupport.java @@ -13,19 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.webserver.cors; +package io.helidon.webserver.cors; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderNames; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.api.WebClient; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRules; +import io.helidon.http.Headers; +import io.helidon.http.Http; +import io.helidon.http.Http.HeaderNames; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.api.WebClient; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.HttpRules; import org.junit.jupiter.api.Test; -import static io.helidon.common.http.Http.HeaderNames.ACCESS_CONTROL_ALLOW_ORIGIN; +import static io.helidon.http.Http.HeaderNames.ACCESS_CONTROL_ALLOW_ORIGIN; import static io.helidon.common.testing.http.junit5.HttpHeaderMatcher.hasHeader; import static io.helidon.common.testing.http.junit5.HttpHeaderMatcher.noHeader; import static org.hamcrest.MatcherAssert.assertThat; diff --git a/webserver/cors/src/test/java/io/helidon/webserver/cors/TestHandlerRegistration.java b/webserver/cors/src/test/java/io/helidon/webserver/cors/TestHandlerRegistration.java new file mode 100644 index 00000000000..3ac91208e0c --- /dev/null +++ b/webserver/cors/src/test/java/io/helidon/webserver/cors/TestHandlerRegistration.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.webserver.cors; + +import io.helidon.http.Http; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.http1.Http1Client; + +import org.junit.jupiter.api.Test; + +import static io.helidon.http.Http.HeaderNames.ACCESS_CONTROL_ALLOW_HEADERS; +import static io.helidon.http.Http.HeaderNames.ACCESS_CONTROL_ALLOW_METHODS; +import static io.helidon.http.Http.HeaderNames.ACCESS_CONTROL_ALLOW_ORIGIN; +import static io.helidon.http.Http.HeaderNames.ACCESS_CONTROL_REQUEST_HEADERS; +import static io.helidon.http.Http.HeaderNames.ACCESS_CONTROL_REQUEST_METHOD; +import static io.helidon.http.Http.HeaderNames.ORIGIN; +import static io.helidon.common.testing.http.junit5.HttpHeaderMatcher.hasHeader; +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; + +@ServerTest +class TestHandlerRegistration extends CorsRouting { + + static final String CORS4_CONTEXT_ROOT = "/cors4"; + + private final Http1Client client; + + TestHandlerRegistration(Http1Client client) { + this.client = client; + } + + @Test + void test4PreFlightAllowedHeaders2() { + try (HttpClientResponse response = client.method(Http.Method.OPTIONS) + .uri(CORS4_CONTEXT_ROOT) + .header(ORIGIN, "http://foo.bar") + .header(ACCESS_CONTROL_REQUEST_METHOD, "PUT") + .header(ACCESS_CONTROL_REQUEST_HEADERS, "X-foo, X-bar") + .request()) { + + assertThat(response.status(), is(Http.Status.OK_200)); + assertThat(response.headers(), hasHeader(ACCESS_CONTROL_ALLOW_ORIGIN, "http://foo.bar")); + assertThat(response.headers(), hasHeader(ACCESS_CONTROL_ALLOW_METHODS, "PUT")); + assertThat(response.headers(), hasHeader(ACCESS_CONTROL_ALLOW_HEADERS)); + assertThat(response.headers().get(ACCESS_CONTROL_ALLOW_HEADERS).values(), containsString("X-foo")); + assertThat(response.headers().get(ACCESS_CONTROL_ALLOW_HEADERS).values(), containsString("X-bar")); + } + } +} diff --git a/nima/webserver/cors/src/test/java/io/helidon/nima/webserver/cors/TestTwoCorsConfigs.java b/webserver/cors/src/test/java/io/helidon/webserver/cors/TestTwoCorsConfigs.java similarity index 86% rename from nima/webserver/cors/src/test/java/io/helidon/nima/webserver/cors/TestTwoCorsConfigs.java rename to webserver/cors/src/test/java/io/helidon/webserver/cors/TestTwoCorsConfigs.java index 5bec508910b..04fbf8e77c0 100644 --- a/nima/webserver/cors/src/test/java/io/helidon/nima/webserver/cors/TestTwoCorsConfigs.java +++ b/webserver/cors/src/test/java/io/helidon/webserver/cors/TestTwoCorsConfigs.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.nima.webserver.cors; +package io.helidon.webserver.cors; -import io.helidon.common.http.Http; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.http1.Http1Client; +import io.helidon.http.Http; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.http1.Http1Client; import org.junit.jupiter.api.Test; diff --git a/nima/webserver/cors/src/test/java/io/helidon/nima/webserver/cors/TestUtil.java b/webserver/cors/src/test/java/io/helidon/webserver/cors/TestUtil.java similarity index 76% rename from nima/webserver/cors/src/test/java/io/helidon/nima/webserver/cors/TestUtil.java rename to webserver/cors/src/test/java/io/helidon/webserver/cors/TestUtil.java index 1aa975fef0a..2a4554a0be6 100644 --- a/nima/webserver/cors/src/test/java/io/helidon/nima/webserver/cors/TestUtil.java +++ b/webserver/cors/src/test/java/io/helidon/webserver/cors/TestUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022 Oracle and/or its affiliates. + * Copyright (c) 2020, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,27 +13,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.webserver.cors; +package io.helidon.webserver.cors; import java.util.Date; -import io.helidon.common.http.Http; -import io.helidon.nima.webserver.cors.CorsTestServices.CORSTestService; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.Http; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; class TestUtil { static final String GREETING_PATH = "/greet"; static final String OTHER_GREETING_PATH = "/othergreet"; - static String path(CORSTestService testService) { + static String path(CorsTestServices.CORSTestService testService) { return GREETING_PATH + testService.path(); } - static String path(String prefix, CORSTestService testService) { + static String path(String prefix, CorsTestServices.CORSTestService testService) { return prefix + testService.path(); } diff --git a/webserver/cors/src/test/resources/application.yaml b/webserver/cors/src/test/resources/application.yaml new file mode 100644 index 00000000000..76728c2789b --- /dev/null +++ b/webserver/cors/src/test/resources/application.yaml @@ -0,0 +1,34 @@ +# +# Copyright (c) 2020, 2023 Oracle and/or its affiliates. +# +# 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. +# +app: + greeting: "Hello" + +client: + follow-redirects: true + max-redirects: 8 + +cors-setup: + paths: + - path-pattern: /cors1 + allow-origins: [ "*" ] + allow-methods: [ "*" ] + - path-pattern: /cors2 + allow-origins: [ "http://foo.bar", "http://bar.foo" ] + allow-methods: [ "DELETE", "PUT" ] + allow-headers: [ "X-bar", "X-foo" ] + allow-credentials: true + max-age: -1 +# info for /cors3 is added programmatically \ No newline at end of file diff --git a/nima/webserver/cors/src/test/resources/configMapperTest.yaml b/webserver/cors/src/test/resources/configMapperTest.yaml similarity index 95% rename from nima/webserver/cors/src/test/resources/configMapperTest.yaml rename to webserver/cors/src/test/resources/configMapperTest.yaml index 932f94cf897..94522d386d8 100644 --- a/nima/webserver/cors/src/test/resources/configMapperTest.yaml +++ b/webserver/cors/src/test/resources/configMapperTest.yaml @@ -1,5 +1,5 @@ # -# Copyright (c) 2020, 2022 Oracle and/or its affiliates. +# Copyright (c) 2020, 2023 Oracle and/or its affiliates. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/webserver/cors/src/test/resources/logging-test.properties b/webserver/cors/src/test/resources/logging-test.properties new file mode 100644 index 00000000000..d7ad6312c5a --- /dev/null +++ b/webserver/cors/src/test/resources/logging-test.properties @@ -0,0 +1,22 @@ +# +# Copyright (c) 2022, 2023 Oracle and/or its affiliates. +# +# 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. +# +handlers=java.util.logging.ConsoleHandler +java.util.logging.ConsoleHandler.level=FINEST +java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter +# java.util.logging.SimpleFormatter.format = [%1$tc] %5$s %6$s%n +java.util.logging.SimpleFormatter.format=%1$tH:%1$tM:%1$tS %5$s%6$s%n +# Global logging level. Can be overridden by specific loggers +.level=INFO diff --git a/nima/webserver/cors/src/test/resources/twoCORS.yaml b/webserver/cors/src/test/resources/twoCORS.yaml similarity index 94% rename from nima/webserver/cors/src/test/resources/twoCORS.yaml rename to webserver/cors/src/test/resources/twoCORS.yaml index a1472290653..3f13ac9996c 100644 --- a/nima/webserver/cors/src/test/resources/twoCORS.yaml +++ b/webserver/cors/src/test/resources/twoCORS.yaml @@ -1,5 +1,5 @@ # -# Copyright (c) 2020, 2022 Oracle and/or its affiliates. +# Copyright (c) 2020, 2023 Oracle and/or its affiliates. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/webserver/graphql/pom.xml b/webserver/graphql/pom.xml new file mode 100644 index 00000000000..3107de1560d --- /dev/null +++ b/webserver/graphql/pom.xml @@ -0,0 +1,107 @@ + + + + + + io.helidon.webserver + helidon-webserver-project + 4.0.0-SNAPSHOT + + 4.0.0 + + helidon-webserver-graphql + Helidon WebServer GraphQL + + + + io.helidon.graphql + helidon-graphql-server + + + io.helidon.webserver + helidon-webserver + + + io.helidon.webserver + helidon-webserver-cors + + + org.eclipse + yasson + + + io.helidon.common.features + helidon-common-features-api + true + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + org.junit.jupiter + junit-jupiter-params + test + + + io.helidon.config + helidon-config-yaml + test + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 + test + + + io.helidon.webclient + helidon-webclient + test + + + io.helidon.http.media + helidon-http-media-jsonp + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + + + + + diff --git a/nima/graphql/server/src/main/java/io/helidon/nima/graphql/server/GraphQlService.java b/webserver/graphql/src/main/java/io/helidon/webserver/graphql/GraphQlService.java similarity index 96% rename from nima/graphql/server/src/main/java/io/helidon/nima/graphql/server/GraphQlService.java rename to webserver/graphql/src/main/java/io/helidon/webserver/graphql/GraphQlService.java index dc7e12196f5..63443623c20 100644 --- a/nima/graphql/server/src/main/java/io/helidon/nima/graphql/server/GraphQlService.java +++ b/webserver/graphql/src/main/java/io/helidon/webserver/graphql/GraphQlService.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.graphql.server; +package io.helidon.webserver.graphql; import java.util.LinkedHashMap; import java.util.Map; @@ -30,11 +30,11 @@ import io.helidon.cors.CrossOriginConfig; import io.helidon.graphql.server.GraphQlConstants; import io.helidon.graphql.server.InvocationHandler; -import io.helidon.nima.webserver.cors.CorsEnabledServiceHelper; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.cors.CorsEnabledServiceHelper; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import graphql.schema.GraphQLSchema; import jakarta.json.bind.Jsonb; @@ -74,8 +74,8 @@ private GraphQlService(Builder builder) { * Create GraphQL support for a GraphQL schema. * * @param schema schema to use for GraphQL - * @return a new support to register with {@link io.helidon.nima.webserver.WebServer} - * {@link io.helidon.nima.webserver.http.HttpRouting} + * @return a new support to register with {@link io.helidon.webserver.WebServer} + * {@link io.helidon.webserver.http.HttpRouting} */ public static GraphQlService create(GraphQLSchema schema) { return builder() diff --git a/webserver/graphql/src/main/java/io/helidon/webserver/graphql/package-info.java b/webserver/graphql/src/main/java/io/helidon/webserver/graphql/package-info.java new file mode 100644 index 00000000000..bb06d75a535 --- /dev/null +++ b/webserver/graphql/src/main/java/io/helidon/webserver/graphql/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebServer GraphQL Support. + */ +package io.helidon.webserver.graphql; diff --git a/webserver/graphql/src/main/java/module-info.java b/webserver/graphql/src/main/java/module-info.java new file mode 100644 index 00000000000..a739316484b --- /dev/null +++ b/webserver/graphql/src/main/java/module-info.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.common.features.api.Feature; +import io.helidon.common.features.api.HelidonFlavor; +import io.helidon.common.features.api.Preview; + + +/** + * Helidon WebServer GraphQL Support. + */ +@Preview +@Feature(value = "GraphQL", + description = "WebServer GraphQL support", + in = HelidonFlavor.SE, + invalidIn = HelidonFlavor.MP +) +module io.helidon.webserver.graphql { + requires static io.helidon.common.features.api; + + requires java.logging; + requires io.helidon.common; + requires io.helidon.common.uri; + requires io.helidon.common.configurable; + requires io.helidon.config; + requires io.helidon.cors; + requires io.helidon.webserver.cors; + requires io.helidon.graphql.server; + requires io.helidon.webserver; + requires org.eclipse.yasson; + requires jakarta.json.bind; + + exports io.helidon.webserver.graphql; +} \ No newline at end of file diff --git a/nima/graphql/server/src/test/java/io/helidon/nima/graphql/server/GraphQlServiceTest.java b/webserver/graphql/src/test/java/io/helidon/webserver/graphql/GraphQlServiceTest.java similarity index 89% rename from nima/graphql/server/src/test/java/io/helidon/nima/graphql/server/GraphQlServiceTest.java rename to webserver/graphql/src/test/java/io/helidon/webserver/graphql/GraphQlServiceTest.java index 6ffb1f80b34..c7631917460 100644 --- a/nima/graphql/server/src/test/java/io/helidon/nima/graphql/server/GraphQlServiceTest.java +++ b/webserver/graphql/src/test/java/io/helidon/webserver/graphql/GraphQlServiceTest.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.nima.graphql.server; +package io.helidon.webserver.graphql; -import io.helidon.common.http.Http; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.http.Http; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.http.HttpRouting; import graphql.schema.GraphQLSchema; import graphql.schema.StaticDataFetcher; diff --git a/webserver/grpc/pom.xml b/webserver/grpc/pom.xml new file mode 100644 index 00000000000..352d8e31d6f --- /dev/null +++ b/webserver/grpc/pom.xml @@ -0,0 +1,138 @@ + + + + 4.0.0 + + io.helidon.webserver + helidon-webserver-project + 4.0.0-SNAPSHOT + + + helidon-webserver-grpc + Helidon WebServer gRPC + + + + + javax.annotation + javax.annotation-api + 1.3.2 + true + + + io.helidon.webserver + helidon-webserver + + + io.helidon.webserver + helidon-webserver-http2 + + + io.grpc + grpc-core + + + io.grpc + grpc-stub + + + io.grpc + grpc-protobuf + + + io.helidon.common.features + helidon-common-features-api + true + + + io.helidon.config + helidon-config-metadata + true + + + io.helidon.builder + helidon-builder-api + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + io.helidon.config + helidon-config-metadata-processor + ${helidon.version} + + + io.helidon.builder + helidon-builder-processor + ${helidon.version} + + + io.helidon.common.processor + helidon-common-processor-helidon-copyright + ${helidon.version} + + + + + + io.helidon.builder + helidon-builder-processor + ${helidon.version} + + + io.helidon.config + helidon-config-metadata-processor + ${helidon.version} + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + io.helidon.common.processor + helidon-common-processor-helidon-copyright + ${helidon.version} + + + + + + diff --git a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/CollectingObserver.java b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/CollectingObserver.java similarity index 97% rename from nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/CollectingObserver.java rename to webserver/grpc/src/main/java/io/helidon/webserver/grpc/CollectingObserver.java index 05e854ca711..da99a666c5f 100644 --- a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/CollectingObserver.java +++ b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/CollectingObserver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.grpc.webserver; +package io.helidon.webserver.grpc; import java.util.Objects; import java.util.Optional; diff --git a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/Grpc.java b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/Grpc.java similarity index 94% rename from nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/Grpc.java rename to webserver/grpc/src/main/java/io/helidon/webserver/grpc/Grpc.java index 27454e9ab49..0dcc498eaea 100644 --- a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/Grpc.java +++ b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/Grpc.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.helidon.nima.grpc.webserver; +package io.helidon.webserver.grpc; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.PathMatcher; -import io.helidon.common.http.PathMatchers; +import io.helidon.http.HttpPrologue; +import io.helidon.http.PathMatcher; +import io.helidon.http.PathMatchers; import com.google.protobuf.DescriptorProtos; import com.google.protobuf.Descriptors; @@ -79,7 +79,7 @@ static Grpc clientStream(Descriptors.FileDescriptor pro } /** - * Create a {@link io.helidon.nima.grpc.webserver.Grpc gRPC route} from a {@link io.grpc.ServerMethodDefinition}. + * Create a {@link io.helidon.webserver.grpc.Grpc gRPC route} from a {@link io.grpc.ServerMethodDefinition}. * * @param definition the {@link io.grpc.ServerMethodDefinition} representing the method to execute * @param proto an optional protocol buffer {@link com.google.protobuf.Descriptors.FileDescriptor} @@ -87,7 +87,7 @@ static Grpc clientStream(Descriptors.FileDescriptor pro * @param the request type * @param the response type * - * @return a {@link io.helidon.nima.grpc.webserver.Grpc gRPC route} created + * @return a {@link io.helidon.webserver.grpc.Grpc gRPC route} created * from the {@link io.grpc.ServerMethodDefinition} */ static Grpc methodDefinition(ServerMethodDefinition definition, @@ -151,7 +151,7 @@ private static Grpc grpc(Descriptors.FileDescriptor pro /** - * Create a {@link io.helidon.nima.grpc.webserver.Grpc gRPC route} from a {@link io.grpc.MethodDescriptor}. + * Create a {@link io.helidon.webserver.grpc.Grpc gRPC route} from a {@link io.grpc.MethodDescriptor}. * * @param grpcDesc the {@link io.grpc.MethodDescriptor} describing the method to execute * @param callHandler the {@link io.grpc.ServerCallHandler} that will execute the method @@ -160,7 +160,7 @@ private static Grpc grpc(Descriptors.FileDescriptor pro * @param the request type * @param the response type * - * @return a {@link io.helidon.nima.grpc.webserver.Grpc gRPC route} created + * @return a {@link io.helidon.webserver.grpc.Grpc gRPC route} created * from the {@link io.grpc.ServerMethodDefinition} */ private static Grpc grpc(MethodDescriptor grpcDesc, diff --git a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcConfigBlueprint.java b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcConfigBlueprint.java similarity index 91% rename from nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcConfigBlueprint.java rename to webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcConfigBlueprint.java index 0b4398d1a95..f05ffefdfc3 100644 --- a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcConfigBlueprint.java +++ b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcConfigBlueprint.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.helidon.nima.grpc.webserver; +package io.helidon.webserver.grpc; import io.helidon.builder.api.Prototype; import io.helidon.config.metadata.Configured; -import io.helidon.nima.webserver.spi.ProtocolConfig; +import io.helidon.webserver.spi.ProtocolConfig; @Prototype.Blueprint @Configured(provides = ProtocolConfig.class) diff --git a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcProtocolConfigProvider.java b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcProtocolConfigProvider.java similarity index 91% rename from nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcProtocolConfigProvider.java rename to webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcProtocolConfigProvider.java index 3ae38bc9e03..0f61a0220d6 100644 --- a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcProtocolConfigProvider.java +++ b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcProtocolConfigProvider.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.helidon.nima.grpc.webserver; +package io.helidon.webserver.grpc; import io.helidon.common.config.Config; -import io.helidon.nima.webserver.spi.ProtocolConfigProvider; +import io.helidon.webserver.spi.ProtocolConfigProvider; /** * Implementation of a service provider interface to create grpc protocol configuration. diff --git a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcProtocolHandler.java b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcProtocolHandler.java similarity index 91% rename from nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcProtocolHandler.java rename to webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcProtocolHandler.java index d00990f087f..88675304d1d 100644 --- a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcProtocolHandler.java +++ b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcProtocolHandler.java @@ -14,30 +14,30 @@ * limitations under the License. */ -package io.helidon.nima.grpc.webserver; +package io.helidon.webserver.grpc; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import io.helidon.common.buffers.BufferData; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.Header; -import io.helidon.common.http.Http.HeaderNames; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.WritableHeaders; -import io.helidon.nima.http2.Http2Flag; -import io.helidon.nima.http2.Http2FrameData; -import io.helidon.nima.http2.Http2FrameHeader; -import io.helidon.nima.http2.Http2FrameTypes; -import io.helidon.nima.http2.Http2Headers; -import io.helidon.nima.http2.Http2RstStream; -import io.helidon.nima.http2.Http2Settings; -import io.helidon.nima.http2.Http2StreamState; -import io.helidon.nima.http2.Http2StreamWriter; -import io.helidon.nima.http2.Http2WindowUpdate; -import io.helidon.nima.http2.StreamFlowControl; -import io.helidon.nima.http2.webserver.spi.Http2SubProtocolSelector; +import io.helidon.http.Http; +import io.helidon.http.Http.Header; +import io.helidon.http.Http.HeaderNames; +import io.helidon.http.HttpPrologue; +import io.helidon.http.WritableHeaders; +import io.helidon.http.http2.Http2Flag; +import io.helidon.http.http2.Http2FrameData; +import io.helidon.http.http2.Http2FrameHeader; +import io.helidon.http.http2.Http2FrameTypes; +import io.helidon.http.http2.Http2Headers; +import io.helidon.http.http2.Http2RstStream; +import io.helidon.http.http2.Http2Settings; +import io.helidon.http.http2.Http2StreamState; +import io.helidon.http.http2.Http2StreamWriter; +import io.helidon.http.http2.Http2WindowUpdate; +import io.helidon.http.http2.StreamFlowControl; +import io.helidon.webserver.http2.spi.Http2SubProtocolSelector; import io.grpc.Metadata; import io.grpc.MethodDescriptor; diff --git a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcProtocolHandlerNotFound.java b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcProtocolHandlerNotFound.java similarity index 80% rename from nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcProtocolHandlerNotFound.java rename to webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcProtocolHandlerNotFound.java index 19e49811926..316131404a2 100644 --- a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcProtocolHandlerNotFound.java +++ b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcProtocolHandlerNotFound.java @@ -14,19 +14,19 @@ * limitations under the License. */ -package io.helidon.nima.grpc.webserver; +package io.helidon.webserver.grpc; import io.helidon.common.buffers.BufferData; -import io.helidon.common.http.WritableHeaders; -import io.helidon.nima.http2.FlowControl; -import io.helidon.nima.http2.Http2Flag; -import io.helidon.nima.http2.Http2FrameHeader; -import io.helidon.nima.http2.Http2Headers; -import io.helidon.nima.http2.Http2RstStream; -import io.helidon.nima.http2.Http2StreamState; -import io.helidon.nima.http2.Http2StreamWriter; -import io.helidon.nima.http2.Http2WindowUpdate; -import io.helidon.nima.http2.webserver.spi.Http2SubProtocolSelector; +import io.helidon.http.WritableHeaders; +import io.helidon.http.http2.FlowControl; +import io.helidon.http.http2.Http2Flag; +import io.helidon.http.http2.Http2FrameHeader; +import io.helidon.http.http2.Http2Headers; +import io.helidon.http.http2.Http2RstStream; +import io.helidon.http.http2.Http2StreamState; +import io.helidon.http.http2.Http2StreamWriter; +import io.helidon.http.http2.Http2WindowUpdate; +import io.helidon.webserver.http2.spi.Http2SubProtocolSelector; class GrpcProtocolHandlerNotFound implements Http2SubProtocolSelector.SubProtocolHandler { private final Http2StreamWriter streamWriter; diff --git a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcProtocolProvider.java b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcProtocolProvider.java similarity index 86% rename from nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcProtocolProvider.java rename to webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcProtocolProvider.java index 3eef71e9af1..ae6bdabae3f 100644 --- a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcProtocolProvider.java +++ b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcProtocolProvider.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.helidon.nima.grpc.webserver; +package io.helidon.webserver.grpc; -import io.helidon.nima.http2.webserver.spi.Http2SubProtocolProvider; -import io.helidon.nima.http2.webserver.spi.Http2SubProtocolSelector; -import io.helidon.nima.webserver.ProtocolConfigs; +import io.helidon.webserver.ProtocolConfigs; +import io.helidon.webserver.http2.spi.Http2SubProtocolProvider; +import io.helidon.webserver.http2.spi.Http2SubProtocolSelector; /** * {@link java.util.ServiceLoader} provider implementation of grpc sub-protocol of HTTP/2. diff --git a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcProtocolSelector.java b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcProtocolSelector.java similarity index 84% rename from nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcProtocolSelector.java rename to webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcProtocolSelector.java index 8af19d6d035..7f7dd6514ff 100644 --- a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcProtocolSelector.java +++ b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcProtocolSelector.java @@ -14,20 +14,20 @@ * limitations under the License. */ -package io.helidon.nima.grpc.webserver; +package io.helidon.webserver.grpc; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpPrologue; -import io.helidon.nima.http2.Http2Headers; -import io.helidon.nima.http2.Http2Settings; -import io.helidon.nima.http2.Http2StreamState; -import io.helidon.nima.http2.Http2StreamWriter; -import io.helidon.nima.http2.StreamFlowControl; -import io.helidon.nima.http2.webserver.spi.Http2SubProtocolSelector; -import io.helidon.nima.http2.webserver.spi.SubProtocolResult; -import io.helidon.nima.webserver.ConnectionContext; -import io.helidon.nima.webserver.Router; +import io.helidon.http.Headers; +import io.helidon.http.Http; +import io.helidon.http.HttpPrologue; +import io.helidon.http.http2.Http2Headers; +import io.helidon.http.http2.Http2Settings; +import io.helidon.http.http2.Http2StreamState; +import io.helidon.http.http2.Http2StreamWriter; +import io.helidon.http.http2.StreamFlowControl; +import io.helidon.webserver.ConnectionContext; +import io.helidon.webserver.Router; +import io.helidon.webserver.http2.spi.Http2SubProtocolSelector; +import io.helidon.webserver.http2.spi.SubProtocolResult; /** * Sub-protocol selector for HTTP/2. diff --git a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcRoute.java b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcRoute.java similarity index 77% rename from nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcRoute.java rename to webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcRoute.java index 8f4460c92d3..0230feb6753 100644 --- a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcRoute.java +++ b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcRoute.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.helidon.nima.grpc.webserver; +package io.helidon.webserver.grpc; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.PathMatchers; -import io.helidon.nima.webserver.Route; +import io.helidon.http.HttpPrologue; +import io.helidon.http.PathMatchers; +import io.helidon.webserver.Route; abstract class GrpcRoute implements Route { abstract Grpc toGrpc(HttpPrologue grpcPrologue); diff --git a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcRouting.java b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcRouting.java similarity index 97% rename from nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcRouting.java rename to webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcRouting.java index 865729ea36a..ee42c284e4c 100644 --- a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcRouting.java +++ b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcRouting.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package io.helidon.nima.grpc.webserver; +package io.helidon.webserver.grpc; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.PathMatchers; -import io.helidon.nima.webserver.Routing; +import io.helidon.http.HttpPrologue; +import io.helidon.http.PathMatchers; +import io.helidon.webserver.Routing; import com.google.protobuf.Descriptors; import io.grpc.BindableService; diff --git a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcService.java b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcService.java similarity index 96% rename from nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcService.java rename to webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcService.java index 49f43f30548..59581ae076b 100644 --- a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcService.java +++ b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcService.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.grpc.webserver; +package io.helidon.webserver.grpc; import com.google.protobuf.Descriptors; import io.grpc.stub.ServerCalls; diff --git a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcServiceRoute.java b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcServiceRoute.java similarity index 95% rename from nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcServiceRoute.java rename to webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcServiceRoute.java index a7caaaf1dc3..f90927009fd 100644 --- a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcServiceRoute.java +++ b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcServiceRoute.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.helidon.nima.grpc.webserver; +package io.helidon.webserver.grpc; import java.util.LinkedList; import java.util.List; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.PathMatchers; +import io.helidon.http.HttpPrologue; +import io.helidon.http.PathMatchers; import com.google.protobuf.Descriptors; import io.grpc.stub.ServerCalls; diff --git a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcStatus.java b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcStatus.java similarity index 97% rename from nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcStatus.java rename to webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcStatus.java index c5c6f17ae0b..cd8681a5bcb 100644 --- a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/GrpcStatus.java +++ b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/GrpcStatus.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.nima.grpc.webserver; +package io.helidon.webserver.grpc; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.Header; -import io.helidon.common.http.Http.HeaderName; -import io.helidon.common.http.Http.HeaderNames; +import io.helidon.http.Http; +import io.helidon.http.Http.Header; +import io.helidon.http.Http.HeaderName; +import io.helidon.http.Http.HeaderNames; import io.grpc.Status; diff --git a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/ProtoMarshaller.java b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/ProtoMarshaller.java similarity index 95% rename from nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/ProtoMarshaller.java rename to webserver/grpc/src/main/java/io/helidon/webserver/grpc/ProtoMarshaller.java index 8db9f3c160c..a3733e82db6 100644 --- a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/ProtoMarshaller.java +++ b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/ProtoMarshaller.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.grpc.webserver; +package io.helidon.webserver.grpc; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; diff --git a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/ResponseHelper.java b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/ResponseHelper.java similarity index 99% rename from nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/ResponseHelper.java rename to webserver/grpc/src/main/java/io/helidon/webserver/grpc/ResponseHelper.java index 74502534467..f555589c705 100644 --- a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/ResponseHelper.java +++ b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/ResponseHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022 Oracle and/or its affiliates. + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.grpc.webserver; +package io.helidon.webserver.grpc; import java.util.concurrent.Callable; import java.util.concurrent.CompletableFuture; diff --git a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/SafeStreamObserver.java b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/SafeStreamObserver.java similarity index 98% rename from nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/SafeStreamObserver.java rename to webserver/grpc/src/main/java/io/helidon/webserver/grpc/SafeStreamObserver.java index 897be4aa1ce..c7e1a51934c 100644 --- a/nima/grpc/webserver/src/main/java/io/helidon/nima/grpc/webserver/SafeStreamObserver.java +++ b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/SafeStreamObserver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022 Oracle and/or its affiliates. + * Copyright (c) 2019, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.grpc.webserver; +package io.helidon.webserver.grpc; import io.grpc.Status; import io.grpc.stub.StreamObserver; diff --git a/webserver/grpc/src/main/java/io/helidon/webserver/grpc/package-info.java b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/package-info.java new file mode 100644 index 00000000000..7edbacef20f --- /dev/null +++ b/webserver/grpc/src/main/java/io/helidon/webserver/grpc/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebServer gRPC Support. + */ +package io.helidon.webserver.grpc; diff --git a/webserver/grpc/src/main/java/module-info.java b/webserver/grpc/src/main/java/module-info.java new file mode 100644 index 00000000000..ca84e53810a --- /dev/null +++ b/webserver/grpc/src/main/java/module-info.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.common.features.api.Feature; +import io.helidon.common.features.api.HelidonFlavor; +import io.helidon.common.features.api.Preview; +import io.helidon.webserver.http2.spi.Http2SubProtocolProvider; +import io.helidon.webserver.grpc.GrpcProtocolConfigProvider; +import io.helidon.webserver.grpc.GrpcProtocolProvider; +import io.helidon.webserver.spi.ProtocolConfigProvider; + +/** + * Helidon WebServer gRPC Support. + */ +@Preview +@Feature(value = "GRPC", + description = "WebServer gRPC Support", + in = HelidonFlavor.SE, + path = {"WebServer", "GRPC"} +) +module io.helidon.webserver.grpc { + requires static io.helidon.common.features.api; + requires static io.helidon.config.metadata; + + requires java.logging; + + requires io.helidon.builder.api; + requires io.helidon.webserver.http2; + + requires transitive grpc.stub; + requires transitive com.google.protobuf; + requires transitive grpc.api; + requires grpc.protobuf.lite; + + exports io.helidon.webserver.grpc; + + provides Http2SubProtocolProvider + with GrpcProtocolProvider; + provides ProtocolConfigProvider + with GrpcProtocolConfigProvider; +} diff --git a/nima/http2/webserver/README.md b/webserver/http2/README.md similarity index 100% rename from nima/http2/webserver/README.md rename to webserver/http2/README.md diff --git a/webserver/http2/etc/spotbugs/exclude.xml b/webserver/http2/etc/spotbugs/exclude.xml new file mode 100644 index 00000000000..88d0fdc052a --- /dev/null +++ b/webserver/http2/etc/spotbugs/exclude.xml @@ -0,0 +1,29 @@ + + + + + + + + + + diff --git a/webserver/http2/pom.xml b/webserver/http2/pom.xml new file mode 100644 index 00000000000..4a55caa0894 --- /dev/null +++ b/webserver/http2/pom.xml @@ -0,0 +1,133 @@ + + + + 4.0.0 + + io.helidon.webserver + helidon-webserver-project + 4.0.0-SNAPSHOT + + + helidon-webserver-http2 + Helidon WebServer HTTP/2 + + + etc/spotbugs/exclude.xml + + + + + io.helidon.webserver + helidon-webserver + + + io.helidon.http + helidon-http-http2 + + + io.helidon.builder + helidon-builder-api + + + io.helidon.common.features + helidon-common-features-api + true + + + io.helidon.config + helidon-config-metadata + true + + + io.helidon.config + helidon-config-yaml + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + org.mockito + mockito-core + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + io.helidon.builder + helidon-builder-processor + ${helidon.version} + + + io.helidon.config + helidon-config-metadata-processor + ${helidon.version} + + + io.helidon.common.processor + helidon-common-processor-helidon-copyright + ${helidon.version} + + + + + + io.helidon.builder + helidon-builder-processor + ${helidon.version} + + + io.helidon.config + helidon-config-metadata-processor + ${helidon.version} + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + io.helidon.common.processor + helidon-common-processor-helidon-copyright + ${helidon.version} + + + + + + diff --git a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2ConfigBlueprint.java b/webserver/http2/src/main/java/io/helidon/webserver/http2/Http2ConfigBlueprint.java similarity index 97% rename from nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2ConfigBlueprint.java rename to webserver/http2/src/main/java/io/helidon/webserver/http2/Http2ConfigBlueprint.java index cfe6e129a81..4f8693a2bec 100644 --- a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2ConfigBlueprint.java +++ b/webserver/http2/src/main/java/io/helidon/webserver/http2/Http2ConfigBlueprint.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package io.helidon.nima.http2.webserver; +package io.helidon.webserver.http2; import java.time.Duration; import io.helidon.builder.api.Prototype; -import io.helidon.common.http.RequestedUriDiscoveryContext; import io.helidon.config.metadata.Configured; import io.helidon.config.metadata.ConfiguredOption; -import io.helidon.nima.webserver.spi.ProtocolConfig; +import io.helidon.http.RequestedUriDiscoveryContext; +import io.helidon.webserver.spi.ProtocolConfig; /** * HTTP/2 server configuration. diff --git a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2Connection.java b/webserver/http2/src/main/java/io/helidon/webserver/http2/Http2Connection.java old mode 100755 new mode 100644 similarity index 93% rename from nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2Connection.java rename to webserver/http2/src/main/java/io/helidon/webserver/http2/Http2Connection.java index 629f26c0a04..3a1525a707e --- a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2Connection.java +++ b/webserver/http2/src/main/java/io/helidon/webserver/http2/Http2Connection.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2.webserver; +package io.helidon.webserver.http2; import java.io.UncheckedIOException; import java.net.SocketException; @@ -28,40 +28,40 @@ import io.helidon.common.buffers.BufferData; import io.helidon.common.buffers.DataReader; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderNames; -import io.helidon.common.http.HttpPrologue; import io.helidon.common.task.InterruptableTask; -import io.helidon.nima.http2.ConnectionFlowControl; -import io.helidon.nima.http2.Http2ConnectionWriter; -import io.helidon.nima.http2.Http2ErrorCode; -import io.helidon.nima.http2.Http2Exception; -import io.helidon.nima.http2.Http2Flag; -import io.helidon.nima.http2.Http2FrameData; -import io.helidon.nima.http2.Http2FrameHeader; -import io.helidon.nima.http2.Http2FrameListener; -import io.helidon.nima.http2.Http2FrameType; -import io.helidon.nima.http2.Http2FrameTypes; -import io.helidon.nima.http2.Http2GoAway; -import io.helidon.nima.http2.Http2Headers; -import io.helidon.nima.http2.Http2HuffmanDecoder; -import io.helidon.nima.http2.Http2LoggingFrameListener; -import io.helidon.nima.http2.Http2Ping; -import io.helidon.nima.http2.Http2Priority; -import io.helidon.nima.http2.Http2RstStream; -import io.helidon.nima.http2.Http2Setting; -import io.helidon.nima.http2.Http2Settings; -import io.helidon.nima.http2.Http2StreamState; -import io.helidon.nima.http2.Http2Util; -import io.helidon.nima.http2.Http2WindowUpdate; -import io.helidon.nima.http2.WindowSize; -import io.helidon.nima.http2.webserver.spi.Http2SubProtocolSelector; -import io.helidon.nima.webserver.CloseConnectionException; -import io.helidon.nima.webserver.ConnectionContext; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.spi.ServerConnection; - -import static io.helidon.nima.http2.Http2Util.PREFACE_LENGTH; +import io.helidon.http.Http; +import io.helidon.http.Http.HeaderNames; +import io.helidon.http.HttpPrologue; +import io.helidon.http.http2.ConnectionFlowControl; +import io.helidon.http.http2.Http2ConnectionWriter; +import io.helidon.http.http2.Http2ErrorCode; +import io.helidon.http.http2.Http2Exception; +import io.helidon.http.http2.Http2Flag; +import io.helidon.http.http2.Http2FrameData; +import io.helidon.http.http2.Http2FrameHeader; +import io.helidon.http.http2.Http2FrameListener; +import io.helidon.http.http2.Http2FrameType; +import io.helidon.http.http2.Http2FrameTypes; +import io.helidon.http.http2.Http2GoAway; +import io.helidon.http.http2.Http2Headers; +import io.helidon.http.http2.Http2HuffmanDecoder; +import io.helidon.http.http2.Http2LoggingFrameListener; +import io.helidon.http.http2.Http2Ping; +import io.helidon.http.http2.Http2Priority; +import io.helidon.http.http2.Http2RstStream; +import io.helidon.http.http2.Http2Setting; +import io.helidon.http.http2.Http2Settings; +import io.helidon.http.http2.Http2StreamState; +import io.helidon.http.http2.Http2Util; +import io.helidon.http.http2.Http2WindowUpdate; +import io.helidon.http.http2.WindowSize; +import io.helidon.webserver.CloseConnectionException; +import io.helidon.webserver.ConnectionContext; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.http2.spi.Http2SubProtocolSelector; +import io.helidon.webserver.spi.ServerConnection; + +import static io.helidon.http.http2.Http2Util.PREFACE_LENGTH; import static java.lang.System.Logger.Level.DEBUG; import static java.lang.System.Logger.Level.TRACE; @@ -514,11 +514,11 @@ private void ackSettings() { if (upgradeHeaders != null) { // initial request from outside - io.helidon.common.http.Headers httpHeaders = upgradeHeaders.httpHeaders(); + io.helidon.http.Headers httpHeaders = upgradeHeaders.httpHeaders(); boolean hasEntity = httpHeaders.contains(HeaderNames.CONTENT_LENGTH) || httpHeaders.contains(Http.Headers.TRANSFER_ENCODING_CHUNKED); // we now have all information needed to execute - Http2Stream stream = stream(1).stream(); + Http2ServerStream stream = stream(1).stream(); stream.prologue(upgradePrologue); stream.headers(upgradeHeaders, !hasEntity); upgradeHeaders = null; @@ -587,7 +587,7 @@ private void doHeaders(Semaphore requestSemaphore) { // we are sure this is the last frame of headers boolean endOfStream; Http2Headers headers; - Http2Stream stream = streamContext.stream(); + Http2ServerStream stream = streamContext.stream(); if (frameHeader.type() == Http2FrameType.CONTINUATION) { // end of continuations with header frames @@ -758,15 +758,15 @@ private StreamContext stream(int streamId) { streamContext = new StreamContext(streamId, http2Config.maxHeaderListSize(), - new Http2Stream(ctx, - routing, - http2Config, - subProviders, - streamId, - serverSettings, - clientSettings, - connectionWriter, - flowControl)); + new Http2ServerStream(ctx, + routing, + http2Config, + subProviders, + streamId, + serverSettings, + clientSettings, + connectionWriter, + flowControl)); streams.put(streamId, streamContext); } // any request for a specific stream is now considered a valid update of connection (ignoring management messages @@ -813,7 +813,7 @@ private enum State { } private record StreamRunnable(Map streams, - Http2Stream stream, + Http2ServerStream stream, Thread handlerThread) implements Runnable { @Override @@ -839,18 +839,18 @@ private static class StreamContext { private final List continuationData = new ArrayList<>(); private final long maxHeaderListSize; private final int streamId; - private final Http2Stream stream; + private final Http2ServerStream stream; private long headerListSize = 0; private Http2FrameHeader continuationHeader; - StreamContext(int streamId, long maxHeaderListSize, Http2Stream stream) { + StreamContext(int streamId, long maxHeaderListSize, Http2ServerStream stream) { this.streamId = streamId; this.maxHeaderListSize = maxHeaderListSize; this.stream = stream; } - public Http2Stream stream() { + public Http2ServerStream stream() { return stream; } diff --git a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2ConnectionProvider.java b/webserver/http2/src/main/java/io/helidon/webserver/http2/Http2ConnectionProvider.java similarity index 81% rename from nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2ConnectionProvider.java rename to webserver/http2/src/main/java/io/helidon/webserver/http2/Http2ConnectionProvider.java index e995d98244c..26f057d6e23 100644 --- a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2ConnectionProvider.java +++ b/webserver/http2/src/main/java/io/helidon/webserver/http2/Http2ConnectionProvider.java @@ -14,22 +14,22 @@ * limitations under the License. */ -package io.helidon.nima.http2.webserver; +package io.helidon.webserver.http2; import java.util.ArrayList; import java.util.List; import java.util.ServiceLoader; import io.helidon.common.HelidonServiceLoader; -import io.helidon.nima.http2.webserver.spi.Http2SubProtocolProvider; -import io.helidon.nima.http2.webserver.spi.Http2SubProtocolSelector; -import io.helidon.nima.webserver.ProtocolConfigs; -import io.helidon.nima.webserver.spi.ProtocolConfig; -import io.helidon.nima.webserver.spi.ServerConnectionSelector; -import io.helidon.nima.webserver.spi.ServerConnectionSelectorProvider; +import io.helidon.webserver.ProtocolConfigs; +import io.helidon.webserver.http2.spi.Http2SubProtocolProvider; +import io.helidon.webserver.http2.spi.Http2SubProtocolSelector; +import io.helidon.webserver.spi.ProtocolConfig; +import io.helidon.webserver.spi.ServerConnectionSelector; +import io.helidon.webserver.spi.ServerConnectionSelectorProvider; /** - * {@link io.helidon.nima.webserver.spi.ServerConnectionSelectorProvider} implementation for HTTP/2 server connection provider. + * {@link io.helidon.webserver.spi.ServerConnectionSelectorProvider} implementation for HTTP/2 server connection provider. */ public class Http2ConnectionProvider implements ServerConnectionSelectorProvider { /** diff --git a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2ConnectionSelector.java b/webserver/http2/src/main/java/io/helidon/webserver/http2/Http2ConnectionSelector.java similarity index 90% rename from nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2ConnectionSelector.java rename to webserver/http2/src/main/java/io/helidon/webserver/http2/Http2ConnectionSelector.java index e0a1c9850da..a7f93c47469 100644 --- a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2ConnectionSelector.java +++ b/webserver/http2/src/main/java/io/helidon/webserver/http2/Http2ConnectionSelector.java @@ -14,20 +14,20 @@ * limitations under the License. */ -package io.helidon.nima.http2.webserver; +package io.helidon.webserver.http2; import java.util.ArrayList; import java.util.List; import java.util.Set; import io.helidon.common.buffers.BufferData; -import io.helidon.nima.http2.webserver.spi.Http2SubProtocolSelector; -import io.helidon.nima.webserver.ConnectionContext; -import io.helidon.nima.webserver.spi.ServerConnection; -import io.helidon.nima.webserver.spi.ServerConnectionSelector; +import io.helidon.webserver.ConnectionContext; +import io.helidon.webserver.http2.spi.Http2SubProtocolSelector; +import io.helidon.webserver.spi.ServerConnection; +import io.helidon.webserver.spi.ServerConnectionSelector; -import static io.helidon.nima.http2.Http2Util.PREFACE_LENGTH; -import static io.helidon.nima.http2.Http2Util.isPreface; +import static io.helidon.http.http2.Http2Util.PREFACE_LENGTH; +import static io.helidon.http.http2.Http2Util.isPreface; /** * HTTP/2 server connection selector. diff --git a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2ProtocolConfigProvider.java b/webserver/http2/src/main/java/io/helidon/webserver/http2/Http2ProtocolConfigProvider.java similarity index 92% rename from nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2ProtocolConfigProvider.java rename to webserver/http2/src/main/java/io/helidon/webserver/http2/Http2ProtocolConfigProvider.java index b8233352b01..bb61a8393d7 100644 --- a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2ProtocolConfigProvider.java +++ b/webserver/http2/src/main/java/io/helidon/webserver/http2/Http2ProtocolConfigProvider.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.helidon.nima.http2.webserver; +package io.helidon.webserver.http2; import io.helidon.common.config.Config; -import io.helidon.nima.webserver.spi.ProtocolConfigProvider; +import io.helidon.webserver.spi.ProtocolConfigProvider; /** * Implementation of a service provider interface to create HTTP/2 protocol configuration. diff --git a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2Route.java b/webserver/http2/src/main/java/io/helidon/webserver/http2/Http2Route.java similarity index 81% rename from nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2Route.java rename to webserver/http2/src/main/java/io/helidon/webserver/http2/Http2Route.java index 6c6edf428d5..1ce0d21a7b2 100644 --- a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2Route.java +++ b/webserver/http2/src/main/java/io/helidon/webserver/http2/Http2Route.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,21 +14,21 @@ * limitations under the License. */ -package io.helidon.nima.http2.webserver; +package io.helidon.webserver.http2; import java.util.function.Predicate; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.PathMatcher; -import io.helidon.common.http.PathMatchers; -import io.helidon.nima.webserver.http.Handler; -import io.helidon.nima.webserver.http.HttpRoute; +import io.helidon.http.Http; +import io.helidon.http.HttpPrologue; +import io.helidon.http.PathMatcher; +import io.helidon.http.PathMatchers; +import io.helidon.webserver.http.Handler; +import io.helidon.webserver.http.HttpRoute; /** * A route for HTTP/2 only. - * To create a route valid for any version of HTTP, please use {@link io.helidon.nima.webserver.http.HttpRoute} or methods - * defined on {@link io.helidon.nima.webserver.http.HttpRouting.Builder}. + * To create a route valid for any version of HTTP, please use {@link io.helidon.webserver.http.HttpRoute} or methods + * defined on {@link io.helidon.webserver.http.HttpRouting.Builder}. */ public class Http2Route implements HttpRoute { private final Predicate methodPredicate; diff --git a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2ServerRequest.java b/webserver/http2/src/main/java/io/helidon/webserver/http2/Http2ServerRequest.java similarity index 91% rename from nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2ServerRequest.java rename to webserver/http2/src/main/java/io/helidon/webserver/http2/Http2ServerRequest.java index c3ef1712a50..a6cf4a232c5 100644 --- a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2ServerRequest.java +++ b/webserver/http2/src/main/java/io/helidon/webserver/http2/Http2ServerRequest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2.webserver; +package io.helidon.webserver.http2; import java.util.function.Supplier; @@ -22,21 +22,21 @@ import io.helidon.common.buffers.BufferData; import io.helidon.common.context.Context; import io.helidon.common.context.Contexts; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.RoutedPath; -import io.helidon.common.http.ServerRequestHeaders; -import io.helidon.common.http.WritableHeaders; import io.helidon.common.socket.PeerInfo; import io.helidon.common.uri.UriInfo; import io.helidon.common.uri.UriQuery; -import io.helidon.nima.http.encoding.ContentDecoder; -import io.helidon.nima.http.media.ReadableEntity; -import io.helidon.nima.http2.Http2Headers; -import io.helidon.nima.webserver.ConnectionContext; -import io.helidon.nima.webserver.ListenerContext; -import io.helidon.nima.webserver.http.HttpSecurity; -import io.helidon.nima.webserver.http.RoutingRequest; +import io.helidon.http.Http; +import io.helidon.http.HttpPrologue; +import io.helidon.http.RoutedPath; +import io.helidon.http.ServerRequestHeaders; +import io.helidon.http.WritableHeaders; +import io.helidon.http.encoding.ContentDecoder; +import io.helidon.http.http2.Http2Headers; +import io.helidon.http.media.ReadableEntity; +import io.helidon.webserver.ConnectionContext; +import io.helidon.webserver.ListenerContext; +import io.helidon.webserver.http.HttpSecurity; +import io.helidon.webserver.http.RoutingRequest; /** * HTTP/2 server request. diff --git a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2ServerRequestEntity.java b/webserver/http2/src/main/java/io/helidon/webserver/http2/Http2ServerRequestEntity.java similarity index 92% rename from nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2ServerRequestEntity.java rename to webserver/http2/src/main/java/io/helidon/webserver/http2/Http2ServerRequestEntity.java index 67285c6c227..25c6098d5ce 100644 --- a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2ServerRequestEntity.java +++ b/webserver/http2/src/main/java/io/helidon/webserver/http2/Http2ServerRequestEntity.java @@ -14,18 +14,18 @@ * limitations under the License. */ -package io.helidon.nima.http2.webserver; +package io.helidon.webserver.http2; import java.io.InputStream; import java.util.function.Function; import io.helidon.common.GenericType; import io.helidon.common.buffers.BufferData; -import io.helidon.common.http.ServerRequestHeaders; -import io.helidon.nima.http.encoding.ContentDecoder; -import io.helidon.nima.http.media.MediaContext; -import io.helidon.nima.http.media.ReadableEntity; -import io.helidon.nima.http.media.ReadableEntityBase; +import io.helidon.http.ServerRequestHeaders; +import io.helidon.http.encoding.ContentDecoder; +import io.helidon.http.media.MediaContext; +import io.helidon.http.media.ReadableEntity; +import io.helidon.http.media.ReadableEntityBase; /** * Server request entity. diff --git a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2ServerResponse.java b/webserver/http2/src/main/java/io/helidon/webserver/http2/Http2ServerResponse.java similarity index 94% rename from nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2ServerResponse.java rename to webserver/http2/src/main/java/io/helidon/webserver/http2/Http2ServerResponse.java index 6a96dec0fab..8cab93dfe27 100644 --- a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2ServerResponse.java +++ b/webserver/http2/src/main/java/io/helidon/webserver/http2/Http2ServerResponse.java @@ -14,28 +14,28 @@ * limitations under the License. */ -package io.helidon.nima.http2.webserver; +package io.helidon.webserver.http2; import java.io.IOException; import java.io.OutputStream; import java.io.UncheckedIOException; import io.helidon.common.buffers.BufferData; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.Header; -import io.helidon.common.http.Http.HeaderNames; -import io.helidon.common.http.Http.Headers; -import io.helidon.common.http.ServerResponseHeaders; -import io.helidon.nima.http2.FlowControl; -import io.helidon.nima.http2.Http2Flag; -import io.helidon.nima.http2.Http2Flag.DataFlags; -import io.helidon.nima.http2.Http2FrameData; -import io.helidon.nima.http2.Http2FrameHeader; -import io.helidon.nima.http2.Http2FrameTypes; -import io.helidon.nima.http2.Http2Headers; -import io.helidon.nima.http2.Http2StreamWriter; -import io.helidon.nima.webserver.ConnectionContext; -import io.helidon.nima.webserver.http.ServerResponseBase; +import io.helidon.http.Http; +import io.helidon.http.Http.Header; +import io.helidon.http.Http.HeaderNames; +import io.helidon.http.Http.Headers; +import io.helidon.http.ServerResponseHeaders; +import io.helidon.http.http2.FlowControl; +import io.helidon.http.http2.Http2Flag; +import io.helidon.http.http2.Http2Flag.DataFlags; +import io.helidon.http.http2.Http2FrameData; +import io.helidon.http.http2.Http2FrameHeader; +import io.helidon.http.http2.Http2FrameTypes; +import io.helidon.http.http2.Http2Headers; +import io.helidon.http.http2.Http2StreamWriter; +import io.helidon.webserver.ConnectionContext; +import io.helidon.webserver.http.ServerResponseBase; class Http2ServerResponse extends ServerResponseBase { private static final System.Logger LOGGER = System.getLogger(Http2ServerResponse.class.getName()); diff --git a/webserver/http2/src/main/java/io/helidon/webserver/http2/Http2ServerStream.java b/webserver/http2/src/main/java/io/helidon/webserver/http2/Http2ServerStream.java new file mode 100644 index 00000000000..6f87caad34e --- /dev/null +++ b/webserver/http2/src/main/java/io/helidon/webserver/http2/Http2ServerStream.java @@ -0,0 +1,442 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.webserver.http2; + +import java.io.UncheckedIOException; +import java.util.List; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.Semaphore; + +import io.helidon.common.buffers.BufferData; +import io.helidon.common.socket.SocketWriterException; +import io.helidon.http.DirectHandler; +import io.helidon.http.Headers; +import io.helidon.http.Http; +import io.helidon.http.Http.HeaderNames; +import io.helidon.http.HttpPrologue; +import io.helidon.http.RequestException; +import io.helidon.http.ServerResponseHeaders; +import io.helidon.http.encoding.ContentDecoder; +import io.helidon.http.encoding.ContentEncodingContext; +import io.helidon.http.http2.ConnectionFlowControl; +import io.helidon.http.http2.Http2ErrorCode; +import io.helidon.http.http2.Http2Exception; +import io.helidon.http.http2.Http2Flag; +import io.helidon.http.http2.Http2FrameData; +import io.helidon.http.http2.Http2FrameHeader; +import io.helidon.http.http2.Http2FrameTypes; +import io.helidon.http.http2.Http2Headers; +import io.helidon.http.http2.Http2Priority; +import io.helidon.http.http2.Http2RstStream; +import io.helidon.http.http2.Http2Settings; +import io.helidon.http.http2.Http2Stream; +import io.helidon.http.http2.Http2StreamState; +import io.helidon.http.http2.Http2StreamWriter; +import io.helidon.http.http2.Http2WindowUpdate; +import io.helidon.http.http2.StreamFlowControl; +import io.helidon.http.http2.WindowSize; +import io.helidon.webserver.CloseConnectionException; +import io.helidon.webserver.ConnectionContext; +import io.helidon.webserver.Router; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.http2.spi.Http2SubProtocolSelector; +import io.helidon.webserver.http2.spi.SubProtocolResult; + +import static java.lang.System.Logger.Level.TRACE; + +/** + * Server HTTP/2 stream implementation. + */ +public class Http2ServerStream implements Runnable, Http2Stream { + private static final DataFrame TERMINATING_FRAME = + new DataFrame(Http2FrameHeader.create(0, + Http2FrameTypes.DATA, + Http2Flag.DataFlags.create(Http2Flag.DataFlags.END_OF_STREAM), + 0), BufferData.empty()); + private static final System.Logger LOGGER = System.getLogger(Http2Stream.class.getName()); + + private final ConnectionContext ctx; + private final Http2Config http2Config; + private final List subProviders; + private final int streamId; + private final Http2Settings serverSettings; + private final Http2Settings clientSettings; + private final Http2StreamWriter writer; + private final Router router; + private final ArrayBlockingQueue inboundData = new ArrayBlockingQueue<>(32); + private final StreamFlowControl flowControl; + + private boolean wasLastDataFrame = false; + private volatile Http2Headers headers; + private volatile Http2Priority priority; + // used from this instance and from connection + private volatile Http2StreamState state = Http2StreamState.IDLE; + private Http2SubProtocolSelector.SubProtocolHandler subProtocolHandler; + private long expectedLength = -1; + private HttpRouting routing; + private HttpPrologue prologue; + // create a semaphore if accessed before we get the one from connection + // must be volatile, as it is accessed both from connection thread and from stream thread + private volatile Semaphore requestSemaphore = new Semaphore(1); + private boolean semaphoreAcquired; + + /** + * A new HTTP/2 server stream. + * + * @param ctx connection context + * @param routing HTTP routing + * @param http2Config HTTP/2 configuration + * @param subProviders HTTP/2 sub protocol selectors + * @param streamId stream id + * @param serverSettings server settings + * @param clientSettings client settings + * @param writer writer + * @param connectionFlowControl connection flow control + */ + public Http2ServerStream(ConnectionContext ctx, + HttpRouting routing, + Http2Config http2Config, + List subProviders, + int streamId, + Http2Settings serverSettings, + Http2Settings clientSettings, + Http2StreamWriter writer, + ConnectionFlowControl connectionFlowControl) { + this.ctx = ctx; + this.routing = routing; + this.http2Config = http2Config; + this.subProviders = subProviders; + this.streamId = streamId; + this.serverSettings = serverSettings; + this.clientSettings = clientSettings; + this.writer = writer; + this.router = ctx.router(); + this.flowControl = connectionFlowControl.createStreamFlowControl( + streamId, + http2Config.initialWindowSize(), + http2Config.maxFrameSize() + ); + } + + /** + * Check this stream is not closed. + * This method is called from connection thread. + * + * @throws Http2Exception in case this stream is closed + */ + public void checkNotClosed() throws Http2Exception { + if (state == Http2StreamState.HALF_CLOSED_REMOTE + || state == Http2StreamState.CLOSED) { + throw new Http2Exception(Http2ErrorCode.STREAM_CLOSED, + "Stream " + streamId + " is closed. State: " + state); + } + } + + /** + * Check if data can be received on this stream. + * This method is called from connection thread. + * + * @throws Http2Exception in case data cannot be received + */ + public void checkDataReceivable() throws Http2Exception { + if (state != Http2StreamState.OPEN) { + throw new Http2Exception(Http2ErrorCode.PROTOCOL, "Received data for stream " + + streamId + " in state " + state); + } + } + + /** + * Check if headers can be received on this stream. + * This method is called from connection thread. + * + * @throws Http2Exception in case headers cannot be received. + */ + public void checkHeadersReceivable() throws Http2Exception { + switch (state) { + case IDLE: + // this is OK + break; + case HALF_CLOSED_LOCAL: + case HALF_CLOSED_REMOTE: + case CLOSED: + throw new Http2Exception(Http2ErrorCode.STREAM_CLOSED, + "Stream " + streamId + " received headers when stream is " + state); + case OPEN: + throw new Http2Exception(Http2ErrorCode.PROTOCOL, "Received headers for open stream " + streamId); + default: + throw new Http2Exception(Http2ErrorCode.INTERNAL, "Unknown stream state: " + streamId + ", state: " + state); + } + } + + @Override + public void rstStream(Http2RstStream rstStream) { + if (state == Http2StreamState.IDLE) { + throw new Http2Exception(Http2ErrorCode.PROTOCOL, + "Received RST_STREAM for stream " + + streamId + " in IDLE state"); + } + // TODO interrupt + this.state = Http2StreamState.CLOSED; + } + + @Override + public void windowUpdate(Http2WindowUpdate windowUpdate) { + if (state == Http2StreamState.IDLE) { + throw new Http2Exception(Http2ErrorCode.PROTOCOL, "Received WINDOW_UPDATE for stream " + + streamId + " in state IDLE"); + } + //6.9/2 + if (windowUpdate.windowSizeIncrement() == 0) { + Http2RstStream frame = new Http2RstStream(Http2ErrorCode.PROTOCOL); + writer.write(frame.toFrameData(clientSettings, streamId, Http2Flag.NoFlags.create())); + } + //6.9.1/3 + if (flowControl.outbound().incrementStreamWindowSize(windowUpdate.windowSizeIncrement()) > WindowSize.MAX_WIN_SIZE) { + Http2RstStream frame = new Http2RstStream(Http2ErrorCode.FLOW_CONTROL); + writer.write(frame.toFrameData(clientSettings, streamId, Http2Flag.NoFlags.create())); + } + } + + // this method is called from connection thread and start the + // thread o this stream + @Override + public void headers(Http2Headers headers, boolean endOfStream) { + this.headers = headers; + this.state = endOfStream ? Http2StreamState.HALF_CLOSED_REMOTE : Http2StreamState.OPEN; + if (state == Http2StreamState.HALF_CLOSED_REMOTE) { + try { + // we need to notify that there is no data coming + inboundData.put(TERMINATING_FRAME); + } catch (InterruptedException e) { + throw new Http2Exception(Http2ErrorCode.INTERNAL, "Interrupted", e); + } + } + } + + @Override + public void data(Http2FrameHeader header, BufferData data) { + // todo check number of queued items and modify flow control if we seem to be collecting messages + if (expectedLength != -1 && expectedLength < header.length()) { + state = Http2StreamState.CLOSED; + Http2RstStream rst = new Http2RstStream(Http2ErrorCode.PROTOCOL); + writer.write(rst.toFrameData(clientSettings, streamId, Http2Flag.NoFlags.create())); + return; + } + if (expectedLength != -1) { + expectedLength -= header.length(); + } + try { + inboundData.put(new DataFrame(header, data)); + } catch (InterruptedException e) { + throw new Http2Exception(Http2ErrorCode.INTERNAL, "Interrupted", e); + } + } + + @Override + public void priority(Http2Priority http2Priority) { + int i = http2Priority.streamId(); + if (i == this.streamId) { + throw new Http2Exception(Http2ErrorCode.PROTOCOL, "Stream depends on itself"); + } + this.priority = http2Priority; + } + + @Override + public int streamId() { + return streamId; + } + + @Override + public Http2StreamState streamState() { + return state; + } + + @Override + public StreamFlowControl flowControl() { + return this.flowControl; + } + + @Override + public void run() { + Thread.currentThread() + .setName("[" + ctx.socketId() + " " + + ctx.childSocketId() + " ] - " + streamId); + try { + handle(); + } catch (SocketWriterException | CloseConnectionException | UncheckedIOException e) { + Http2RstStream rst = new Http2RstStream(Http2ErrorCode.STREAM_CLOSED); + writer.write(rst.toFrameData(serverSettings, streamId, Http2Flag.NoFlags.create())); + // no sense in throwing an exception, as this is invoked from an executor service directly + } catch (RequestException e) { + DirectHandler handler = ctx.listenerContext() + .directHandlers() + .handler(e.eventType()); + DirectHandler.TransportResponse response = handler.handle(e.request(), + e.eventType(), + e.status(), + e.responseHeaders(), + e); + + ServerResponseHeaders headers = response.headers(); + byte[] message = response.entity().orElse(BufferData.EMPTY_BYTES); + if (message.length != 0) { + headers.set(Http.Headers.create(Http.HeaderNames.CONTENT_LENGTH, String.valueOf(message.length))); + } + Http2Headers http2Headers = Http2Headers.create(headers); + if (message.length == 0) { + writer.writeHeaders(http2Headers, + streamId, + Http2Flag.HeaderFlags.create(Http2Flag.END_OF_HEADERS | Http2Flag.END_OF_STREAM), + flowControl.outbound()); + } else { + Http2FrameHeader dataHeader = Http2FrameHeader.create(message.length, + Http2FrameTypes.DATA, + Http2Flag.DataFlags.create(Http2Flag.END_OF_STREAM), + streamId); + writer.writeHeaders(http2Headers, + streamId, + Http2Flag.HeaderFlags.create(Http2Flag.END_OF_HEADERS), + new Http2FrameData(dataHeader, BufferData.create(message)), + flowControl.outbound()); + } + } finally { + headers = null; + subProtocolHandler = null; + if (semaphoreAcquired) { + requestSemaphore.release(); + } + } + } + + void requestSemaphore(Semaphore requestSemaphore) { + this.requestSemaphore = requestSemaphore; + } + + void prologue(HttpPrologue prologue) { + this.prologue = prologue; + } + + private BufferData readEntityFromPipeline() { + if (wasLastDataFrame) { + return BufferData.empty(); + } + + DataFrame frame; + try { + frame = inboundData.take(); + flowControl.inbound().incrementWindowSize(frame.header().length()); + } catch (InterruptedException e) { + // this stream was interrupted, does not make sense to do anything else + return BufferData.empty(); + } + + if (frame.header().flags(Http2FrameTypes.DATA).endOfStream()) { + wasLastDataFrame = true; + } + return frame.data(); + } + + private void handle() { + Headers httpHeaders = headers.httpHeaders(); + if (httpHeaders.contains(Http.HeaderNames.CONTENT_LENGTH)) { + this.expectedLength = httpHeaders.get(HeaderNames.CONTENT_LENGTH).value(long.class); + } + + subProtocolHandler = null; + + for (Http2SubProtocolSelector provider : subProviders) { + SubProtocolResult subProtocolResult = provider.subProtocol(ctx, + prologue, + headers, + writer, + streamId, + serverSettings, + clientSettings, + flowControl, + state, + router); + if (subProtocolResult.supported()) { + subProtocolHandler = subProtocolResult.subProtocol(); + break; + } + } + + if (subProtocolHandler == null) { + ContentEncodingContext contentEncodingContext = ctx.listenerContext().contentEncodingContext(); + ContentDecoder decoder; + if (contentEncodingContext.contentDecodingEnabled()) { + if (httpHeaders.contains(Http.HeaderNames.CONTENT_ENCODING)) { + String contentEncoding = httpHeaders.get(Http.HeaderNames.CONTENT_ENCODING).value(); + if (contentEncodingContext.contentDecodingSupported(contentEncoding)) { + decoder = contentEncodingContext.decoder(contentEncoding); + } else { + throw RequestException.builder() + .type(DirectHandler.EventType.OTHER) + .status(Http.Status.UNSUPPORTED_MEDIA_TYPE_415) + .message("Unsupported content encoding") + .build(); + } + } else { + decoder = ContentDecoder.NO_OP; + } + } else { + decoder = ContentDecoder.NO_OP; + } + + Http2ServerRequest request = Http2ServerRequest.create(ctx, + routing.security(), + prologue, + headers, + decoder, + streamId, + this::readEntityFromPipeline); + Http2ServerResponse response = new Http2ServerResponse(ctx, request, writer, streamId, flowControl.outbound()); + semaphoreAcquired = requestSemaphore.tryAcquire(); + try { + if (semaphoreAcquired) { + routing.route(ctx, request, response); + } else { + ctx.log(LOGGER, TRACE, "Too many concurrent requests, rejecting request."); + response.status(Http.Status.SERVICE_UNAVAILABLE_503) + .send("Too Many Concurrent Requests"); + response.commit(); + } + } finally { + this.state = Http2StreamState.CLOSED; + } + } else { + subProtocolHandler.init(); + while (subProtocolHandler.streamState() != Http2StreamState.CLOSED + && subProtocolHandler.streamState() != Http2StreamState.HALF_CLOSED_LOCAL) { + DataFrame frame; + try { + frame = inboundData.take(); + flowControl.inbound().incrementWindowSize(frame.header().length()); + } catch (InterruptedException e) { + // this stream was interrupted, does not make sense to do anything else + String handlerName = subProtocolHandler.getClass().getSimpleName(); + ctx.log(LOGGER, System.Logger.Level.DEBUG, "%s interrupted stream %d", handlerName, streamId); + return; + } + subProtocolHandler.data(frame.header, frame.data); + this.state = subProtocolHandler.streamState(); + } + } + } + + private record DataFrame(Http2FrameHeader header, BufferData data) { } +} diff --git a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2UpgradeProvider.java b/webserver/http2/src/main/java/io/helidon/webserver/http2/Http2UpgradeProvider.java similarity index 91% rename from nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2UpgradeProvider.java rename to webserver/http2/src/main/java/io/helidon/webserver/http2/Http2UpgradeProvider.java index 170ec6233be..447f4371632 100644 --- a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2UpgradeProvider.java +++ b/webserver/http2/src/main/java/io/helidon/webserver/http2/Http2UpgradeProvider.java @@ -14,19 +14,19 @@ * limitations under the License. */ -package io.helidon.nima.http2.webserver; +package io.helidon.webserver.http2; import java.util.ArrayList; import java.util.List; import java.util.ServiceLoader; import io.helidon.common.HelidonServiceLoader; -import io.helidon.nima.http2.webserver.spi.Http2SubProtocolProvider; -import io.helidon.nima.http2.webserver.spi.Http2SubProtocolSelector; -import io.helidon.nima.webserver.ProtocolConfigs; -import io.helidon.nima.webserver.http1.spi.Http1UpgradeProvider; -import io.helidon.nima.webserver.http1.spi.Http1Upgrader; -import io.helidon.nima.webserver.spi.ProtocolConfig; +import io.helidon.webserver.ProtocolConfigs; +import io.helidon.webserver.http1.spi.Http1UpgradeProvider; +import io.helidon.webserver.http1.spi.Http1Upgrader; +import io.helidon.webserver.http2.spi.Http2SubProtocolProvider; +import io.helidon.webserver.http2.spi.Http2SubProtocolSelector; +import io.helidon.webserver.spi.ProtocolConfig; /** * {@link java.util.ServiceLoader} upgrade protocol provider to upgrade from HTTP/1.1 to HTTP/2. diff --git a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2Upgrader.java b/webserver/http2/src/main/java/io/helidon/webserver/http2/Http2Upgrader.java similarity index 88% rename from nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2Upgrader.java rename to webserver/http2/src/main/java/io/helidon/webserver/http2/Http2Upgrader.java index 23395d6f3bd..94d577c21a6 100644 --- a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/Http2Upgrader.java +++ b/webserver/http2/src/main/java/io/helidon/webserver/http2/Http2Upgrader.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2.webserver; +package io.helidon.webserver.http2; import java.nio.charset.StandardCharsets; import java.util.Base64; @@ -22,16 +22,16 @@ import io.helidon.common.buffers.BufferData; import io.helidon.common.buffers.DataWriter; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderName; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.WritableHeaders; -import io.helidon.nima.http2.Http2Headers; -import io.helidon.nima.http2.Http2Settings; -import io.helidon.nima.http2.webserver.spi.Http2SubProtocolSelector; -import io.helidon.nima.webserver.ConnectionContext; -import io.helidon.nima.webserver.http1.spi.Http1Upgrader; -import io.helidon.nima.webserver.spi.ServerConnection; +import io.helidon.http.Http; +import io.helidon.http.Http.HeaderName; +import io.helidon.http.HttpPrologue; +import io.helidon.http.WritableHeaders; +import io.helidon.http.http2.Http2Headers; +import io.helidon.http.http2.Http2Settings; +import io.helidon.webserver.ConnectionContext; +import io.helidon.webserver.http1.spi.Http1Upgrader; +import io.helidon.webserver.http2.spi.Http2SubProtocolSelector; +import io.helidon.webserver.spi.ServerConnection; /** * HTTP/1.1 to HTTP/2 connection upgrade. diff --git a/webserver/http2/src/main/java/io/helidon/webserver/http2/package-info.java b/webserver/http2/src/main/java/io/helidon/webserver/http2/package-info.java new file mode 100644 index 00000000000..b12e12ede1b --- /dev/null +++ b/webserver/http2/src/main/java/io/helidon/webserver/http2/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebServer HTTP/2 Support. + */ +package io.helidon.webserver.http2; diff --git a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/spi/Http2SubProtocolProvider.java b/webserver/http2/src/main/java/io/helidon/webserver/http2/spi/Http2SubProtocolProvider.java similarity index 91% rename from nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/spi/Http2SubProtocolProvider.java rename to webserver/http2/src/main/java/io/helidon/webserver/http2/spi/Http2SubProtocolProvider.java index 9a18b04e087..4c4f5303c3d 100644 --- a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/spi/Http2SubProtocolProvider.java +++ b/webserver/http2/src/main/java/io/helidon/webserver/http2/spi/Http2SubProtocolProvider.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.helidon.nima.http2.webserver.spi; +package io.helidon.webserver.http2.spi; -import io.helidon.nima.webserver.ProtocolConfigs; -import io.helidon.nima.webserver.spi.ProtocolConfig; +import io.helidon.webserver.ProtocolConfigs; +import io.helidon.webserver.spi.ProtocolConfig; /** * {@link java.util.ServiceLoader} provider interface for HTTP/2 sub-protocols. diff --git a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/spi/Http2SubProtocolSelector.java b/webserver/http2/src/main/java/io/helidon/webserver/http2/spi/Http2SubProtocolSelector.java similarity index 81% rename from nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/spi/Http2SubProtocolSelector.java rename to webserver/http2/src/main/java/io/helidon/webserver/http2/spi/Http2SubProtocolSelector.java index ddb6b188485..335d020ce15 100644 --- a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/spi/Http2SubProtocolSelector.java +++ b/webserver/http2/src/main/java/io/helidon/webserver/http2/spi/Http2SubProtocolSelector.java @@ -14,20 +14,20 @@ * limitations under the License. */ -package io.helidon.nima.http2.webserver.spi; +package io.helidon.webserver.http2.spi; import io.helidon.common.buffers.BufferData; -import io.helidon.common.http.HttpPrologue; -import io.helidon.nima.http2.Http2FrameHeader; -import io.helidon.nima.http2.Http2Headers; -import io.helidon.nima.http2.Http2RstStream; -import io.helidon.nima.http2.Http2Settings; -import io.helidon.nima.http2.Http2StreamState; -import io.helidon.nima.http2.Http2StreamWriter; -import io.helidon.nima.http2.Http2WindowUpdate; -import io.helidon.nima.http2.StreamFlowControl; -import io.helidon.nima.webserver.ConnectionContext; -import io.helidon.nima.webserver.Router; +import io.helidon.http.HttpPrologue; +import io.helidon.http.http2.Http2FrameHeader; +import io.helidon.http.http2.Http2Headers; +import io.helidon.http.http2.Http2RstStream; +import io.helidon.http.http2.Http2Settings; +import io.helidon.http.http2.Http2StreamState; +import io.helidon.http.http2.Http2StreamWriter; +import io.helidon.http.http2.Http2WindowUpdate; +import io.helidon.http.http2.StreamFlowControl; +import io.helidon.webserver.ConnectionContext; +import io.helidon.webserver.Router; /** * A selector of HTTP/2 sub-protocols. @@ -97,8 +97,8 @@ interface SubProtocolHandler { /** * Data was received. * The data may be empty. Check the - * {@link io.helidon.nima.http2.Http2FrameHeader#flags(io.helidon.nima.http2.Http2FrameTypes)} - * if this is {@link io.helidon.nima.http2.Http2Flag.DataFlags#END_OF_STREAM} to identify if this is the last data + * {@link io.helidon.http.http2.Http2FrameHeader#flags(io.helidon.http.http2.Http2FrameTypes)} + * if this is {@link io.helidon.http.http2.Http2Flag.DataFlags#END_OF_STREAM} to identify if this is the last data * incoming. * * @param header frame header diff --git a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/spi/SubProtocolResult.java b/webserver/http2/src/main/java/io/helidon/webserver/http2/spi/SubProtocolResult.java similarity index 95% rename from nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/spi/SubProtocolResult.java rename to webserver/http2/src/main/java/io/helidon/webserver/http2/spi/SubProtocolResult.java index b15588b014c..a11fc19f643 100644 --- a/nima/http2/webserver/src/main/java/io/helidon/nima/http2/webserver/spi/SubProtocolResult.java +++ b/webserver/http2/src/main/java/io/helidon/webserver/http2/spi/SubProtocolResult.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.http2.webserver.spi; +package io.helidon.webserver.http2.spi; /** * Sub-protocol result. diff --git a/webserver/http2/src/main/java/io/helidon/webserver/http2/spi/package-info.java b/webserver/http2/src/main/java/io/helidon/webserver/http2/spi/package-info.java new file mode 100644 index 00000000000..2ce04d7b479 --- /dev/null +++ b/webserver/http2/src/main/java/io/helidon/webserver/http2/spi/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebServer HTTP/2 SPI. + */ +package io.helidon.webserver.http2.spi; diff --git a/webserver/http2/src/main/java/module-info.java b/webserver/http2/src/main/java/module-info.java new file mode 100644 index 00000000000..fb51eb134ae --- /dev/null +++ b/webserver/http2/src/main/java/module-info.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.common.features.api.Feature; +import io.helidon.common.features.api.HelidonFlavor; +import io.helidon.webserver.http2.Http2ConnectionProvider; +import io.helidon.webserver.http2.Http2UpgradeProvider; +import io.helidon.webserver.http2.spi.Http2SubProtocolProvider; +import io.helidon.webserver.http2.Http2ProtocolConfigProvider; +import io.helidon.webserver.spi.ServerConnectionSelectorProvider; +import io.helidon.webserver.http1.spi.Http1UpgradeProvider; +import io.helidon.webserver.spi.ProtocolConfigProvider; + +/** + * Helidon WebServer HTTP/2 Support. + */ +@Feature(value = "HTTP/2", + description = "WebServer HTTP/2 support", + in = HelidonFlavor.SE, + path = {"WebServer", "HTTP/2"} +) +module io.helidon.webserver.http2 { + requires static io.helidon.common.features.api; + requires static io.helidon.config.metadata; + + requires transitive io.helidon.common; + requires transitive io.helidon.common.uri; + requires transitive io.helidon.common.socket; + requires transitive io.helidon.common.task; + requires transitive io.helidon.webserver; + requires transitive io.helidon.http; + requires transitive io.helidon.http.http2; + requires transitive io.helidon.http.encoding; + requires transitive io.helidon.http.media; + requires io.helidon.builder.api; + + exports io.helidon.webserver.http2; + exports io.helidon.webserver.http2.spi; + + // to support prior knowledge for h2c + provides ServerConnectionSelectorProvider + with Http2ConnectionProvider; + // to support upgrade requests for h2c + provides Http1UpgradeProvider + with Http2UpgradeProvider; + provides ProtocolConfigProvider + with Http2ProtocolConfigProvider; + + uses Http2SubProtocolProvider; +} diff --git a/webserver/http2/src/test/java/io/helidon/webserver/http2/ConnectionConfigTest.java b/webserver/http2/src/test/java/io/helidon/webserver/http2/ConnectionConfigTest.java new file mode 100644 index 00000000000..9f6c68eeec5 --- /dev/null +++ b/webserver/http2/src/test/java/io/helidon/webserver/http2/ConnectionConfigTest.java @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.webserver.http2; + +import java.time.Duration; +import java.util.Map; + +import io.helidon.config.Config; +import io.helidon.http.http2.Http2Setting; +import io.helidon.webserver.ConnectionContext; +import io.helidon.webserver.ListenerContext; +import io.helidon.webserver.Router; +import io.helidon.webserver.WebServer; + +import org.junit.jupiter.api.Test; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.hasKey; +import static org.junit.jupiter.api.Assertions.assertAll; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +class ConnectionConfigTest { + + // Verify that HTTP/2 connection provider is properly configured from config file + @Test + void testConnectionConfig() { + TestConnectionSelectorProvider.reset(); + // This will pick up application.yaml from the classpath as default configuration file + WebServer.builder().config(Config.create().get("server")).build(); + + Map http2Configs = TestConnectionSelectorProvider.config(); + assertThat(http2Configs, hasKey("@default")); + + Http2Config http2Config = http2Configs.get("@default"); + + assertAll( + () -> assertThat("maxFrameSize", http2Config.maxFrameSize(), is(8192)), + () -> assertThat("maxHeaderListSize", http2Config.maxHeaderListSize(), is(4096L)), + () -> assertThat("maxConcurrentStreams", http2Config.maxConcurrentStreams(), is(16384L)), + () -> assertThat("validatePath", http2Config.validatePath(), is(false)), + () -> assertThat("initialWindowSize", http2Config.initialWindowSize(), is(8192)), + () -> assertThat("flowControlTimeout", http2Config.flowControlTimeout(), is(Duration.ofMillis(700))) + ); + } + + // Verify that HTTP/2 connection provider is properly configured from builder + @Test + void testProviderConfigBuilder() { + + Http2ConnectionSelector selector = Http2ConnectionSelector.builder() + .http2Config(Http2Config.builder() + .name("@default") + .maxFrameSize(4096) + .maxHeaderListSize(2048L) + .build()) + .build(); + + Http2Connection conn = (Http2Connection) selector.connection(mockContext()); + // Verify values to be updated from configuration file + assertThat(conn.config().maxFrameSize(), is(4096)); + assertThat(conn.config().maxHeaderListSize(), is(2048L)); + // Verify Http2Settings values to be updated from configuration file + assertThat(conn.serverSettings().value(Http2Setting.MAX_FRAME_SIZE), is(4096L)); + assertThat(conn.serverSettings().value(Http2Setting.MAX_HEADER_LIST_SIZE), is(2048L)); + } + + private static ConnectionContext mockContext() { + ConnectionContext ctx = mock(ConnectionContext.class); + when(ctx.router()).thenReturn(Router.empty()); + when(ctx.listenerContext()).thenReturn(mock(ListenerContext.class)); + return ctx; + } +} diff --git a/webserver/http2/src/test/java/io/helidon/webserver/http2/TestConnectionSelectorProvider.java b/webserver/http2/src/test/java/io/helidon/webserver/http2/TestConnectionSelectorProvider.java new file mode 100644 index 00000000000..3fd76d54d4e --- /dev/null +++ b/webserver/http2/src/test/java/io/helidon/webserver/http2/TestConnectionSelectorProvider.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.webserver.http2; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import io.helidon.webserver.ProtocolConfigs; +import io.helidon.webserver.spi.ServerConnectionSelector; +import io.helidon.webserver.spi.ServerConnectionSelectorProvider; + +import static org.mockito.Mockito.mock; + +// class must be public, as it is a service provider implementation +public class TestConnectionSelectorProvider implements ServerConnectionSelectorProvider { + private static final Map CONFIGS = new ConcurrentHashMap<>(); + + static Map config() { + return CONFIGS; + } + + static void reset() { + CONFIGS.clear(); + } + + @Override + public Class protocolConfigType() { + return Http2Config.class; + } + + @Override + public String protocolType() { + return "http_2"; + } + + @Override + public ServerConnectionSelector create(String socketName, Http2Config config, ProtocolConfigs configs) { + CONFIGS.put(socketName, config); + return mock(ServerConnectionSelector.class); + } + +} diff --git a/webserver/http2/src/test/resources/META-INF/services/io.helidon.webserver.spi.ServerConnectionSelectorProvider b/webserver/http2/src/test/resources/META-INF/services/io.helidon.webserver.spi.ServerConnectionSelectorProvider new file mode 100644 index 00000000000..e511e1a7a0e --- /dev/null +++ b/webserver/http2/src/test/resources/META-INF/services/io.helidon.webserver.spi.ServerConnectionSelectorProvider @@ -0,0 +1,17 @@ +# +# Copyright (c) 2023 Oracle and/or its affiliates. +# +# 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. +# + +io.helidon.webserver.http2.TestConnectionSelectorProvider \ No newline at end of file diff --git a/nima/http2/webserver/src/test/resources/application.yaml b/webserver/http2/src/test/resources/application.yaml similarity index 100% rename from nima/http2/webserver/src/test/resources/application.yaml rename to webserver/http2/src/test/resources/application.yaml diff --git a/webserver/observe/config/pom.xml b/webserver/observe/config/pom.xml new file mode 100644 index 00000000000..317b8aa2a7e --- /dev/null +++ b/webserver/observe/config/pom.xml @@ -0,0 +1,63 @@ + + + + 4.0.0 + + io.helidon.webserver.observe + helidon-webserver-observe-project + 4.0.0-SNAPSHOT + + helidon-webserver-observe-config + Helidon WebServer Observe Config + + + + io.helidon.webserver.observe + helidon-webserver-observe + + + io.helidon.webserver + helidon-webserver + + + jakarta.json + jakarta.json-api + provided + + + io.helidon.http.media + helidon-http-media-jsonp + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + diff --git a/nima/observe/config/src/main/java/io/helidon/nima/observe/config/ConfigObserveProvider.java b/webserver/observe/config/src/main/java/io/helidon/webserver/observe/config/ConfigObserveProvider.java similarity index 88% rename from nima/observe/config/src/main/java/io/helidon/nima/observe/config/ConfigObserveProvider.java rename to webserver/observe/config/src/main/java/io/helidon/webserver/observe/config/ConfigObserveProvider.java index f1539d5ec45..0de2ffdb4f7 100644 --- a/nima/observe/config/src/main/java/io/helidon/nima/observe/config/ConfigObserveProvider.java +++ b/webserver/observe/config/src/main/java/io/helidon/webserver/observe/config/ConfigObserveProvider.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.helidon.nima.observe.config; +package io.helidon.webserver.observe.config; import io.helidon.common.config.Config; -import io.helidon.nima.observe.spi.ObserveProvider; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.observe.spi.ObserveProvider; /** * {@link java.util.ServiceLoader} provider implementation for config observe provider. diff --git a/nima/observe/config/src/main/java/io/helidon/nima/observe/config/ConfigService.java b/webserver/observe/config/src/main/java/io/helidon/webserver/observe/config/ConfigService.java similarity index 89% rename from nima/observe/config/src/main/java/io/helidon/nima/observe/config/ConfigService.java rename to webserver/observe/config/src/main/java/io/helidon/webserver/observe/config/ConfigService.java index 34facc52a6e..939d5b95fd5 100644 --- a/nima/observe/config/src/main/java/io/helidon/nima/observe/config/ConfigService.java +++ b/webserver/observe/config/src/main/java/io/helidon/webserver/observe/config/ConfigService.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.observe.config; +package io.helidon.webserver.observe.config; import java.util.HashMap; import java.util.LinkedHashSet; @@ -26,14 +26,14 @@ import io.helidon.common.config.Config; import io.helidon.common.config.ConfigValue; import io.helidon.common.config.GlobalConfig; -import io.helidon.common.http.NotFoundException; -import io.helidon.nima.http.media.EntityWriter; -import io.helidon.nima.http.media.jsonp.JsonpSupport; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.SecureHandler; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.NotFoundException; +import io.helidon.http.media.EntityWriter; +import io.helidon.http.media.jsonp.JsonpSupport; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.SecureHandler; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import jakarta.json.Json; import jakarta.json.JsonBuilderFactory; @@ -68,7 +68,7 @@ public static HttpService create(Config config) { @Override public void routing(HttpRules rules) { - rules.any(SecureHandler.authorize("nima-observe")) + rules.any(SecureHandler.authorize("webserver-observe")) .get("/profile", this::profile) .get("/values", this::values) .get("/values/{name}", this::value); diff --git a/webserver/observe/config/src/main/java/io/helidon/webserver/observe/config/package-info.java b/webserver/observe/config/src/main/java/io/helidon/webserver/observe/config/package-info.java new file mode 100644 index 00000000000..5befb49ce0e --- /dev/null +++ b/webserver/observe/config/src/main/java/io/helidon/webserver/observe/config/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebServer Observability Config Support. + */ +package io.helidon.webserver.observe.config; diff --git a/webserver/observe/config/src/main/java/module-info.java b/webserver/observe/config/src/main/java/module-info.java new file mode 100644 index 00000000000..6443db7e0c9 --- /dev/null +++ b/webserver/observe/config/src/main/java/module-info.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.webserver.observe.config.ConfigObserveProvider; +import io.helidon.webserver.observe.spi.ObserveProvider; + +/** + * Helidon WebServer Observability Config Support. + */ +module io.helidon.webserver.observe.config { + requires transitive io.helidon.webserver.observe; + requires io.helidon.webserver; + requires io.helidon.http.media.jsonp; + + exports io.helidon.webserver.observe.config; + + provides ObserveProvider with ConfigObserveProvider; +} \ No newline at end of file diff --git a/webserver/observe/health/etc/spotbugs/exclude.xml b/webserver/observe/health/etc/spotbugs/exclude.xml new file mode 100644 index 00000000000..bf8fb2e9942 --- /dev/null +++ b/webserver/observe/health/etc/spotbugs/exclude.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + diff --git a/webserver/observe/health/pom.xml b/webserver/observe/health/pom.xml new file mode 100644 index 00000000000..8219257d372 --- /dev/null +++ b/webserver/observe/health/pom.xml @@ -0,0 +1,99 @@ + + + + 4.0.0 + + io.helidon.webserver.observe + helidon-webserver-observe-project + 4.0.0-SNAPSHOT + + + helidon-webserver-observe-health + Helidon WebServer Observe Health + + + etc/spotbugs/exclude.xml + + + + + io.helidon.webserver.observe + helidon-webserver-observe + + + io.helidon.webserver + helidon-webserver + + + io.helidon.health + helidon-health + + + io.helidon.webserver + helidon-webserver-service-common + + + jakarta.json + jakarta.json-api + provided + + + io.helidon.http.media + helidon-http-media-jsonp + + + io.helidon.common.features + helidon-common-features-api + true + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + + + + + diff --git a/nima/observe/health/src/main/java/io/helidon/nima/observe/health/HealthFeature.java b/webserver/observe/health/src/main/java/io/helidon/webserver/observe/health/HealthFeature.java similarity index 91% rename from nima/observe/health/src/main/java/io/helidon/nima/observe/health/HealthFeature.java rename to webserver/observe/health/src/main/java/io/helidon/webserver/observe/health/HealthFeature.java index 36e68eac85a..8e211cb7f69 100644 --- a/nima/observe/health/src/main/java/io/helidon/nima/observe/health/HealthFeature.java +++ b/webserver/observe/health/src/main/java/io/helidon/webserver/observe/health/HealthFeature.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.observe.health; +package io.helidon.webserver.observe.health; import java.util.ArrayList; import java.util.Collection; @@ -27,11 +27,11 @@ import io.helidon.health.HealthCheck; import io.helidon.health.HealthCheckType; import io.helidon.health.spi.HealthCheckProvider; -import io.helidon.nima.http.media.EntityWriter; -import io.helidon.nima.http.media.jsonp.JsonpSupport; -import io.helidon.nima.servicecommon.HelidonFeatureSupport; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; +import io.helidon.http.media.EntityWriter; +import io.helidon.http.media.jsonp.JsonpSupport; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.servicecommon.HelidonFeatureSupport; import jakarta.json.JsonObject; @@ -41,8 +41,8 @@ /** * Observe health endpoints. - * This service provides endpoints for {@link io.helidon.common.http.Http.Method#GET} and - * {@link io.helidon.common.http.Http.Method#HEAD} methods. + * This service provides endpoints for {@link io.helidon.http.Http.Method#GET} and + * {@link io.helidon.http.Http.Method#HEAD} methods. */ public class HealthFeature extends HelidonFeatureSupport { private static final System.Logger LOGGER = System.getLogger(HealthFeature.class.getName()); @@ -173,10 +173,10 @@ public Builder enabled(boolean enabled) { /** * Whether details should be printed. - * By default, health only returns a {@link io.helidon.common.http.Http.Status#NO_CONTENT_204} for success, - * {@link io.helidon.common.http.Http.Status#SERVICE_UNAVAILABLE_503} for health down, - * and {@link io.helidon.common.http.Http.Status#INTERNAL_SERVER_ERROR_500} in case of error with no entity. - * When details are enabled, health returns {@link io.helidon.common.http.Http.Status#OK_200} for success, same codes + * By default, health only returns a {@link io.helidon.http.Http.Status#NO_CONTENT_204} for success, + * {@link io.helidon.http.Http.Status#SERVICE_UNAVAILABLE_503} for health down, + * and {@link io.helidon.http.Http.Status#INTERNAL_SERVER_ERROR_500} in case of error with no entity. + * When details are enabled, health returns {@link io.helidon.http.Http.Status#OK_200} for success, same codes * otherwise * and a JSON entity with detailed information about each health check executed. * diff --git a/nima/observe/health/src/main/java/io/helidon/nima/observe/health/HealthHandler.java b/webserver/observe/health/src/main/java/io/helidon/webserver/observe/health/HealthHandler.java similarity index 91% rename from nima/observe/health/src/main/java/io/helidon/nima/observe/health/HealthHandler.java rename to webserver/observe/health/src/main/java/io/helidon/webserver/observe/health/HealthHandler.java index 00173445343..69f45c058e3 100644 --- a/nima/observe/health/src/main/java/io/helidon/nima/observe/health/HealthHandler.java +++ b/webserver/observe/health/src/main/java/io/helidon/webserver/observe/health/HealthHandler.java @@ -14,21 +14,21 @@ * limitations under the License. */ -package io.helidon.nima.observe.health; +package io.helidon.webserver.observe.health; import java.util.ArrayList; import java.util.Collection; import java.util.List; -import io.helidon.common.http.HtmlEncoder; -import io.helidon.common.http.Http; import io.helidon.health.HealthCheck; import io.helidon.health.HealthCheckResponse; -import io.helidon.nima.http.media.EntityWriter; -import io.helidon.nima.http.media.jsonp.JsonpSupport; -import io.helidon.nima.webserver.http.Handler; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.HtmlEncoder; +import io.helidon.http.Http; +import io.helidon.http.media.EntityWriter; +import io.helidon.http.media.jsonp.JsonpSupport; +import io.helidon.webserver.http.Handler; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import jakarta.json.JsonArrayBuilder; import jakarta.json.JsonObject; diff --git a/nima/observe/health/src/main/java/io/helidon/nima/observe/health/HealthHelper.java b/webserver/observe/health/src/main/java/io/helidon/webserver/observe/health/HealthHelper.java similarity index 93% rename from nima/observe/health/src/main/java/io/helidon/nima/observe/health/HealthHelper.java rename to webserver/observe/health/src/main/java/io/helidon/webserver/observe/health/HealthHelper.java index 489044ea779..17099d20965 100644 --- a/nima/observe/health/src/main/java/io/helidon/nima/observe/health/HealthHelper.java +++ b/webserver/observe/health/src/main/java/io/helidon/webserver/observe/health/HealthHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.observe.health; +package io.helidon.webserver.observe.health; import java.util.Collections; import java.util.Map; diff --git a/nima/observe/health/src/main/java/io/helidon/nima/observe/health/HealthObserveProvider.java b/webserver/observe/health/src/main/java/io/helidon/webserver/observe/health/HealthObserveProvider.java similarity index 92% rename from nima/observe/health/src/main/java/io/helidon/nima/observe/health/HealthObserveProvider.java rename to webserver/observe/health/src/main/java/io/helidon/webserver/observe/health/HealthObserveProvider.java index b8614d9d406..333f001d735 100644 --- a/nima/observe/health/src/main/java/io/helidon/nima/observe/health/HealthObserveProvider.java +++ b/webserver/observe/health/src/main/java/io/helidon/webserver/observe/health/HealthObserveProvider.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.nima.observe.health; +package io.helidon.webserver.observe.health; import io.helidon.common.config.Config; -import io.helidon.common.http.Http; -import io.helidon.nima.observe.spi.ObserveProvider; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.http.Http; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.observe.spi.ObserveProvider; /** * {@link java.util.ServiceLoader} provider implementation for health observe provider. @@ -53,7 +53,7 @@ public static ObserveProvider create() { /** * Create using a configured observer. - * In this case configuration provided by the {@link io.helidon.nima.observe.ObserveFeature} is ignored except for + * In this case configuration provided by the {@link io.helidon.webserver.observe.ObserveFeature} is ignored except for * the reserved option {@code endpoint}). * * @param service service to use diff --git a/nima/observe/health/src/main/java/io/helidon/nima/observe/health/NamedResponse.java b/webserver/observe/health/src/main/java/io/helidon/webserver/observe/health/NamedResponse.java similarity index 86% rename from nima/observe/health/src/main/java/io/helidon/nima/observe/health/NamedResponse.java rename to webserver/observe/health/src/main/java/io/helidon/webserver/observe/health/NamedResponse.java index a88b8716d16..1a9b449c1e5 100644 --- a/nima/observe/health/src/main/java/io/helidon/nima/observe/health/NamedResponse.java +++ b/webserver/observe/health/src/main/java/io/helidon/webserver/observe/health/NamedResponse.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.observe.health; +package io.helidon.webserver.observe.health; import io.helidon.health.HealthCheckResponse; diff --git a/nima/observe/health/src/main/java/io/helidon/nima/observe/health/SingleCheckHandler.java b/webserver/observe/health/src/main/java/io/helidon/webserver/observe/health/SingleCheckHandler.java similarity index 88% rename from nima/observe/health/src/main/java/io/helidon/nima/observe/health/SingleCheckHandler.java rename to webserver/observe/health/src/main/java/io/helidon/webserver/observe/health/SingleCheckHandler.java index df842cf1f10..4bf9d93d275 100644 --- a/nima/observe/health/src/main/java/io/helidon/nima/observe/health/SingleCheckHandler.java +++ b/webserver/observe/health/src/main/java/io/helidon/webserver/observe/health/SingleCheckHandler.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.observe.health; +package io.helidon.webserver.observe.health; import java.io.IOException; import java.io.OutputStream; @@ -22,16 +22,16 @@ import java.util.List; import java.util.Map; -import io.helidon.common.http.HtmlEncoder; -import io.helidon.common.http.Http; -import io.helidon.common.http.NotFoundException; import io.helidon.health.HealthCheck; import io.helidon.health.HealthCheckResponse; -import io.helidon.nima.http.media.EntityWriter; -import io.helidon.nima.http.media.jsonp.JsonpSupport; -import io.helidon.nima.webserver.http.Handler; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.HtmlEncoder; +import io.helidon.http.Http; +import io.helidon.http.NotFoundException; +import io.helidon.http.media.EntityWriter; +import io.helidon.http.media.jsonp.JsonpSupport; +import io.helidon.webserver.http.Handler; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import jakarta.json.JsonObject; diff --git a/webserver/observe/health/src/main/java/io/helidon/webserver/observe/health/package-info.java b/webserver/observe/health/src/main/java/io/helidon/webserver/observe/health/package-info.java new file mode 100644 index 00000000000..05555bcd043 --- /dev/null +++ b/webserver/observe/health/src/main/java/io/helidon/webserver/observe/health/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ +/** + * Helidon WebServer Observability Health Support. + */ +package io.helidon.webserver.observe.health; diff --git a/webserver/observe/health/src/main/java/module-info.java b/webserver/observe/health/src/main/java/module-info.java new file mode 100644 index 00000000000..312bfab9cfc --- /dev/null +++ b/webserver/observe/health/src/main/java/module-info.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.common.features.api.Feature; +import io.helidon.common.features.api.HelidonFlavor; +import io.helidon.health.spi.HealthCheckProvider; +import io.helidon.webserver.observe.health.HealthObserveProvider; +import io.helidon.webserver.observe.spi.ObserveProvider; + +/** + * Helidon WebServer Observability Health Support. + */ +@Feature(value = "Health", + description = "WebServer Health check support", + in = HelidonFlavor.SE) +module io.helidon.webserver.observe.health { + requires java.management; + + requires transitive io.helidon.health; + requires transitive io.helidon.webserver.observe; + requires io.helidon.webserver; + requires io.helidon.http.media.jsonp; + requires io.helidon.servicecommon; + requires static io.helidon.common.features.api; + + exports io.helidon.webserver.observe.health; + + provides ObserveProvider with HealthObserveProvider; + + uses HealthCheckProvider; +} \ No newline at end of file diff --git a/webserver/observe/info/pom.xml b/webserver/observe/info/pom.xml new file mode 100644 index 00000000000..6cb631db16c --- /dev/null +++ b/webserver/observe/info/pom.xml @@ -0,0 +1,65 @@ + + + + 4.0.0 + + io.helidon.webserver.observe + helidon-webserver-observe-project + 4.0.0-SNAPSHOT + + + helidon-webserver-observe-info + Helidon WebServer Observe Info + Application information + + + + io.helidon.webserver.observe + helidon-webserver-observe + + + io.helidon.webserver + helidon-webserver + + + jakarta.json + jakarta.json-api + provided + + + io.helidon.http.media + helidon-http-media-jsonp + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + diff --git a/nima/observe/info/src/main/java/io/helidon/nima/observe/info/InfoObserveProvider.java b/webserver/observe/info/src/main/java/io/helidon/webserver/observe/info/InfoObserveProvider.java similarity index 89% rename from nima/observe/info/src/main/java/io/helidon/nima/observe/info/InfoObserveProvider.java rename to webserver/observe/info/src/main/java/io/helidon/webserver/observe/info/InfoObserveProvider.java index c9621b74414..11cdcb3f4c5 100644 --- a/nima/observe/info/src/main/java/io/helidon/nima/observe/info/InfoObserveProvider.java +++ b/webserver/observe/info/src/main/java/io/helidon/webserver/observe/info/InfoObserveProvider.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.helidon.nima.observe.info; +package io.helidon.webserver.observe.info; import io.helidon.common.config.Config; -import io.helidon.nima.observe.spi.ObserveProvider; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.observe.spi.ObserveProvider; /** * {@link java.util.ServiceLoader} provider implementation for application information observe provider. diff --git a/nima/observe/info/src/main/java/io/helidon/nima/observe/info/InfoService.java b/webserver/observe/info/src/main/java/io/helidon/webserver/observe/info/InfoService.java similarity index 86% rename from nima/observe/info/src/main/java/io/helidon/nima/observe/info/InfoService.java rename to webserver/observe/info/src/main/java/io/helidon/webserver/observe/info/InfoService.java index 129e912c763..5aefaa1deb2 100644 --- a/nima/observe/info/src/main/java/io/helidon/nima/observe/info/InfoService.java +++ b/webserver/observe/info/src/main/java/io/helidon/webserver/observe/info/InfoService.java @@ -14,19 +14,19 @@ * limitations under the License. */ -package io.helidon.nima.observe.info; +package io.helidon.webserver.observe.info; import java.util.LinkedHashMap; import java.util.Map; import io.helidon.common.config.Config; -import io.helidon.common.http.NotFoundException; -import io.helidon.nima.http.media.EntityWriter; -import io.helidon.nima.http.media.jsonp.JsonpSupport; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.NotFoundException; +import io.helidon.http.media.EntityWriter; +import io.helidon.http.media.jsonp.JsonpSupport; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import jakarta.json.Json; import jakarta.json.JsonBuilderFactory; diff --git a/webserver/observe/info/src/main/java/io/helidon/webserver/observe/info/package-info.java b/webserver/observe/info/src/main/java/io/helidon/webserver/observe/info/package-info.java new file mode 100644 index 00000000000..72d36c14288 --- /dev/null +++ b/webserver/observe/info/src/main/java/io/helidon/webserver/observe/info/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebServer Observability Info Support. + */ +package io.helidon.webserver.observe.info; diff --git a/webserver/observe/info/src/main/java/module-info.java b/webserver/observe/info/src/main/java/module-info.java new file mode 100644 index 00000000000..bb988778fc3 --- /dev/null +++ b/webserver/observe/info/src/main/java/module-info.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.webserver.observe.info.InfoObserveProvider; +import io.helidon.webserver.observe.spi.ObserveProvider; + +/** + * Helidon WebServer Observability Info Support. + * Info allows configuration of custom properties to be available to users. + * Info endpoint is unprotected by default and is available at {@code /observe/info} (configurable). + */ +module io.helidon.webserver.observe.info { + requires io.helidon.config; + requires transitive io.helidon.webserver.observe; + requires io.helidon.webserver; + requires io.helidon.http.media.jsonp; + + exports io.helidon.webserver.observe.info; + + provides ObserveProvider with InfoObserveProvider; +} \ No newline at end of file diff --git a/webserver/observe/log/etc/spotbugs/exclude.xml b/webserver/observe/log/etc/spotbugs/exclude.xml new file mode 100644 index 00000000000..33fb3d86412 --- /dev/null +++ b/webserver/observe/log/etc/spotbugs/exclude.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + diff --git a/webserver/observe/log/pom.xml b/webserver/observe/log/pom.xml new file mode 100644 index 00000000000..d9ca73a9c7b --- /dev/null +++ b/webserver/observe/log/pom.xml @@ -0,0 +1,69 @@ + + + + 4.0.0 + + io.helidon.webserver.observe + helidon-webserver-observe-project + 4.0.0-SNAPSHOT + + + helidon-webserver-observe-log + Helidon WebServer Observe Log + Logging setup and log files + + + etc/spotbugs/exclude.xml + + + + + io.helidon.webserver.observe + helidon-webserver-observe + + + io.helidon.webserver + helidon-webserver + + + jakarta.json + jakarta.json-api + provided + + + io.helidon.http.media + helidon-http-media-jsonp + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + diff --git a/nima/observe/log/src/main/java/io/helidon/nima/observe/log/LogObserveProvider.java b/webserver/observe/log/src/main/java/io/helidon/webserver/observe/log/LogObserveProvider.java similarity index 91% rename from nima/observe/log/src/main/java/io/helidon/nima/observe/log/LogObserveProvider.java rename to webserver/observe/log/src/main/java/io/helidon/webserver/observe/log/LogObserveProvider.java index 5236d547f69..2a6f5e70424 100644 --- a/nima/observe/log/src/main/java/io/helidon/nima/observe/log/LogObserveProvider.java +++ b/webserver/observe/log/src/main/java/io/helidon/webserver/observe/log/LogObserveProvider.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.helidon.nima.observe.log; +package io.helidon.webserver.observe.log; import io.helidon.common.config.Config; -import io.helidon.nima.observe.spi.ObserveProvider; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.observe.spi.ObserveProvider; /** * {@link java.util.ServiceLoader} provider implementation for logging observe provider. diff --git a/nima/observe/log/src/main/java/io/helidon/nima/observe/log/LogService.java b/webserver/observe/log/src/main/java/io/helidon/webserver/observe/log/LogService.java similarity index 95% rename from nima/observe/log/src/main/java/io/helidon/nima/observe/log/LogService.java rename to webserver/observe/log/src/main/java/io/helidon/webserver/observe/log/LogService.java index 93fb689aef0..ca1d58ca0a4 100644 --- a/nima/observe/log/src/main/java/io/helidon/nima/observe/log/LogService.java +++ b/webserver/observe/log/src/main/java/io/helidon/webserver/observe/log/LogService.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.observe.log; +package io.helidon.webserver.observe.log; import java.io.OutputStreamWriter; import java.nio.charset.Charset; @@ -36,19 +36,19 @@ import java.util.logging.Logger; import io.helidon.common.config.Config; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpMediaType; -import io.helidon.common.http.HttpMediaTypes; import io.helidon.common.media.type.MediaType; -import io.helidon.nima.http.media.EntityReader; -import io.helidon.nima.http.media.EntityWriter; -import io.helidon.nima.http.media.jsonp.JsonpSupport; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.SecureHandler; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; -import io.helidon.nima.webserver.http1.Http1LoggingConnectionListener; +import io.helidon.http.Http; +import io.helidon.http.HttpMediaType; +import io.helidon.http.HttpMediaTypes; +import io.helidon.http.media.EntityReader; +import io.helidon.http.media.EntityWriter; +import io.helidon.http.media.jsonp.JsonpSupport; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.SecureHandler; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; +import io.helidon.webserver.http1.Http1LoggingConnectionListener; import jakarta.json.Json; import jakarta.json.JsonArrayBuilder; @@ -98,7 +98,7 @@ static Builder builder() { @Override public void routing(HttpRules rules) { if (!permitAll) { - rules.any(SecureHandler.authorize("nima-observe")); + rules.any(SecureHandler.authorize("observe")); } rules.get("/loggers") diff --git a/webserver/observe/log/src/main/java/io/helidon/webserver/observe/log/package-info.java b/webserver/observe/log/src/main/java/io/helidon/webserver/observe/log/package-info.java new file mode 100644 index 00000000000..2102a52eb23 --- /dev/null +++ b/webserver/observe/log/src/main/java/io/helidon/webserver/observe/log/package-info.java @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebServer Observability Log Support. + * Log observability allows reading and configuring of log levels of various loggers and reading log messages. + *

      + * Log endpoint is protected by default and is available at {@code /observe/log} (configurable). + */ +package io.helidon.webserver.observe.log; diff --git a/webserver/observe/log/src/main/java/module-info.java b/webserver/observe/log/src/main/java/module-info.java new file mode 100644 index 00000000000..35ce48907df --- /dev/null +++ b/webserver/observe/log/src/main/java/module-info.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.webserver.observe.log.LogObserveProvider; +import io.helidon.webserver.observe.spi.ObserveProvider; + +/** + * Helidon WebServer Observability Log Support. + * Log observability allows reading and configuring of log levels of various loggers and reading log messages. + *

      + * Log endpoint is protected by default and is available at {@code /observe/log} (configurable). + */ +module io.helidon.webserver.observe.log { + requires transitive io.helidon.webserver.observe; + requires io.helidon.webserver; + requires io.helidon.http.media.jsonp; + requires java.logging; + + exports io.helidon.webserver.observe.log; + + provides ObserveProvider with LogObserveProvider; +} \ No newline at end of file diff --git a/webserver/observe/metrics/pom.xml b/webserver/observe/metrics/pom.xml new file mode 100644 index 00000000000..28dfe9e92a8 --- /dev/null +++ b/webserver/observe/metrics/pom.xml @@ -0,0 +1,121 @@ + + + + + 4.0.0 + + io.helidon.webserver.observe + helidon-webserver-observe-project + 4.0.0-SNAPSHOT + + + helidon-webserver-observe-metrics + Helidon WebServer Observe Metrics + + + + io.helidon.webserver.observe + helidon-webserver-observe + + + io.helidon.metrics + helidon-metrics-api + + + io.helidon.metrics + helidon-metrics-service-api + + + io.helidon.webserver + helidon-webserver + + + io.helidon.http.media + helidon-http-media-jsonp + + + io.helidon.common + helidon-common-context + + + + + + + + + + + + + + + + + + + + + io.helidon.webserver + helidon-webserver-service-common + + + io.helidon.config + helidon-config-metadata + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + org.junit.jupiter + junit-jupiter-params + test + + + io.helidon.config + helidon-config-yaml + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + + + + + diff --git a/nima/observe/metrics/src/main/java/io/helidon/nima/observe/metrics/KeyPerformanceIndicatorMetricsImpls.java b/webserver/observe/metrics/src/main/java/io/helidon/webserver/observe/metrics/KeyPerformanceIndicatorMetricsImpls.java similarity index 98% rename from nima/observe/metrics/src/main/java/io/helidon/nima/observe/metrics/KeyPerformanceIndicatorMetricsImpls.java rename to webserver/observe/metrics/src/main/java/io/helidon/webserver/observe/metrics/KeyPerformanceIndicatorMetricsImpls.java index 8a49a52960c..e32cbfa60ae 100644 --- a/nima/observe/metrics/src/main/java/io/helidon/nima/observe/metrics/KeyPerformanceIndicatorMetricsImpls.java +++ b/webserver/observe/metrics/src/main/java/io/helidon/webserver/observe/metrics/KeyPerformanceIndicatorMetricsImpls.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.observe.metrics; +package io.helidon.webserver.observe.metrics; import java.util.HashMap; import java.util.Map; @@ -21,7 +21,7 @@ import io.helidon.metrics.api.KeyPerformanceIndicatorMetricsSettings; import io.helidon.metrics.api.Registry; import io.helidon.metrics.api.RegistryFactory; -import io.helidon.nima.webserver.KeyPerformanceIndicatorSupport; +import io.helidon.webserver.KeyPerformanceIndicatorSupport; import org.eclipse.microprofile.metrics.Counter; import org.eclipse.microprofile.metrics.Gauge; diff --git a/nima/observe/metrics/src/main/java/io/helidon/nima/observe/metrics/MetricsFeature.java b/webserver/observe/metrics/src/main/java/io/helidon/webserver/observe/metrics/MetricsFeature.java similarity index 95% rename from nima/observe/metrics/src/main/java/io/helidon/nima/observe/metrics/MetricsFeature.java rename to webserver/observe/metrics/src/main/java/io/helidon/webserver/observe/metrics/MetricsFeature.java index 01886bfdea1..a77de34328b 100644 --- a/nima/observe/metrics/src/main/java/io/helidon/nima/observe/metrics/MetricsFeature.java +++ b/webserver/observe/metrics/src/main/java/io/helidon/webserver/observe/metrics/MetricsFeature.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.observe.metrics; +package io.helidon.webserver.observe.metrics; import java.util.Collections; import java.util.List; @@ -22,26 +22,26 @@ import java.util.stream.Stream; import io.helidon.common.LazyValue; -import io.helidon.common.http.Http; import io.helidon.common.media.type.MediaType; import io.helidon.common.media.type.MediaTypes; import io.helidon.config.Config; import io.helidon.config.metadata.ConfiguredOption; +import io.helidon.http.Http; import io.helidon.metrics.api.MetricsSettings; import io.helidon.metrics.api.Registry; import io.helidon.metrics.api.RegistryFactory; import io.helidon.metrics.api.SystemTagsManager; -import io.helidon.nima.servicecommon.HelidonFeatureSupport; -import io.helidon.nima.webserver.KeyPerformanceIndicatorSupport; -import io.helidon.nima.webserver.http.Handler; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpService; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.KeyPerformanceIndicatorSupport; +import io.helidon.webserver.http.Handler; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpService; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; +import io.helidon.webserver.servicecommon.HelidonFeatureSupport; /** - * Support for metrics for Helidon Web Server. + * Support for metrics for Helidon WebServer. * *

      * By defaults creates the /metrics endpoint with three sub-paths: application, @@ -88,7 +88,7 @@ private MetricsFeature(Builder builder) { } /** - * Create an instance to be registered with Web Server with all defaults. + * Create an instance to be registered with WebServer with all defaults. * * @return a new instance built with default values (for context, base * metrics enabled) @@ -98,7 +98,7 @@ public static MetricsFeature create() { } /** - * Create an instance to be registered with Web Server maybe overriding + * Create an instance to be registered with WebServer maybe overriding * default values with configured values. * * @param config Config instance to use to (maybe) override configuration of diff --git a/nima/observe/metrics/src/main/java/io/helidon/nima/observe/metrics/MetricsObserveProvider.java b/webserver/observe/metrics/src/main/java/io/helidon/webserver/observe/metrics/MetricsObserveProvider.java similarity index 92% rename from nima/observe/metrics/src/main/java/io/helidon/nima/observe/metrics/MetricsObserveProvider.java rename to webserver/observe/metrics/src/main/java/io/helidon/webserver/observe/metrics/MetricsObserveProvider.java index e96d10ed4a5..8f0b3321ddb 100644 --- a/nima/observe/metrics/src/main/java/io/helidon/nima/observe/metrics/MetricsObserveProvider.java +++ b/webserver/observe/metrics/src/main/java/io/helidon/webserver/observe/metrics/MetricsObserveProvider.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.observe.metrics; +package io.helidon.webserver.observe.metrics; import io.helidon.common.config.Config; -import io.helidon.common.http.Http; -import io.helidon.nima.observe.spi.ObserveProvider; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.http.Http; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.observe.spi.ObserveProvider; /** * {@link java.util.ServiceLoader} provider implementation for metrics observe provider. @@ -52,7 +52,7 @@ public static ObserveProvider create() { /** * Create using a configured observer. - * In this case configuration provided by the {@link io.helidon.nima.observe.ObserveFeature} is ignored except for + * In this case configuration provided by the {@link io.helidon.webserver.observe.ObserveFeature} is ignored except for * the reserved option {@code endpoint}). * * @param service service to use diff --git a/nima/observe/metrics/src/main/java/io/helidon/nima/observe/metrics/PostRequestMetricsSupport.java b/webserver/observe/metrics/src/main/java/io/helidon/webserver/observe/metrics/PostRequestMetricsSupport.java similarity index 91% rename from nima/observe/metrics/src/main/java/io/helidon/nima/observe/metrics/PostRequestMetricsSupport.java rename to webserver/observe/metrics/src/main/java/io/helidon/webserver/observe/metrics/PostRequestMetricsSupport.java index b6996a71c23..fb3d512a235 100644 --- a/nima/observe/metrics/src/main/java/io/helidon/nima/observe/metrics/PostRequestMetricsSupport.java +++ b/webserver/observe/metrics/src/main/java/io/helidon/webserver/observe/metrics/PostRequestMetricsSupport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.observe.metrics; +package io.helidon.webserver.observe.metrics; import java.util.function.BiConsumer; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; /** * Encapsulates metrics-related post-request processing that other components use and factory methods for creating instances of diff --git a/nima/observe/metrics/src/main/java/io/helidon/nima/observe/metrics/PostRequestMetricsSupportImpl.java b/webserver/observe/metrics/src/main/java/io/helidon/webserver/observe/metrics/PostRequestMetricsSupportImpl.java similarity index 87% rename from nima/observe/metrics/src/main/java/io/helidon/nima/observe/metrics/PostRequestMetricsSupportImpl.java rename to webserver/observe/metrics/src/main/java/io/helidon/webserver/observe/metrics/PostRequestMetricsSupportImpl.java index fa7de18e8cb..322ef7e8a78 100644 --- a/nima/observe/metrics/src/main/java/io/helidon/nima/observe/metrics/PostRequestMetricsSupportImpl.java +++ b/webserver/observe/metrics/src/main/java/io/helidon/webserver/observe/metrics/PostRequestMetricsSupportImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.observe.metrics; +package io.helidon.webserver.observe.metrics; import java.util.ArrayList; import java.util.List; import java.util.function.BiConsumer; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; class PostRequestMetricsSupportImpl implements PostRequestMetricsSupport { diff --git a/webserver/observe/metrics/src/main/java/io/helidon/webserver/observe/metrics/package-info.java b/webserver/observe/metrics/src/main/java/io/helidon/webserver/observe/metrics/package-info.java new file mode 100644 index 00000000000..bd90a006ae4 --- /dev/null +++ b/webserver/observe/metrics/src/main/java/io/helidon/webserver/observe/metrics/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebServer Observability Metrics Support. + */ +package io.helidon.webserver.observe.metrics; diff --git a/webserver/observe/metrics/src/main/java/module-info.java b/webserver/observe/metrics/src/main/java/module-info.java new file mode 100644 index 00000000000..b642b9dac70 --- /dev/null +++ b/webserver/observe/metrics/src/main/java/module-info.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2021, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.common.features.api.Feature; +import io.helidon.common.features.api.HelidonFlavor; +import io.helidon.webserver.observe.metrics.MetricsObserveProvider; +import io.helidon.webserver.observe.spi.ObserveProvider; + +/** + * Helidon WebServer Observability Metrics Support. + */ +@Feature(value = "Metrics", + description = "WebServer Metrics support", + in = HelidonFlavor.SE) +module io.helidon.webserver.observe.metrics { + requires transitive io.helidon.webserver.observe; + requires io.helidon.webserver; + requires io.helidon.http.media.jsonp; + requires io.helidon.servicecommon; + requires static io.helidon.config.metadata; + requires io.helidon.metrics.api; + requires io.helidon.metrics.serviceapi; + requires io.helidon.common.context; + requires io.helidon.common.features.api; + + exports io.helidon.webserver.observe.metrics; + + provides ObserveProvider with MetricsObserveProvider; +} \ No newline at end of file diff --git a/webserver/observe/observe/pom.xml b/webserver/observe/observe/pom.xml new file mode 100644 index 00000000000..450e5aab48c --- /dev/null +++ b/webserver/observe/observe/pom.xml @@ -0,0 +1,55 @@ + + + + 4.0.0 + + io.helidon.webserver.observe + helidon-webserver-observe-project + 4.0.0-SNAPSHOT + + + helidon-webserver-observe + Helidon WebServer Observe + + + + io.helidon.webserver + helidon-webserver + + + io.helidon.webserver + helidon-webserver-cors + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + diff --git a/nima/observe/observe/src/main/java/io/helidon/nima/observe/ObserveFeature.java b/webserver/observe/observe/src/main/java/io/helidon/webserver/observe/ObserveFeature.java similarity index 96% rename from nima/observe/observe/src/main/java/io/helidon/nima/observe/ObserveFeature.java rename to webserver/observe/observe/src/main/java/io/helidon/webserver/observe/ObserveFeature.java index 2443337bbae..d390cbf73ca 100644 --- a/nima/observe/observe/src/main/java/io/helidon/nima/observe/ObserveFeature.java +++ b/webserver/observe/observe/src/main/java/io/helidon/webserver/observe/ObserveFeature.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.observe; +package io.helidon.webserver.observe; import java.util.ArrayList; import java.util.List; @@ -24,12 +24,12 @@ import io.helidon.common.Weighted; import io.helidon.common.config.Config; import io.helidon.common.config.GlobalConfig; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpException; -import io.helidon.nima.observe.spi.ObserveProvider; -import io.helidon.nima.webserver.cors.CorsSupport; -import io.helidon.nima.webserver.http.HttpFeature; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.http.Http; +import io.helidon.http.HttpException; +import io.helidon.webserver.cors.CorsSupport; +import io.helidon.webserver.http.HttpFeature; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.observe.spi.ObserveProvider; /** * Support for all observe providers that are available (or configured). diff --git a/webserver/observe/observe/src/main/java/io/helidon/webserver/observe/package-info.java b/webserver/observe/observe/src/main/java/io/helidon/webserver/observe/package-info.java new file mode 100644 index 00000000000..7b75dad839c --- /dev/null +++ b/webserver/observe/observe/src/main/java/io/helidon/webserver/observe/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebServer Observability Support. + */ +package io.helidon.webserver.observe; diff --git a/nima/observe/observe/src/main/java/io/helidon/nima/observe/spi/ObserveProvider.java b/webserver/observe/observe/src/main/java/io/helidon/webserver/observe/spi/ObserveProvider.java similarity index 95% rename from nima/observe/observe/src/main/java/io/helidon/nima/observe/spi/ObserveProvider.java rename to webserver/observe/observe/src/main/java/io/helidon/webserver/observe/spi/ObserveProvider.java index 027e2692219..f68d2aa8ab6 100644 --- a/nima/observe/observe/src/main/java/io/helidon/nima/observe/spi/ObserveProvider.java +++ b/webserver/observe/observe/src/main/java/io/helidon/webserver/observe/spi/ObserveProvider.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.helidon.nima.observe.spi; +package io.helidon.webserver.observe.spi; import io.helidon.common.config.Config; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.webserver.http.HttpRouting; /** * {@link java.util.ServiceLoader} provider interface for observability services. diff --git a/webserver/observe/observe/src/main/java/io/helidon/webserver/observe/spi/package-info.java b/webserver/observe/observe/src/main/java/io/helidon/webserver/observe/spi/package-info.java new file mode 100644 index 00000000000..3632e650331 --- /dev/null +++ b/webserver/observe/observe/src/main/java/io/helidon/webserver/observe/spi/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebServer Observability SPI. + */ +package io.helidon.webserver.observe.spi; diff --git a/webserver/observe/observe/src/main/java/module-info.java b/webserver/observe/observe/src/main/java/module-info.java new file mode 100644 index 00000000000..4fe22c3c76e --- /dev/null +++ b/webserver/observe/observe/src/main/java/module-info.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.webserver.observe.spi.ObserveProvider; + +/** + * Helidon WebServer Observability Support. + */ +module io.helidon.webserver.observe { + requires transitive io.helidon.config; + requires transitive io.helidon.webserver.cors; + requires io.helidon.http; + requires io.helidon.webserver; + + exports io.helidon.webserver.observe; + exports io.helidon.webserver.observe.spi; + + uses ObserveProvider; +} \ No newline at end of file diff --git a/webserver/observe/pom.xml b/webserver/observe/pom.xml new file mode 100644 index 00000000000..20efe76e499 --- /dev/null +++ b/webserver/observe/pom.xml @@ -0,0 +1,40 @@ + + + + 4.0.0 + + io.helidon.webserver + helidon-webserver-project + 4.0.0-SNAPSHOT + + + io.helidon.webserver.observe + helidon-webserver-observe-project + Helidon Observe Project + pom + + + observe + health + config + info + metrics + log + + diff --git a/webserver/pom.xml b/webserver/pom.xml new file mode 100644 index 00000000000..74cbae3103b --- /dev/null +++ b/webserver/pom.xml @@ -0,0 +1,61 @@ + + + + + 4.0.0 + + io.helidon + helidon-project + 4.0.0-SNAPSHOT + + io.helidon.webserver + helidon-webserver-project + Helidon WebServer Project + pom + + + access-log + benchmark + context + cors + graphql + grpc + http2 + observe + security + service-common + sse + static-content + testing + tracing + webserver + websocket + + + + + tests + + tests + + + + diff --git a/webserver/security/pom.xml b/webserver/security/pom.xml new file mode 100644 index 00000000000..eb83a7784ae --- /dev/null +++ b/webserver/security/pom.xml @@ -0,0 +1,124 @@ + + + + + 4.0.0 + + io.helidon.webserver + helidon-webserver-project + 4.0.0-SNAPSHOT + + + helidon-webserver-security + Helidon WebServer Security + + + + io.helidon.security + helidon-security + + + io.helidon.security.integration + helidon-security-integration-common + + + io.helidon.config + helidon-config + + + io.helidon.webserver + helidon-webserver + provided + + + io.helidon.security + helidon-security-util + + + io.helidon.webserver + helidon-webserver-context + + + io.helidon.config + helidon-config-yaml + test + + + + + io.helidon.security.providers + helidon-security-providers-http-auth + test + + + io.helidon.security.providers + helidon-security-providers-abac + test + + + io.helidon.config + helidon-config-encryption + test + + + io.helidon.bundles + helidon-bundles-config + test + + + io.helidon.webclient + helidon-webclient + test + + + io.helidon.webclient + helidon-webclient-security + test + + + io.helidon.common.testing + helidon-common-testing-junit5 + test + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.mockito + mockito-core + test + + + org.hamcrest + hamcrest-all + test + + + diff --git a/security/integration/nima/src/main/java/io/helidon/security/integration/nima/SecurityFeature.java b/webserver/security/src/main/java/io/helidon/webserver/security/SecurityFeature.java similarity index 93% rename from security/integration/nima/src/main/java/io/helidon/security/integration/nima/SecurityFeature.java rename to webserver/security/src/main/java/io/helidon/webserver/security/SecurityFeature.java index 65593a97edd..36add13be7e 100644 --- a/security/integration/nima/src/main/java/io/helidon/security/integration/nima/SecurityFeature.java +++ b/webserver/security/src/main/java/io/helidon/webserver/security/SecurityFeature.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.security.integration.nima; +package io.helidon.webserver.security; import java.util.HashMap; import java.util.List; @@ -27,30 +27,30 @@ import io.helidon.common.Weighted; import io.helidon.common.context.Context; -import io.helidon.common.http.ForbiddenException; -import io.helidon.common.http.Http; -import io.helidon.common.http.PathMatchers; -import io.helidon.common.http.UnauthorizedException; import io.helidon.config.Config; import io.helidon.config.ConfigValue; -import io.helidon.nima.webserver.http.FilterChain; -import io.helidon.nima.webserver.http.HttpFeature; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.HttpSecurity; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.ForbiddenException; +import io.helidon.http.Http; +import io.helidon.http.PathMatchers; +import io.helidon.http.UnauthorizedException; import io.helidon.security.EndpointConfig; import io.helidon.security.Security; import io.helidon.security.SecurityContext; import io.helidon.security.SecurityEnvironment; import io.helidon.security.SecurityException; import io.helidon.tracing.Span; +import io.helidon.webserver.http.FilterChain; +import io.helidon.webserver.http.HttpFeature; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.HttpSecurity; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; /** - * Integration of security into Web Server. + * Integration of security into WebServer. *

      - * Methods that start with "from" are to register WebSecurity with {@link io.helidon.nima.webserver.WebServer} + * Methods that start with "from" are to register WebSecurity with {@link io.helidon.webserver.WebServer} * - to create {@link SecurityContext} for requests: *

        *
      • {@link #create(Security)}
      • @@ -60,8 +60,8 @@ *

        * Example: *

        - * // Web server routing builder - this is our integration point
        - * {@link io.helidon.nima.webserver.http.HttpRouting} routing = HttpRouting.builder()
        + * // WebServer routing builder - this is our integration point
        + * {@link io.helidon.webserver.http.HttpRouting} routing = HttpRouting.builder()
          * // register the WebSecurity to create context (shared by all routes)
          * .register({@link SecurityFeature}.{@link
          * SecurityFeature#create(Security) from(security)})
        @@ -125,7 +125,7 @@ private SecurityFeature(Security security, Config config, SecurityHandler defaul
         
             /**
              * Create a consumer of routing config to be
        -     * {@link io.helidon.nima.webserver.http.HttpRouting.Builder#register(java.util.function.Supplier[])}  registered} with
        +     * {@link io.helidon.webserver.http.HttpRouting.Builder#register(java.util.function.Supplier[])}  registered} with
              * web server routing to process security requests.
              * This method is to be used together with other routing methods to protect web resources programmatically.
              * Example:
        @@ -143,7 +143,7 @@ public static SecurityFeature create(Security security) {
         
             /**
              * Create a consumer of routing config to be
        -     * {@link io.helidon.nima.webserver.http.HttpRouting.Builder#register(java.util.function.Supplier[])}  registered} with
        +     * {@link io.helidon.webserver.http.HttpRouting.Builder#register(java.util.function.Supplier[])}  registered} with
              * web server routing to process security requests.
              * This method configures security and web server integration from a config instance
              *
        @@ -157,7 +157,7 @@ public static SecurityFeature create(Config config) {
         
             /**
              * Create a consumer of routing config to be
        -     * {@link io.helidon.nima.webserver.http.HttpRouting.Builder#register(java.util.function.Supplier[])}  registered} with
        +     * {@link io.helidon.webserver.http.HttpRouting.Builder#register(java.util.function.Supplier[])}  registered} with
              * web server routing to process security requests.
              * This method expects initialized security and creates web server integration from a config instance
              *
        diff --git a/security/integration/nima/src/main/java/io/helidon/security/integration/nima/SecurityHandler.java b/webserver/security/src/main/java/io/helidon/webserver/security/SecurityHandler.java
        similarity index 98%
        rename from security/integration/nima/src/main/java/io/helidon/security/integration/nima/SecurityHandler.java
        rename to webserver/security/src/main/java/io/helidon/webserver/security/SecurityHandler.java
        index e2fdcbcda89..fe7ad782b0a 100644
        --- a/security/integration/nima/src/main/java/io/helidon/security/integration/nima/SecurityHandler.java
        +++ b/webserver/security/src/main/java/io/helidon/webserver/security/SecurityHandler.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.security.integration.nima;
        +package io.helidon.webserver.security;
         
         import java.util.Arrays;
         import java.util.Collection;
        @@ -33,14 +33,11 @@
         
         import io.helidon.common.context.Context;
         import io.helidon.common.context.Contexts;
        -import io.helidon.common.http.Http;
        -import io.helidon.common.http.RoutedPath;
        -import io.helidon.common.http.ServerResponseHeaders;
         import io.helidon.common.uri.UriQuery;
         import io.helidon.config.Config;
        -import io.helidon.nima.webserver.http.Handler;
        -import io.helidon.nima.webserver.http.ServerRequest;
        -import io.helidon.nima.webserver.http.ServerResponse;
        +import io.helidon.http.Http;
        +import io.helidon.http.RoutedPath;
        +import io.helidon.http.ServerResponseHeaders;
         import io.helidon.security.AuditEvent;
         import io.helidon.security.AuthenticationResponse;
         import io.helidon.security.AuthorizationResponse;
        @@ -59,6 +56,9 @@
         import io.helidon.security.internal.SecurityAuditEvent;
         import io.helidon.security.util.TokenHandler;
         import io.helidon.tracing.SpanContext;
        +import io.helidon.webserver.http.Handler;
        +import io.helidon.webserver.http.ServerRequest;
        +import io.helidon.webserver.http.ServerResponse;
         
         import static io.helidon.security.AuditEvent.AuditParam.plain;
         
        @@ -140,7 +140,7 @@ private SecurityHandler(Builder builder) {
              * 
              * {
              *   #
        -     *   # these are used by {@link SecurityFeature} when loaded from config, to register with {@link io.helidon.nima.webserver.WebServer}
        +     *   # these are used by {@link SecurityFeature} when loaded from config, to register with {@link io.helidon.webserver.WebServer}
              *   #
              *   path = "/noRoles"
              *   methods = ["get"]
        @@ -266,7 +266,7 @@ public void handle(ServerRequest req, ServerResponse res) {
                 Context context = Contexts.context()
                         .orElseThrow(() -> new SecurityException(
                                 "Security requires Context feature to be registered (modules helidon-security-context and "
        -                                + "helidon-nima-webserver-context)"));
        +                                + "helidon-webserver-context)"));
                 //process security
                 SecurityContext securityContext = context
                         .get(SecurityContext.class)
        diff --git a/webserver/security/src/main/java/io/helidon/webserver/security/package-info.java b/webserver/security/src/main/java/io/helidon/webserver/security/package-info.java
        new file mode 100644
        index 00000000000..f7486665dbe
        --- /dev/null
        +++ b/webserver/security/src/main/java/io/helidon/webserver/security/package-info.java
        @@ -0,0 +1,48 @@
        +/*
        + * Copyright (c) 2018, 2023 Oracle and/or its affiliates.
        + *
        + * 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.
        + */
        +
        +/**
        + * Helidon WebServer Security Support.
        + * 

        + * Example of integration (expects an instance of {@link io.helidon.security.Security}): + *

        + * // WebServer routing builder - this is our integration point
        + * {@link io.helidon.webserver.http.HttpRouting} routing = HttpRouting.builder()
        + * // register the WebSecurity to create context (shared by all routes)
        + * .register({@link io.helidon.webserver.security.SecurityFeature}.{@link
        + * io.helidon.webserver.security.SecurityFeature#create(io.helidon.security.Security) from(security)})
        + * // authenticate all paths under /user and require role "user"
        + * .get("/user[/{*}]", WebSecurity.{@link io.helidon.webserver.security.SecurityFeature#authenticate() authenticate()}
        + * .{@link io.helidon.webserver.security.SecurityFeature#rolesAllowed(java.lang.String...) rolesAllowed("user")})
        + * // authenticate "/admin" path and require role "admin"
        + * .get("/admin", WebSecurity.rolesAllowed("admin")
        + * .authenticate()
        + * )
        + * // build a routing instance to start {@link io.helidon.webserver.WebServer} with.
        + * .build();
        + * 
        + * + *

        + * The main security methods are duplicate - first as static methods on {@link io.helidon.webserver.security.SecurityFeature} and + * then as instance methods on {@link io.helidon.webserver.security.SecurityHandler} that is returned by the static methods + * above. This is to provide a single starting point for security integration ({@link io.helidon.webserver.security.SecurityFeature}) + * and fluent API to build the "gate" to each route that is protected. + * + * @see io.helidon.webserver.security.SecurityFeature#create(io.helidon.security.Security) + * @see io.helidon.webserver.security.SecurityFeature#create(io.helidon.config.Config) + * @see io.helidon.webserver.security.SecurityFeature#create(io.helidon.security.Security, io.helidon.config.Config) + */ +package io.helidon.webserver.security; diff --git a/webserver/security/src/main/java/module-info.java b/webserver/security/src/main/java/module-info.java new file mode 100644 index 00000000000..e4d66ee38fb --- /dev/null +++ b/webserver/security/src/main/java/module-info.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebServer Security Support. + */ +module io.helidon.webserver.security { + requires java.logging; + requires jakarta.annotation; + + requires transitive io.helidon.security; + requires transitive io.helidon.security.util; + requires io.helidon.common.context; + requires io.helidon.webserver; + requires io.helidon.security.integration.common; + + exports io.helidon.webserver.security; +} diff --git a/security/integration/nima/src/test/java/io/helidon/security/integration/nima/UnitTestAuditProvider.java b/webserver/security/src/test/java/io/helidon/webserver/security/UnitTestAuditProvider.java similarity index 93% rename from security/integration/nima/src/test/java/io/helidon/security/integration/nima/UnitTestAuditProvider.java rename to webserver/security/src/test/java/io/helidon/webserver/security/UnitTestAuditProvider.java index 2e1b1970427..961c494d7f6 100644 --- a/security/integration/nima/src/test/java/io/helidon/security/integration/nima/UnitTestAuditProvider.java +++ b/webserver/security/src/test/java/io/helidon/webserver/security/UnitTestAuditProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022 Oracle and/or its affiliates. + * Copyright (c) 2018, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.security.integration.nima; +package io.helidon.webserver.security; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; diff --git a/security/integration/nima/src/test/java/io/helidon/security/integration/nima/WebSecurityBuilderGateDefaultsTest.java b/webserver/security/src/test/java/io/helidon/webserver/security/WebSecurityBuilderGateDefaultsTest.java similarity index 92% rename from security/integration/nima/src/test/java/io/helidon/security/integration/nima/WebSecurityBuilderGateDefaultsTest.java rename to webserver/security/src/test/java/io/helidon/webserver/security/WebSecurityBuilderGateDefaultsTest.java index 1f461a88bf7..c2f291de2d0 100644 --- a/security/integration/nima/src/test/java/io/helidon/security/integration/nima/WebSecurityBuilderGateDefaultsTest.java +++ b/webserver/security/src/test/java/io/helidon/webserver/security/WebSecurityBuilderGateDefaultsTest.java @@ -14,26 +14,26 @@ * limitations under the License. */ -package io.helidon.security.integration.nima; +package io.helidon.webserver.security; import java.util.Optional; import java.util.Set; import io.helidon.common.context.Context; import io.helidon.common.context.Contexts; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpMediaTypes; +import io.helidon.http.Http; +import io.helidon.http.HttpMediaTypes; import io.helidon.config.Config; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.api.WebClient; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webclient.security.WebClientSecurity; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.context.ContextFeature; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.api.WebClient; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webclient.security.WebClientSecurity; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.context.ContextFeature; import io.helidon.security.AuditEvent; import io.helidon.security.Security; import io.helidon.security.SecurityContext; diff --git a/security/integration/nima/src/test/java/io/helidon/security/integration/nima/WebSecurityFromConfigTest.java b/webserver/security/src/test/java/io/helidon/webserver/security/WebSecurityFromConfigTest.java similarity index 84% rename from security/integration/nima/src/test/java/io/helidon/security/integration/nima/WebSecurityFromConfigTest.java rename to webserver/security/src/test/java/io/helidon/webserver/security/WebSecurityFromConfigTest.java index dae5e7fe2f4..d3fb45cd726 100644 --- a/security/integration/nima/src/test/java/io/helidon/security/integration/nima/WebSecurityFromConfigTest.java +++ b/webserver/security/src/test/java/io/helidon/webserver/security/WebSecurityFromConfigTest.java @@ -14,20 +14,20 @@ * limitations under the License. */ -package io.helidon.security.integration.nima; +package io.helidon.webserver.security; import java.util.Optional; import io.helidon.common.context.Context; import io.helidon.common.context.Contexts; -import io.helidon.common.http.HttpMediaTypes; +import io.helidon.http.HttpMediaTypes; import io.helidon.config.Config; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.context.ContextFeature; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.context.ContextFeature; import io.helidon.security.Security; import io.helidon.security.SecurityContext; diff --git a/security/integration/nima/src/test/java/io/helidon/security/integration/nima/WebSecurityProgrammaticTest.java b/webserver/security/src/test/java/io/helidon/webserver/security/WebSecurityProgrammaticTest.java similarity index 89% rename from security/integration/nima/src/test/java/io/helidon/security/integration/nima/WebSecurityProgrammaticTest.java rename to webserver/security/src/test/java/io/helidon/webserver/security/WebSecurityProgrammaticTest.java index 0b1490688c5..9f3a1566ac7 100644 --- a/security/integration/nima/src/test/java/io/helidon/security/integration/nima/WebSecurityProgrammaticTest.java +++ b/webserver/security/src/test/java/io/helidon/webserver/security/WebSecurityProgrammaticTest.java @@ -14,22 +14,22 @@ * limitations under the License. */ -package io.helidon.security.integration.nima; +package io.helidon.webserver.security; import java.util.Optional; import java.util.regex.Pattern; import io.helidon.common.context.Context; import io.helidon.common.context.Contexts; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpMediaTypes; +import io.helidon.http.Http; +import io.helidon.http.HttpMediaTypes; import io.helidon.config.Config; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.context.ContextFeature; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.context.ContextFeature; import io.helidon.security.Security; import io.helidon.security.SecurityContext; import io.helidon.security.util.TokenHandler; diff --git a/security/integration/nima/src/test/java/io/helidon/security/integration/nima/WebSecurityQueryParamTest.java b/webserver/security/src/test/java/io/helidon/webserver/security/WebSecurityQueryParamTest.java similarity index 94% rename from security/integration/nima/src/test/java/io/helidon/security/integration/nima/WebSecurityQueryParamTest.java rename to webserver/security/src/test/java/io/helidon/webserver/security/WebSecurityQueryParamTest.java index 3b54e6f999f..d5902fd0cff 100644 --- a/security/integration/nima/src/test/java/io/helidon/security/integration/nima/WebSecurityQueryParamTest.java +++ b/webserver/security/src/test/java/io/helidon/webserver/security/WebSecurityQueryParamTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022 Oracle and/or its affiliates. + * Copyright (c) 2018, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.helidon.security.integration.nima; +package io.helidon.webserver.security; import java.util.List; import java.util.regex.Pattern; import io.helidon.common.uri.UriQuery; -import io.helidon.nima.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerRequest; import io.helidon.security.SecurityContext; import io.helidon.security.SecurityEnvironment; import io.helidon.security.util.TokenHandler; diff --git a/security/integration/nima/src/test/java/io/helidon/security/integration/nima/WebSecurityTestUtil.java b/webserver/security/src/test/java/io/helidon/webserver/security/WebSecurityTestUtil.java similarity index 91% rename from security/integration/nima/src/test/java/io/helidon/security/integration/nima/WebSecurityTestUtil.java rename to webserver/security/src/test/java/io/helidon/webserver/security/WebSecurityTestUtil.java index 8546385c391..2cf6e17d313 100644 --- a/security/integration/nima/src/test/java/io/helidon/security/integration/nima/WebSecurityTestUtil.java +++ b/webserver/security/src/test/java/io/helidon/webserver/security/WebSecurityTestUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022 Oracle and/or its affiliates. + * Copyright (c) 2018, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.security.integration.nima; +package io.helidon.webserver.security; import java.util.logging.ConsoleHandler; import java.util.logging.Level; diff --git a/security/integration/nima/src/test/java/io/helidon/security/integration/nima/WebSecurityTests.java b/webserver/security/src/test/java/io/helidon/webserver/security/WebSecurityTests.java similarity index 94% rename from security/integration/nima/src/test/java/io/helidon/security/integration/nima/WebSecurityTests.java rename to webserver/security/src/test/java/io/helidon/webserver/security/WebSecurityTests.java index 5c2737dfdfb..b67f646104b 100644 --- a/security/integration/nima/src/test/java/io/helidon/security/integration/nima/WebSecurityTests.java +++ b/webserver/security/src/test/java/io/helidon/webserver/security/WebSecurityTests.java @@ -14,17 +14,17 @@ * limitations under the License. */ -package io.helidon.security.integration.nima; +package io.helidon.webserver.security; import java.util.Set; -import io.helidon.common.http.Http; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.api.WebClient; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webclient.security.WebClientSecurity; -import io.helidon.nima.webserver.WebServer; +import io.helidon.http.Http; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.api.WebClient; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webclient.security.WebClientSecurity; +import io.helidon.webserver.WebServer; import io.helidon.security.AuditEvent; import io.helidon.security.Security; import io.helidon.security.providers.httpauth.HttpBasicAuthProvider; diff --git a/webserver/security/src/test/resources/application.yaml b/webserver/security/src/test/resources/application.yaml new file mode 100644 index 00000000000..3b486d791c9 --- /dev/null +++ b/webserver/security/src/test/resources/application.yaml @@ -0,0 +1,68 @@ +# +# Copyright (c) 2016, 2023 Oracle and/or its affiliates. +# +# 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. +# + + +security: + config: + # Configuration of secured config (encryption of passwords in property files) + # Set to true for production - if set to true, clear text passwords will cause failure + require-encryption: false + providers: + - http-basic-auth: + realm: "mic" + users: + - login: "jack" + password: "${CLEAR=jackIsGreat}" + roles: ["user", "admin"] + - login: "jill" + password: "${CLEAR=password}" + roles: ["user"] + - login: "john" + password: "${CLEAR=password}" + - abac: + web-server: + defaults: + query-params: + - name: "jwt" + header: "BEARER_TOKEN" + # looking for first matching group + token-regexp: "bearer (.*)" + # optional alternative - using a prefix + # prefix: "bearer " + - name: "name" + header: "NAME_FROM_REQUEST" + paths: + - path: "/query" + audit: true + - path: "/noRoles" + methods: ["get"] + authenticate: true + - path: "/user[/{*}]" + methods: ["get"] + # implies authentication and authorization + roles-allowed: ["user"] + - path: "/admin" + methods: ["get"] + roles-allowed: ["admin"] + - path: "/deny" + methods: ["get"] + roles-allowed: ["deny"] + - path: "/auditOnly" + # method - any + # audit all methods (by default GET and HEAD are not audited) + audit: true + audit-event-type: "unit_test" + audit-message-format: "Unit test message format" diff --git a/webserver/service-common/pom.xml b/webserver/service-common/pom.xml new file mode 100644 index 00000000000..e4947c52bf5 --- /dev/null +++ b/webserver/service-common/pom.xml @@ -0,0 +1,74 @@ + + + + 4.0.0 + + io.helidon.webserver + helidon-webserver-project + 4.0.0-SNAPSHOT + + + helidon-webserver-service-common + Helidon WebServer Service Common + + + + io.helidon.webserver + helidon-webserver + + + io.helidon.webserver + helidon-webserver-cors + + + io.helidon.config + helidon-config-metadata + true + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + true + + + io.helidon.config + helidon-config-metadata-processor + ${helidon.version} + + + + + + + diff --git a/nima/service-common/src/main/java/io/helidon/nima/servicecommon/FeatureSupport.java b/webserver/service-common/src/main/java/io/helidon/webserver/servicecommon/FeatureSupport.java similarity index 90% rename from nima/service-common/src/main/java/io/helidon/nima/servicecommon/FeatureSupport.java rename to webserver/service-common/src/main/java/io/helidon/webserver/servicecommon/FeatureSupport.java index 224601bc4b9..9c113fe9bc9 100644 --- a/nima/service-common/src/main/java/io/helidon/nima/servicecommon/FeatureSupport.java +++ b/webserver/service-common/src/main/java/io/helidon/webserver/servicecommon/FeatureSupport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.servicecommon; +package io.helidon.webserver.servicecommon; import java.util.Optional; -import io.helidon.nima.webserver.http.HttpFeature; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.http.HttpService; +import io.helidon.webserver.http.HttpFeature; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.http.HttpService; /** * Adds support for features that require a service to be exposed. diff --git a/nima/service-common/src/main/java/io/helidon/nima/servicecommon/HelidonFeatureSupport.java b/webserver/service-common/src/main/java/io/helidon/webserver/servicecommon/HelidonFeatureSupport.java similarity index 95% rename from nima/service-common/src/main/java/io/helidon/nima/servicecommon/HelidonFeatureSupport.java rename to webserver/service-common/src/main/java/io/helidon/webserver/servicecommon/HelidonFeatureSupport.java index e57d71887ba..9575c53718a 100644 --- a/nima/service-common/src/main/java/io/helidon/nima/servicecommon/HelidonFeatureSupport.java +++ b/webserver/service-common/src/main/java/io/helidon/webserver/servicecommon/HelidonFeatureSupport.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.servicecommon; +package io.helidon.webserver.servicecommon; import java.util.Objects; import io.helidon.common.config.Config; import io.helidon.cors.CrossOriginConfig; -import io.helidon.nima.webserver.cors.CorsEnabledServiceHelper; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.http.HttpService; +import io.helidon.webserver.cors.CorsEnabledServiceHelper; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.http.HttpService; /** * Common base implementation for {@linkplain HttpService service} support classes which involve REST endpoints. @@ -69,11 +69,11 @@ protected HelidonFeatureSupport(System.Logger logger, RestServiceSettings restSe * Configures service endpoint on the provided routing rules. This method * just adds the endpoint path (as defaulted or configured). * This method is exclusive to - * {@link #setup(io.helidon.nima.webserver.http.HttpRouting.Builder)} (e.g. you should not + * {@link #setup(io.helidon.webserver.http.HttpRouting.Builder)} (e.g. you should not * use both, as otherwise you would register the endpoint twice) * * @param defaultRouting default routing rules (also accepts - * {@link io.helidon.nima.webserver.http.HttpRouting.Builder} + * {@link io.helidon.webserver.http.HttpRouting.Builder} * @param featureRouting actual rules (if different from default) for the service endpoint */ @Override diff --git a/nima/service-common/src/main/java/io/helidon/nima/servicecommon/RestServiceSettings.java b/webserver/service-common/src/main/java/io/helidon/webserver/servicecommon/RestServiceSettings.java similarity index 97% rename from nima/service-common/src/main/java/io/helidon/nima/servicecommon/RestServiceSettings.java rename to webserver/service-common/src/main/java/io/helidon/webserver/servicecommon/RestServiceSettings.java index 48e31eac687..ea8e342b49d 100644 --- a/nima/service-common/src/main/java/io/helidon/nima/servicecommon/RestServiceSettings.java +++ b/webserver/service-common/src/main/java/io/helidon/webserver/servicecommon/RestServiceSettings.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.servicecommon; +package io.helidon.webserver.servicecommon; import io.helidon.config.Config; import io.helidon.config.metadata.Configured; import io.helidon.config.metadata.ConfiguredOption; import io.helidon.cors.CrossOriginConfig; -import io.helidon.nima.webserver.cors.CorsEnabledServiceHelper; +import io.helidon.webserver.cors.CorsEnabledServiceHelper; /** * Common settings across REST services. diff --git a/nima/service-common/src/main/java/io/helidon/nima/servicecommon/RestServiceSettingsImpl.java b/webserver/service-common/src/main/java/io/helidon/webserver/servicecommon/RestServiceSettingsImpl.java similarity index 98% rename from nima/service-common/src/main/java/io/helidon/nima/servicecommon/RestServiceSettingsImpl.java rename to webserver/service-common/src/main/java/io/helidon/webserver/servicecommon/RestServiceSettingsImpl.java index bdd12466675..f8ead48381c 100644 --- a/nima/service-common/src/main/java/io/helidon/nima/servicecommon/RestServiceSettingsImpl.java +++ b/webserver/service-common/src/main/java/io/helidon/webserver/servicecommon/RestServiceSettingsImpl.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.servicecommon; +package io.helidon.webserver.servicecommon; import java.util.Objects; diff --git a/webserver/service-common/src/main/java/io/helidon/webserver/servicecommon/package-info.java b/webserver/service-common/src/main/java/io/helidon/webserver/servicecommon/package-info.java new file mode 100644 index 00000000000..4d354a0787e --- /dev/null +++ b/webserver/service-common/src/main/java/io/helidon/webserver/servicecommon/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebServer Services Common. + */ +package io.helidon.webserver.servicecommon; diff --git a/webserver/service-common/src/main/java/module-info.java b/webserver/service-common/src/main/java/module-info.java new file mode 100644 index 00000000000..4fd592971a6 --- /dev/null +++ b/webserver/service-common/src/main/java/module-info.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebServer Services Common. + */ +module io.helidon.servicecommon { + requires transitive io.helidon.config; + requires static io.helidon.config.metadata; + requires transitive io.helidon.cors; + requires transitive io.helidon.webserver; + requires transitive io.helidon.webserver.cors; + + exports io.helidon.webserver.servicecommon; + +} diff --git a/nima/service-common/src/test/java/io/helidon/nima/servicecommon/TestSettings.java b/webserver/service-common/src/test/java/io/helidon/webserver/servicecommon/TestSettings.java similarity index 98% rename from nima/service-common/src/test/java/io/helidon/nima/servicecommon/TestSettings.java rename to webserver/service-common/src/test/java/io/helidon/webserver/servicecommon/TestSettings.java index 3ddab9a7c16..dbd7c5f43e2 100644 --- a/nima/service-common/src/test/java/io/helidon/nima/servicecommon/TestSettings.java +++ b/webserver/service-common/src/test/java/io/helidon/webserver/servicecommon/TestSettings.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.servicecommon; +package io.helidon.webserver.servicecommon; import java.util.Map; diff --git a/webserver/sse/pom.xml b/webserver/sse/pom.xml new file mode 100644 index 00000000000..16bdd15212e --- /dev/null +++ b/webserver/sse/pom.xml @@ -0,0 +1,114 @@ + + + + 4.0.0 + + io.helidon.webserver + helidon-webserver-project + 4.0.0-SNAPSHOT + + + helidon-webserver-sse + Helidon WebServer SSE + + + + io.helidon.webserver + helidon-webserver + + + io.helidon.http + helidon-http-sse + + + io.helidon.common.features + helidon-common-features-api + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + org.mockito + mockito-core + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + io.helidon.builder + helidon-builder-processor + ${helidon.version} + + + io.helidon.config + helidon-config-metadata-processor + ${helidon.version} + + + io.helidon.common.processor + helidon-common-processor-helidon-copyright + ${helidon.version} + + + + + + io.helidon.builder + helidon-builder-processor + ${helidon.version} + + + io.helidon.config + helidon-config-metadata-processor + ${helidon.version} + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + io.helidon.common.processor + helidon-common-processor-helidon-copyright + ${helidon.version} + + + + + + diff --git a/nima/sse/webserver/src/main/java/io/helidon/nima/sse/webserver/SseSink.java b/webserver/sse/src/main/java/io/helidon/webserver/sse/SseSink.java similarity index 92% rename from nima/sse/webserver/src/main/java/io/helidon/nima/sse/webserver/SseSink.java rename to webserver/sse/src/main/java/io/helidon/webserver/sse/SseSink.java index 09558b89a39..85d03327e99 100644 --- a/nima/sse/webserver/src/main/java/io/helidon/nima/sse/webserver/SseSink.java +++ b/webserver/sse/src/main/java/io/helidon/webserver/sse/SseSink.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.sse.webserver; +package io.helidon.webserver.sse; import java.io.IOException; import java.io.OutputStream; @@ -24,15 +24,15 @@ import java.util.function.BiConsumer; import io.helidon.common.GenericType; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpMediaType; import io.helidon.common.media.type.MediaType; import io.helidon.common.media.type.MediaTypes; -import io.helidon.nima.sse.SseEvent; -import io.helidon.nima.webserver.http.ServerResponse; -import io.helidon.nima.webserver.http.spi.Sink; +import io.helidon.http.Http; +import io.helidon.http.HttpMediaType; +import io.helidon.http.sse.SseEvent; +import io.helidon.webserver.http.ServerResponse; +import io.helidon.webserver.http.spi.Sink; -import static io.helidon.common.http.Http.Headers.CONTENT_TYPE_EVENT_STREAM; +import static io.helidon.http.Http.Headers.CONTENT_TYPE_EVENT_STREAM; /** * Implementation of an SSE sink. Emits {@link SseEvent}s. diff --git a/nima/sse/webserver/src/main/java/io/helidon/nima/sse/webserver/SseSinkProvider.java b/webserver/sse/src/main/java/io/helidon/webserver/sse/SseSinkProvider.java similarity index 83% rename from nima/sse/webserver/src/main/java/io/helidon/nima/sse/webserver/SseSinkProvider.java rename to webserver/sse/src/main/java/io/helidon/webserver/sse/SseSinkProvider.java index d42823293eb..466a1d5d126 100644 --- a/nima/sse/webserver/src/main/java/io/helidon/nima/sse/webserver/SseSinkProvider.java +++ b/webserver/sse/src/main/java/io/helidon/webserver/sse/SseSinkProvider.java @@ -14,18 +14,18 @@ * limitations under the License. */ -package io.helidon.nima.sse.webserver; +package io.helidon.webserver.sse; import java.util.function.BiConsumer; import io.helidon.common.GenericType; import io.helidon.common.media.type.MediaType; import io.helidon.common.media.type.MediaTypes; -import io.helidon.nima.sse.SseEvent; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; -import io.helidon.nima.webserver.http.spi.Sink; -import io.helidon.nima.webserver.http.spi.SinkProvider; +import io.helidon.http.sse.SseEvent; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; +import io.helidon.webserver.http.spi.Sink; +import io.helidon.webserver.http.spi.SinkProvider; /** * Sink provider for SSE type. diff --git a/webserver/sse/src/main/java/io/helidon/webserver/sse/package-info.java b/webserver/sse/src/main/java/io/helidon/webserver/sse/package-info.java new file mode 100644 index 00000000000..45a34a2d267 --- /dev/null +++ b/webserver/sse/src/main/java/io/helidon/webserver/sse/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebServer SSE Support. + */ +package io.helidon.webserver.sse; diff --git a/webserver/sse/src/main/java/module-info.java b/webserver/sse/src/main/java/module-info.java new file mode 100644 index 00000000000..5d3efa4f32f --- /dev/null +++ b/webserver/sse/src/main/java/module-info.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.common.features.api.Feature; +import io.helidon.common.features.api.HelidonFlavor; +import io.helidon.webserver.sse.SseSinkProvider; +import io.helidon.webserver.http.spi.SinkProvider; + +/** + * Helidon WebServer SSE Support. + */ +@Feature(value = "SSE", + description = "WebServer SSE support", + in = HelidonFlavor.SE, + path = {"WebServer", "SSE"} +) +module io.helidon.webserver.sse { + requires static io.helidon.common.features.api; + + requires transitive io.helidon.common; + requires transitive io.helidon.webserver; + requires transitive io.helidon.http.sse; + + exports io.helidon.webserver.sse; + + provides SinkProvider with SseSinkProvider; +} diff --git a/webserver/static-content/etc/spotbugs/exclude.xml b/webserver/static-content/etc/spotbugs/exclude.xml new file mode 100644 index 00000000000..b88fd4ce2e8 --- /dev/null +++ b/webserver/static-content/etc/spotbugs/exclude.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/webserver/static-content/pom.xml b/webserver/static-content/pom.xml new file mode 100644 index 00000000000..6a7d5c7eff8 --- /dev/null +++ b/webserver/static-content/pom.xml @@ -0,0 +1,83 @@ + + + + 4.0.0 + + io.helidon.webserver + helidon-webserver-project + 4.0.0-SNAPSHOT + + + helidon-webserver-static-content + Helidon Server Static Content + + + etc/spotbugs/exclude.xml + + + + + io.helidon.webserver + helidon-webserver + + + io.helidon.common.features + helidon-common-features-api + true + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + org.mockito + mockito-core + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + + + + + diff --git a/nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/ByteRangeRequest.java b/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/ByteRangeRequest.java similarity index 90% rename from nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/ByteRangeRequest.java rename to webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/ByteRangeRequest.java index db94ef7686b..04412ab3690 100644 --- a/nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/ByteRangeRequest.java +++ b/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/ByteRangeRequest.java @@ -14,19 +14,19 @@ * limitations under the License. */ -package io.helidon.nima.webserver.staticcontent; +package io.helidon.webserver.staticcontent; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; -import io.helidon.common.http.BadRequestException; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderNames; -import io.helidon.common.http.HttpException; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.BadRequestException; +import io.helidon.http.Http; +import io.helidon.http.Http.HeaderNames; +import io.helidon.http.HttpException; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; record ByteRangeRequest(long fileLength, long offset, long length) { private static final Pattern RANGE_PATTERN = Pattern.compile("(\\d+)?-(\\d+)?(?:, )?"); diff --git a/nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/CachedHandler.java b/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/CachedHandler.java similarity index 79% rename from nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/CachedHandler.java rename to webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/CachedHandler.java index f196e57874a..0ae80637d6b 100644 --- a/nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/CachedHandler.java +++ b/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/CachedHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.nima.webserver.staticcontent; +package io.helidon.webserver.staticcontent; import java.io.IOException; import io.helidon.common.configurable.LruCache; -import io.helidon.common.http.Http; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.Http; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; interface CachedHandler { boolean handle(LruCache cache, diff --git a/nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/CachedHandlerInMemory.java b/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/CachedHandlerInMemory.java similarity index 87% rename from nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/CachedHandlerInMemory.java rename to webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/CachedHandlerInMemory.java index bf860a1105c..caa285366f8 100644 --- a/nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/CachedHandlerInMemory.java +++ b/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/CachedHandlerInMemory.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webserver.staticcontent; +package io.helidon.webserver.staticcontent; import java.time.Instant; import java.util.Arrays; @@ -22,16 +22,16 @@ import java.util.function.BiConsumer; import io.helidon.common.configurable.LruCache; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpException; -import io.helidon.common.http.ServerRequestHeaders; -import io.helidon.common.http.ServerResponseHeaders; import io.helidon.common.media.type.MediaType; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.Http; +import io.helidon.http.HttpException; +import io.helidon.http.ServerRequestHeaders; +import io.helidon.http.ServerResponseHeaders; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; -import static io.helidon.nima.webserver.staticcontent.StaticContentHandler.processEtag; -import static io.helidon.nima.webserver.staticcontent.StaticContentHandler.processModifyHeaders; +import static io.helidon.webserver.staticcontent.StaticContentHandler.processEtag; +import static io.helidon.webserver.staticcontent.StaticContentHandler.processModifyHeaders; record CachedHandlerInMemory(MediaType mediaType, Instant lastModified, diff --git a/nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/CachedHandlerJar.java b/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/CachedHandlerJar.java similarity index 75% rename from nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/CachedHandlerJar.java rename to webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/CachedHandlerJar.java index 377df71ff6e..847a3986388 100644 --- a/nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/CachedHandlerJar.java +++ b/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/CachedHandlerJar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ */ -package io.helidon.nima.webserver.staticcontent; +package io.helidon.webserver.staticcontent; import java.io.IOException; import java.nio.file.Files; @@ -24,16 +24,14 @@ import java.util.function.BiConsumer; import io.helidon.common.configurable.LruCache; -import io.helidon.common.http.Http; -import io.helidon.common.http.ServerResponseHeaders; import io.helidon.common.media.type.MediaType; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.Http; +import io.helidon.http.ServerResponseHeaders; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; -import static io.helidon.nima.webserver.staticcontent.FileBasedContentHandler.contentLength; -import static io.helidon.nima.webserver.staticcontent.FileBasedContentHandler.send; -import static io.helidon.nima.webserver.staticcontent.StaticContentHandler.processEtag; -import static io.helidon.nima.webserver.staticcontent.StaticContentHandler.processModifyHeaders; +import static io.helidon.webserver.staticcontent.StaticContentHandler.processEtag; +import static io.helidon.webserver.staticcontent.StaticContentHandler.processModifyHeaders; record CachedHandlerJar(Path path, MediaType mediaType, @@ -68,9 +66,9 @@ public boolean handle(LruCache cache, response.headers().contentType(mediaType); if (method == Http.Method.GET) { - send(request, response, path); + FileBasedContentHandler.send(request, response, path); } else { - response.headers().contentLength(contentLength(path)); + response.headers().contentLength(FileBasedContentHandler.contentLength(path)); response.send(); } diff --git a/nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/CachedHandlerPath.java b/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/CachedHandlerPath.java similarity index 76% rename from nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/CachedHandlerPath.java rename to webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/CachedHandlerPath.java index 79da93b4c97..fafbddf3d0b 100644 --- a/nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/CachedHandlerPath.java +++ b/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/CachedHandlerPath.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webserver.staticcontent; +package io.helidon.webserver.staticcontent; import java.io.IOException; import java.nio.file.Files; @@ -24,17 +24,15 @@ import java.util.function.BiConsumer; import io.helidon.common.configurable.LruCache; -import io.helidon.common.http.ForbiddenException; -import io.helidon.common.http.Http; -import io.helidon.common.http.ServerResponseHeaders; import io.helidon.common.media.type.MediaType; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.ForbiddenException; +import io.helidon.http.Http; +import io.helidon.http.ServerResponseHeaders; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; -import static io.helidon.nima.webserver.staticcontent.FileBasedContentHandler.processContentLength; -import static io.helidon.nima.webserver.staticcontent.FileBasedContentHandler.send; -import static io.helidon.nima.webserver.staticcontent.StaticContentHandler.processEtag; -import static io.helidon.nima.webserver.staticcontent.StaticContentHandler.processModifyHeaders; +import static io.helidon.webserver.staticcontent.StaticContentHandler.processEtag; +import static io.helidon.webserver.staticcontent.StaticContentHandler.processModifyHeaders; record CachedHandlerPath(Path path, MediaType mediaType, @@ -72,9 +70,9 @@ public boolean handle(LruCache cache, response.headers().contentType(mediaType); if (method == Http.Method.GET) { - send(request, response, path); + FileBasedContentHandler.send(request, response, path); } else { - processContentLength(path, response.headers()); + FileBasedContentHandler.processContentLength(path, response.headers()); response.send(); } diff --git a/nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/CachedHandlerRedirect.java b/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/CachedHandlerRedirect.java similarity index 89% rename from nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/CachedHandlerRedirect.java rename to webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/CachedHandlerRedirect.java index 41eed3d8137..c4c21d274f6 100644 --- a/nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/CachedHandlerRedirect.java +++ b/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/CachedHandlerRedirect.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package io.helidon.nima.webserver.staticcontent; +package io.helidon.webserver.staticcontent; import java.io.IOException; import io.helidon.common.configurable.LruCache; -import io.helidon.common.http.Http; import io.helidon.common.uri.UriQuery; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.Http; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; record CachedHandlerRedirect(String location) implements CachedHandler { @Override diff --git a/nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/CachedHandlerUrlStream.java b/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/CachedHandlerUrlStream.java similarity index 76% rename from nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/CachedHandlerUrlStream.java rename to webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/CachedHandlerUrlStream.java index 1cbff0e7c48..a27ba343497 100644 --- a/nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/CachedHandlerUrlStream.java +++ b/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/CachedHandlerUrlStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webserver.staticcontent; +package io.helidon.webserver.staticcontent; import java.io.IOException; import java.io.InputStream; @@ -24,13 +24,10 @@ import java.time.Instant; import io.helidon.common.configurable.LruCache; -import io.helidon.common.http.Http; import io.helidon.common.media.type.MediaType; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; - -import static io.helidon.nima.webserver.staticcontent.StaticContentHandler.processEtag; -import static io.helidon.nima.webserver.staticcontent.StaticContentHandler.processModifyHeaders; +import io.helidon.http.Http; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; record CachedHandlerUrlStream(MediaType mediaType, URL url) implements CachedHandler { private static final System.Logger LOGGER = System.getLogger(CachedHandlerUrlStream.class.getName()); @@ -50,8 +47,8 @@ public boolean handle(LruCache cache, long lastModified = urlConnection.getLastModified(); if (lastModified != 0) { - processEtag(String.valueOf(lastModified), request.headers(), response.headers()); - processModifyHeaders(Instant.ofEpochMilli(lastModified), request.headers(), response.headers()); + StaticContentHandler.processEtag(String.valueOf(lastModified), request.headers(), response.headers()); + StaticContentHandler.processModifyHeaders(Instant.ofEpochMilli(lastModified), request.headers(), response.headers()); } response.headers().contentType(mediaType); diff --git a/nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/ClassPathContentHandler.java b/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/ClassPathContentHandler.java similarity index 98% rename from nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/ClassPathContentHandler.java rename to webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/ClassPathContentHandler.java index ff4431b6238..0ce94da0d45 100644 --- a/nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/ClassPathContentHandler.java +++ b/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/ClassPathContentHandler.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webserver.staticcontent; +package io.helidon.webserver.staticcontent; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -39,11 +39,11 @@ import java.util.jar.JarEntry; import java.util.jar.JarFile; -import io.helidon.common.http.Http; -import io.helidon.common.http.InternalServerException; import io.helidon.common.media.type.MediaType; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.Http; +import io.helidon.http.InternalServerException; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; /** * Handles static content from the classpath. diff --git a/nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/FileBasedContentHandler.java b/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/FileBasedContentHandler.java similarity index 93% rename from nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/FileBasedContentHandler.java rename to webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/FileBasedContentHandler.java index f7ecba07716..196f646216f 100644 --- a/nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/FileBasedContentHandler.java +++ b/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/FileBasedContentHandler.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webserver.staticcontent; +package io.helidon.webserver.staticcontent; import java.io.IOException; import java.io.InputStream; @@ -32,14 +32,14 @@ import java.util.Objects; import java.util.Optional; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderNames; -import io.helidon.common.http.ServerRequestHeaders; -import io.helidon.common.http.ServerResponseHeaders; import io.helidon.common.media.type.MediaType; import io.helidon.common.media.type.MediaTypes; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.Http; +import io.helidon.http.Http.HeaderNames; +import io.helidon.http.ServerRequestHeaders; +import io.helidon.http.ServerResponseHeaders; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; abstract class FileBasedContentHandler extends StaticContentHandler { private final Map customMediaTypes; @@ -166,12 +166,12 @@ static Optional lastModified(Path path) throws IOException { } /** - * Find welcome file in provided directory or throw not found {@link io.helidon.common.http.RequestException}. + * Find welcome file in provided directory or throw not found {@link io.helidon.http.RequestException}. * * @param directory a directory to find in * @param name welcome file name * @return a path of the welcome file - * @throws io.helidon.common.http.RequestException if welcome file doesn't exists + * @throws io.helidon.http.RequestException if welcome file doesn't exists */ static Path resolveWelcomeFile(Path directory, String name) { throwNotFoundIf(name == null || name.isEmpty()); diff --git a/nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/FileSystemContentHandler.java b/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/FileSystemContentHandler.java similarity index 96% rename from nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/FileSystemContentHandler.java rename to webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/FileSystemContentHandler.java index a8810236bfc..aec4bf5a605 100644 --- a/nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/FileSystemContentHandler.java +++ b/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/FileSystemContentHandler.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webserver.staticcontent; +package io.helidon.webserver.staticcontent; import java.io.IOException; import java.lang.System.Logger.Level; @@ -25,10 +25,10 @@ import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; -import io.helidon.common.http.Http; -import io.helidon.common.http.ServerResponseHeaders; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.Http; +import io.helidon.http.ServerResponseHeaders; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; /** * Serves files from the filesystem as a static WEB content. diff --git a/nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/IoFunction.java b/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/IoFunction.java similarity index 87% rename from nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/IoFunction.java rename to webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/IoFunction.java index b08d2f93a98..4e58c3a797b 100644 --- a/nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/IoFunction.java +++ b/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/IoFunction.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webserver.staticcontent; +package io.helidon.webserver.staticcontent; import java.io.IOException; diff --git a/nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/SingleFileContentHandler.java b/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/SingleFileContentHandler.java similarity index 92% rename from nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/SingleFileContentHandler.java rename to webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/SingleFileContentHandler.java index 9266280c14b..9290dbd7004 100644 --- a/nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/SingleFileContentHandler.java +++ b/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/SingleFileContentHandler.java @@ -14,17 +14,17 @@ * limitations under the License. */ -package io.helidon.nima.webserver.staticcontent; +package io.helidon.webserver.staticcontent; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.Optional; -import io.helidon.common.http.Http; -import io.helidon.common.http.ServerResponseHeaders; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.Http; +import io.helidon.http.ServerResponseHeaders; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; class SingleFileContentHandler extends FileBasedContentHandler { private static final System.Logger LOGGER = System.getLogger(SingleFileContentHandler.class.getName()); diff --git a/nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/StaticContentHandler.java b/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/StaticContentHandler.java similarity index 93% rename from nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/StaticContentHandler.java rename to webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/StaticContentHandler.java index ecbd9414404..dfc9fef4fa5 100644 --- a/nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/StaticContentHandler.java +++ b/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/StaticContentHandler.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webserver.staticcontent; +package io.helidon.webserver.staticcontent; import java.io.IOException; import java.lang.System.Logger.Level; @@ -32,18 +32,18 @@ import java.util.function.Function; import io.helidon.common.configurable.LruCache; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderNames; -import io.helidon.common.http.HttpException; -import io.helidon.common.http.InternalServerException; -import io.helidon.common.http.NotFoundException; -import io.helidon.common.http.PathMatchers; -import io.helidon.common.http.ServerRequestHeaders; -import io.helidon.common.http.ServerResponseHeaders; import io.helidon.common.media.type.MediaType; -import io.helidon.nima.webserver.http.HttpRules; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.http.Http; +import io.helidon.http.Http.HeaderNames; +import io.helidon.http.HttpException; +import io.helidon.http.InternalServerException; +import io.helidon.http.NotFoundException; +import io.helidon.http.PathMatchers; +import io.helidon.http.ServerRequestHeaders; +import io.helidon.http.ServerResponseHeaders; +import io.helidon.webserver.http.HttpRules; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; /** * Base implementation of static content support. @@ -70,7 +70,7 @@ abstract class StaticContentHandler implements StaticContentService { * @param etag the proposed ETag. If {@code null} then method returns false * @param requestHeaders an HTTP request headers * @param responseHeaders an HTTP response headers - * @throws io.helidon.common.http.RequestException if ETag is checked + * @throws io.helidon.http.RequestException if ETag is checked */ static void processEtag(String etag, ServerRequestHeaders requestHeaders, ServerResponseHeaders responseHeaders) { if (etag == null || etag.isEmpty()) { @@ -143,7 +143,7 @@ static void processModifyHeaders(Instant modified, * @param modified the last modification instance. If {@code null} then method just returns {@code false}. * @param requestHeaders an HTTP request headers * @param responseHeaders an HTTP response headers - * @throws io.helidon.common.http.RequestException if (un)modify since header is checked + * @throws io.helidon.http.RequestException if (un)modify since header is checked */ static void processModifyHeaders(Instant modified, ServerRequestHeaders requestHeaders, @@ -152,10 +152,10 @@ static void processModifyHeaders(Instant modified, } /** - * If provided {@code condition} is {@code true} then throws not found {@link io.helidon.common.http.RequestException}. + * If provided {@code condition} is {@code true} then throws not found {@link io.helidon.http.RequestException}. * * @param condition if condition is true then throws an exception otherwise not - * @throws io.helidon.common.http.RequestException if {@code condition} parameter is {@code true}. + * @throws io.helidon.http.RequestException if {@code condition} parameter is {@code true}. */ static void throwNotFoundIf(boolean condition) { if (condition) { @@ -239,7 +239,7 @@ void handle(ServerRequest request, ServerResponse response) { * @param mapped whether the requestedPath is mapped using a mapping function (and differs from defined path) * @return {@code true} only if static content was found and processed. * @throws java.io.IOException if resource is not acceptable - * @throws io.helidon.common.http.RequestException if some known WEB error + * @throws io.helidon.http.RequestException if some known WEB error */ abstract boolean doHandle(Http.Method method, String requestedPath, diff --git a/nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/StaticContentService.java b/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/StaticContentService.java similarity index 97% rename from nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/StaticContentService.java rename to webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/StaticContentService.java index 7819c127ab4..649304d5b6e 100644 --- a/nima/webserver/static-content/src/main/java/io/helidon/nima/webserver/staticcontent/StaticContentService.java +++ b/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/StaticContentService.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webserver.staticcontent; +package io.helidon.webserver.staticcontent; import java.nio.file.Files; import java.nio.file.Path; @@ -27,13 +27,13 @@ import io.helidon.common.configurable.LruCache; import io.helidon.common.media.type.MediaType; -import io.helidon.nima.webserver.http.HttpService; +import io.helidon.webserver.http.HttpService; /** * Serves 'static content' (files) from filesystem or using a classloader to the - * {@link io.helidon.nima.webserver.WebServer WebServer} - * {@link io.helidon.nima.webserver.http.HttpRouting}. It is possible to - * {@link io.helidon.nima.webserver.http.HttpRouting.Builder#register(java.util.function.Supplier[]) register} it on the routing. + * {@link io.helidon.webserver.WebServer WebServer} + * {@link io.helidon.webserver.http.HttpRouting}. It is possible to + * {@link io.helidon.webserver.http.HttpRouting.Builder#register(java.util.function.Supplier[]) register} it on the routing. *

        {@code
          * // Serve content of attached '/static/pictures' on '/pics'
          * Routing.builder()
        diff --git a/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/package-info.java b/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/package-info.java
        new file mode 100644
        index 00000000000..aefbc975dba
        --- /dev/null
        +++ b/webserver/static-content/src/main/java/io/helidon/webserver/staticcontent/package-info.java
        @@ -0,0 +1,21 @@
        +/*
        + * Copyright (c) 2021, 2023 Oracle and/or its affiliates.
        + *
        + * 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.
        + */
        +
        +/**
        + * Helidon WebServer Static Content Support.
        + * @see io.helidon.webserver.staticcontent.StaticContentService
        + */
        +package io.helidon.webserver.staticcontent;
        diff --git a/webserver/static-content/src/main/java/module-info.java b/webserver/static-content/src/main/java/module-info.java
        new file mode 100644
        index 00000000000..a77cc38aa34
        --- /dev/null
        +++ b/webserver/static-content/src/main/java/module-info.java
        @@ -0,0 +1,35 @@
        +/*
        + * Copyright (c) 2022, 2023 Oracle and/or its affiliates.
        + *
        + * 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.
        + */
        +
        +import io.helidon.common.features.api.Feature;
        +import io.helidon.common.features.api.HelidonFlavor;
        +
        +/**
        + * Helidon WebServer Static Content Support.
        + */
        +@Feature(value = "Static Content",
        +         description = "WebServer Static content support",
        +         in = HelidonFlavor.SE,
        +         path = {"WebServer", "Static Content"}
        +)
        +module io.helidon.webserver.staticcontent {
        +    requires static io.helidon.common.features.api;
        +
        +    requires transitive io.helidon.webserver;
        +    requires transitive io.helidon.common.configurable;
        +
        +    exports io.helidon.webserver.staticcontent;
        +}
        \ No newline at end of file
        diff --git a/nima/webserver/static-content/src/test/java/io/helidon/nima/webserver/staticcontent/ByteRangeRequestTest.java b/webserver/static-content/src/test/java/io/helidon/webserver/staticcontent/ByteRangeRequestTest.java
        similarity index 94%
        rename from nima/webserver/static-content/src/test/java/io/helidon/nima/webserver/staticcontent/ByteRangeRequestTest.java
        rename to webserver/static-content/src/test/java/io/helidon/webserver/staticcontent/ByteRangeRequestTest.java
        index 011ac337b28..c0b6a2d7404 100644
        --- a/nima/webserver/static-content/src/test/java/io/helidon/nima/webserver/staticcontent/ByteRangeRequestTest.java
        +++ b/webserver/static-content/src/test/java/io/helidon/webserver/staticcontent/ByteRangeRequestTest.java
        @@ -14,15 +14,15 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.webserver.staticcontent;
        +package io.helidon.webserver.staticcontent;
         
         import java.util.List;
         
        -import io.helidon.common.http.Http;
        -import io.helidon.common.http.Http.Header;
        -import io.helidon.common.http.Http.HeaderNames;
        -import io.helidon.nima.webserver.http.ServerRequest;
        -import io.helidon.nima.webserver.http.ServerResponse;
        +import io.helidon.http.Http;
        +import io.helidon.http.Http.Header;
        +import io.helidon.http.Http.HeaderNames;
        +import io.helidon.webserver.http.ServerRequest;
        +import io.helidon.webserver.http.ServerResponse;
         
         import org.hamcrest.collection.IsCollectionWithSize;
         import org.junit.jupiter.api.Test;
        diff --git a/nima/webserver/static-content/src/test/java/io/helidon/nima/webserver/staticcontent/CachedHandlerTest.java b/webserver/static-content/src/test/java/io/helidon/webserver/staticcontent/CachedHandlerTest.java
        similarity index 97%
        rename from nima/webserver/static-content/src/test/java/io/helidon/nima/webserver/staticcontent/CachedHandlerTest.java
        rename to webserver/static-content/src/test/java/io/helidon/webserver/staticcontent/CachedHandlerTest.java
        index 429930879e0..0bf7c1bef7b 100644
        --- a/nima/webserver/static-content/src/test/java/io/helidon/nima/webserver/staticcontent/CachedHandlerTest.java
        +++ b/webserver/static-content/src/test/java/io/helidon/webserver/staticcontent/CachedHandlerTest.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.webserver.staticcontent;
        +package io.helidon.webserver.staticcontent;
         
         import java.io.ByteArrayOutputStream;
         import java.io.IOException;
        @@ -23,15 +23,15 @@
         import java.util.Optional;
         
         import io.helidon.common.buffers.BufferData;
        -import io.helidon.common.http.Http;
        -import io.helidon.common.http.HttpPrologue;
        -import io.helidon.common.http.ServerRequestHeaders;
        -import io.helidon.common.http.ServerResponseHeaders;
        +import io.helidon.http.Http;
        +import io.helidon.http.HttpPrologue;
        +import io.helidon.http.ServerRequestHeaders;
        +import io.helidon.http.ServerResponseHeaders;
         import io.helidon.common.media.type.MediaType;
         import io.helidon.common.media.type.MediaTypes;
         import io.helidon.common.uri.UriQuery;
        -import io.helidon.nima.webserver.http.ServerRequest;
        -import io.helidon.nima.webserver.http.ServerResponse;
        +import io.helidon.webserver.http.ServerRequest;
        +import io.helidon.webserver.http.ServerResponse;
         
         import org.junit.jupiter.api.BeforeAll;
         import org.junit.jupiter.api.Test;
        diff --git a/nima/webserver/static-content/src/test/java/io/helidon/nima/webserver/staticcontent/StaticContentHandlerTest.java b/webserver/static-content/src/test/java/io/helidon/webserver/staticcontent/StaticContentHandlerTest.java
        similarity index 94%
        rename from nima/webserver/static-content/src/test/java/io/helidon/nima/webserver/staticcontent/StaticContentHandlerTest.java
        rename to webserver/static-content/src/test/java/io/helidon/webserver/staticcontent/StaticContentHandlerTest.java
        index a07e510f2fd..84e1be74b27 100644
        --- a/nima/webserver/static-content/src/test/java/io/helidon/nima/webserver/staticcontent/StaticContentHandlerTest.java
        +++ b/webserver/static-content/src/test/java/io/helidon/webserver/staticcontent/StaticContentHandlerTest.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.webserver.staticcontent;
        +package io.helidon.webserver.staticcontent;
         
         import java.io.IOException;
         import java.net.URISyntaxException;
        @@ -25,26 +25,26 @@
         import java.util.concurrent.atomic.AtomicInteger;
         
         import io.helidon.common.configurable.LruCache;
        -import io.helidon.common.http.Http;
        -import io.helidon.common.http.HttpException;
        -import io.helidon.common.http.HttpPrologue;
        -import io.helidon.common.http.RoutedPath;
        -import io.helidon.common.http.ServerRequestHeaders;
        -import io.helidon.common.http.ServerResponseHeaders;
        +import io.helidon.http.Http;
        +import io.helidon.http.HttpException;
        +import io.helidon.http.HttpPrologue;
        +import io.helidon.http.RoutedPath;
        +import io.helidon.http.ServerRequestHeaders;
        +import io.helidon.http.ServerResponseHeaders;
         import io.helidon.common.parameters.Parameters;
         import io.helidon.common.uri.UriFragment;
         import io.helidon.common.uri.UriPath;
         import io.helidon.common.uri.UriQuery;
        -import io.helidon.nima.webserver.http.ServerRequest;
        -import io.helidon.nima.webserver.http.ServerResponse;
        +import io.helidon.webserver.http.ServerRequest;
        +import io.helidon.webserver.http.ServerResponse;
         
         import org.junit.jupiter.api.Test;
         import org.mockito.Mockito;
         
        -import static io.helidon.common.http.Http.HeaderNames.ETAG;
        -import static io.helidon.common.http.Http.HeaderNames.IF_MATCH;
        -import static io.helidon.common.http.Http.HeaderNames.IF_NONE_MATCH;
        -import static io.helidon.common.http.Http.HeaderNames.LOCATION;
        +import static io.helidon.http.Http.HeaderNames.ETAG;
        +import static io.helidon.http.Http.HeaderNames.IF_MATCH;
        +import static io.helidon.http.Http.HeaderNames.IF_NONE_MATCH;
        +import static io.helidon.http.Http.HeaderNames.LOCATION;
         import static org.hamcrest.CoreMatchers.is;
         import static org.hamcrest.MatcherAssert.assertThat;
         import static org.mockito.Mockito.mock;
        diff --git a/webserver/static-content/src/test/java/io/helidon/webserver/staticcontent/StaticContentTest.java b/webserver/static-content/src/test/java/io/helidon/webserver/staticcontent/StaticContentTest.java
        new file mode 100644
        index 00000000000..dfd4bcd7e0e
        --- /dev/null
        +++ b/webserver/static-content/src/test/java/io/helidon/webserver/staticcontent/StaticContentTest.java
        @@ -0,0 +1,129 @@
        +/*
        + * Copyright (c) 2021, 2023 Oracle and/or its affiliates.
        + *
        + * Licensed under the Apache License, Version 2.0 (the "License");
        + * you may not use this file except in compliance with the License.
        + * You may obtain a copy of the License at
        + *
        + *     http://www.apache.org/licenses/LICENSE-2.0
        + *
        + * Unless required by applicable law or agreed to in writing, software
        + * distributed under the License is distributed on an "AS IS" BASIS,
        + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        + * See the License for the specific language governing permissions and
        + * limitations under the License.
        + */
        +
        +package io.helidon.webserver.staticcontent;
        +
        +import java.nio.file.Files;
        +import java.nio.file.Path;
        +
        +import io.helidon.http.Http;
        +import io.helidon.http.Http.HeaderNames;
        +import io.helidon.common.testing.http.junit5.HttpHeaderMatcher;
        +import io.helidon.webserver.testing.junit5.DirectClient;
        +import io.helidon.webserver.testing.junit5.RoutingTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webclient.http1.Http1ClientResponse;
        +import io.helidon.webserver.http.HttpRouting;
        +
        +import org.junit.jupiter.api.Test;
        +import org.junit.jupiter.api.io.TempDir;
        +
        +import static org.hamcrest.CoreMatchers.is;
        +import static org.hamcrest.MatcherAssert.assertThat;
        +
        +@RoutingTest
        +class StaticContentTest {
        +    @TempDir
        +    static Path tempDir;
        +
        +    private final DirectClient testClient;
        +
        +    StaticContentTest(DirectClient testClient) {
        +        this.testClient = testClient;
        +    }
        +
        +    @SetUpRoute
        +    static void setupRouting(HttpRouting.Builder builder) throws Exception {
        +        Path nested = tempDir.resolve("nested");
        +        Files.createDirectories(nested);
        +
        +        Path resource = tempDir.resolve("resource.txt");
        +        Path favicon = tempDir.resolve("favicon.ico");
        +
        +        Files.writeString(resource, "Content");
        +        Files.writeString(favicon, "Wrong icon text");
        +        Files.writeString(nested.resolve("resource.txt"), "Nested content");
        +
        +        builder.register("/classpath", StaticContentService.builder("web"))
        +                .register("/singleclasspath", StaticContentService.builder("web/resource.txt"))
        +                .register("/path", StaticContentService.builder(tempDir))
        +                .register("/singlepath", StaticContentService.builder(resource));
        +    }
        +
        +    @Test
        +    void testClasspathFavicon() {
        +        try (Http1ClientResponse response = testClient.get("/classpath/favicon.ico")
        +                .request()) {
        +
        +            assertThat(response.status(), is(Http.Status.OK_200));
        +            assertThat(response.headers(), HttpHeaderMatcher.hasHeader(HeaderNames.CONTENT_TYPE, "image/x-icon"));
        +        }
        +    }
        +
        +    @Test
        +    void testClasspathNested() {
        +        try (Http1ClientResponse response = testClient.get("/classpath/nested/resource.txt")
        +                .request()) {
        +
        +            assertThat(response.status(), is(Http.Status.OK_200));
        +            assertThat(response.headers(), HttpHeaderMatcher.hasHeader(HeaderNames.CONTENT_TYPE, "text/plain"));
        +            assertThat(response.as(String.class), is("Nested content"));
        +        }
        +    }
        +
        +    @Test
        +    void testClasspathSingleFile() {
        +        try (Http1ClientResponse response = testClient.get("/singleclasspath")
        +                .request()) {
        +
        +            assertThat(response.status(), is(Http.Status.OK_200));
        +            assertThat(response.headers(), HttpHeaderMatcher.hasHeader(HeaderNames.CONTENT_TYPE, "text/plain"));
        +            assertThat(response.as(String.class), is("Content"));
        +        }
        +    }
        +
        +    @Test
        +    void testFileSystemFavicon() {
        +        try (Http1ClientResponse response = testClient.get("/path/favicon.ico")
        +                .request()) {
        +
        +            assertThat(response.status(), is(Http.Status.OK_200));
        +            assertThat(response.headers(), HttpHeaderMatcher.hasHeader(HeaderNames.CONTENT_TYPE, "image/x-icon"));
        +        }
        +    }
        +
        +    @Test
        +    void testFileSystemNested() {
        +        try (Http1ClientResponse response = testClient.get("/path/nested/resource.txt")
        +                .request()) {
        +
        +            assertThat(response.status(), is(Http.Status.OK_200));
        +            assertThat(response.headers(), HttpHeaderMatcher.hasHeader(HeaderNames.CONTENT_TYPE, "text/plain"));
        +            assertThat(response.as(String.class), is("Nested content"));
        +        }
        +    }
        +
        +    @Test
        +    void testFileSystemSingleFile() {
        +        try (Http1ClientResponse response = testClient.get("/singlepath")
        +                .request()) {
        +
        +            assertThat(response.status(), is(Http.Status.OK_200));
        +            assertThat(response.headers(), HttpHeaderMatcher.hasHeader(HeaderNames.CONTENT_TYPE, "text/plain"));
        +            assertThat(response.as(String.class), is("Content"));
        +        }
        +    }
        +}
        diff --git a/examples/nima/static-content/src/main/resources/web/favicon.ico b/webserver/static-content/src/test/resources/web/favicon.ico
        similarity index 100%
        rename from examples/nima/static-content/src/main/resources/web/favicon.ico
        rename to webserver/static-content/src/test/resources/web/favicon.ico
        diff --git a/nima/webserver/static-content/src/test/resources/web/nested/resource.txt b/webserver/static-content/src/test/resources/web/nested/resource.txt
        similarity index 100%
        rename from nima/webserver/static-content/src/test/resources/web/nested/resource.txt
        rename to webserver/static-content/src/test/resources/web/nested/resource.txt
        diff --git a/nima/webserver/static-content/src/test/resources/web/resource.txt b/webserver/static-content/src/test/resources/web/resource.txt
        similarity index 100%
        rename from nima/webserver/static-content/src/test/resources/web/resource.txt
        rename to webserver/static-content/src/test/resources/web/resource.txt
        diff --git a/webserver/testing/junit5/http2/pom.xml b/webserver/testing/junit5/http2/pom.xml
        new file mode 100644
        index 00000000000..473650c2651
        --- /dev/null
        +++ b/webserver/testing/junit5/http2/pom.xml
        @@ -0,0 +1,60 @@
        +
        +
        +
        +
        +    4.0.0
        +    
        +        io.helidon.webserver.testing.junit5
        +        helidon-webserver-testing-junit5-project
        +        4.0.0-SNAPSHOT
        +    
        +
        +    helidon-webserver-testing-junit5-http2
        +    Helidon WebServer Testing JUnit5 HTTP/2
        +
        +    
        +        
        +            io.helidon.webserver.testing.junit5
        +            helidon-webserver-testing-junit5
        +        
        +        
        +            io.helidon.webclient
        +            helidon-webclient-http2
        +        
        +        
        +            io.helidon.webserver
        +            helidon-webserver-http2
        +        
        +        
        +            io.helidon.webserver
        +            helidon-webserver-security
        +        
        +        
        +            org.junit.jupiter
        +            junit-jupiter-api
        +        
        +        
        +            org.hamcrest
        +            hamcrest-all
        +            provided
        +        
        +    
        +
        diff --git a/nima/testing/junit5/http2/src/main/java/io/helidon/nima/testing/junit5/http2/Http2ServerExtension.java b/webserver/testing/junit5/http2/src/main/java/io/helidon/webserver/testing/junit5/http2/Http2ServerExtension.java
        similarity index 84%
        rename from nima/testing/junit5/http2/src/main/java/io/helidon/nima/testing/junit5/http2/Http2ServerExtension.java
        rename to webserver/testing/junit5/http2/src/main/java/io/helidon/webserver/testing/junit5/http2/Http2ServerExtension.java
        index 3986c4a41d7..50477caa3c7 100644
        --- a/nima/testing/junit5/http2/src/main/java/io/helidon/nima/testing/junit5/http2/Http2ServerExtension.java
        +++ b/webserver/testing/junit5/http2/src/main/java/io/helidon/webserver/testing/junit5/http2/Http2ServerExtension.java
        @@ -14,12 +14,12 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.testing.junit5.http2;
        +package io.helidon.webserver.testing.junit5.http2;
         
        -import io.helidon.nima.http2.webclient.Http2Client;
        -import io.helidon.nima.testing.junit5.webserver.Junit5Util;
        -import io.helidon.nima.testing.junit5.webserver.spi.ServerJunitExtension;
        -import io.helidon.nima.webserver.WebServer;
        +import io.helidon.webclient.http2.Http2Client;
        +import io.helidon.webserver.WebServer;
        +import io.helidon.webserver.testing.junit5.Junit5Util;
        +import io.helidon.webserver.testing.junit5.spi.ServerJunitExtension;
         
         import org.junit.jupiter.api.extension.ExtensionContext;
         import org.junit.jupiter.api.extension.ParameterContext;
        @@ -27,7 +27,7 @@
         
         /**
          * A {@link java.util.ServiceLoader} provider implementation that adds support for injection of HTTP/2 related
        - * artifacts, such as {@link io.helidon.nima.http2.webclient.Http2Client} in Helidon integration tests.
        + * artifacts, such as {@link io.helidon.webclient.http2.Http2Client} in Helidon integration tests.
          */
         public class Http2ServerExtension implements ServerJunitExtension {
             /**
        diff --git a/webserver/testing/junit5/http2/src/main/java/io/helidon/webserver/testing/junit5/http2/package-info.java b/webserver/testing/junit5/http2/src/main/java/io/helidon/webserver/testing/junit5/http2/package-info.java
        new file mode 100644
        index 00000000000..bcaec297733
        --- /dev/null
        +++ b/webserver/testing/junit5/http2/src/main/java/io/helidon/webserver/testing/junit5/http2/package-info.java
        @@ -0,0 +1,20 @@
        +/*
        + * Copyright (c) 2023 Oracle and/or its affiliates.
        + *
        + * 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.
        + */
        +
        +/**
        + * Helidon WebServer Testing JUnit 5 Support for HTTP2.
        + */
        +package io.helidon.webserver.testing.junit5.http2;
        diff --git a/webserver/testing/junit5/http2/src/main/java/module-info.java b/webserver/testing/junit5/http2/src/main/java/module-info.java
        new file mode 100644
        index 00000000000..0c8f8a7559f
        --- /dev/null
        +++ b/webserver/testing/junit5/http2/src/main/java/module-info.java
        @@ -0,0 +1,29 @@
        +/*
        + * Copyright (c) 2023 Oracle and/or its affiliates.
        + *
        + * 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.
        + */
        +
        +/**
        + * Helidon WebServer Testing JUnit 5 Support for HTTP2.
        + */
        +module io.helidon.webserver.testing.junit5.http2 {
        +    requires transitive io.helidon.webserver.testing.junit5;
        +    requires io.helidon.webserver.http2;
        +    requires io.helidon.webclient.http2;
        +
        +    exports io.helidon.webserver.testing.junit5.http2;
        +
        +    provides io.helidon.webserver.testing.junit5.spi.ServerJunitExtension
        +            with io.helidon.webserver.testing.junit5.http2.Http2ServerExtension;
        +}
        \ No newline at end of file
        diff --git a/nima/testing/junit5/http2/src/test/java/io/helidon/nima/testing/junit5/http2/Http2AbstractTestingTest.java b/webserver/testing/junit5/http2/src/test/java/io/helidon/webserver/testing/junit5/http2/Http2AbstractTestingTest.java
        similarity index 82%
        rename from nima/testing/junit5/http2/src/test/java/io/helidon/nima/testing/junit5/http2/Http2AbstractTestingTest.java
        rename to webserver/testing/junit5/http2/src/test/java/io/helidon/webserver/testing/junit5/http2/Http2AbstractTestingTest.java
        index 7c06075704e..82979764670 100644
        --- a/nima/testing/junit5/http2/src/test/java/io/helidon/nima/testing/junit5/http2/Http2AbstractTestingTest.java
        +++ b/webserver/testing/junit5/http2/src/test/java/io/helidon/webserver/testing/junit5/http2/Http2AbstractTestingTest.java
        @@ -14,15 +14,15 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.testing.junit5.http2;
        +package io.helidon.webserver.testing.junit5.http2;
         
        -import io.helidon.common.http.Http;
        -import io.helidon.nima.http2.webclient.Http2Client;
        -import io.helidon.nima.http2.webserver.Http2Route;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.testing.junit5.webserver.Socket;
        -import io.helidon.nima.webclient.api.ClientResponseTyped;
        -import io.helidon.nima.webserver.http.HttpRules;
        +import io.helidon.http.Http;
        +import io.helidon.webclient.http2.Http2Client;
        +import io.helidon.webserver.http2.Http2Route;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webserver.testing.junit5.Socket;
        +import io.helidon.webclient.api.ClientResponseTyped;
        +import io.helidon.webserver.http.HttpRules;
         
         import org.junit.jupiter.api.Test;
         
        diff --git a/nima/testing/junit5/http2/src/test/java/io/helidon/nima/testing/junit5/http2/Http2SocketTestingTest.java b/webserver/testing/junit5/http2/src/test/java/io/helidon/webserver/testing/junit5/http2/Http2SocketTestingTest.java
        similarity index 83%
        rename from nima/testing/junit5/http2/src/test/java/io/helidon/nima/testing/junit5/http2/Http2SocketTestingTest.java
        rename to webserver/testing/junit5/http2/src/test/java/io/helidon/webserver/testing/junit5/http2/Http2SocketTestingTest.java
        index e10c82f2a0d..6e3507e9960 100644
        --- a/nima/testing/junit5/http2/src/test/java/io/helidon/nima/testing/junit5/http2/Http2SocketTestingTest.java
        +++ b/webserver/testing/junit5/http2/src/test/java/io/helidon/webserver/testing/junit5/http2/Http2SocketTestingTest.java
        @@ -14,10 +14,10 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.testing.junit5.http2;
        +package io.helidon.webserver.testing.junit5.http2;
         
        -import io.helidon.nima.http2.webclient.Http2Client;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        +import io.helidon.webclient.http2.Http2Client;
        +import io.helidon.webserver.testing.junit5.ServerTest;
         
         @ServerTest
         class Http2SocketTestingTest extends Http2AbstractTestingTest {
        diff --git a/webserver/testing/junit5/junit5/etc/spotbugs/exclude.xml b/webserver/testing/junit5/junit5/etc/spotbugs/exclude.xml
        new file mode 100644
        index 00000000000..6c6ee478d34
        --- /dev/null
        +++ b/webserver/testing/junit5/junit5/etc/spotbugs/exclude.xml
        @@ -0,0 +1,33 @@
        +
        +
        +
        +
        +
        +    
        +        
        +        
        +        
        +    
        +
        +
        diff --git a/webserver/testing/junit5/junit5/pom.xml b/webserver/testing/junit5/junit5/pom.xml
        new file mode 100644
        index 00000000000..81157bdcc83
        --- /dev/null
        +++ b/webserver/testing/junit5/junit5/pom.xml
        @@ -0,0 +1,62 @@
        +
        +
        +
        +
        +    4.0.0
        +    
        +        io.helidon.webserver.testing.junit5
        +        helidon-webserver-testing-junit5-project
        +        4.0.0-SNAPSHOT
        +    
        +    helidon-webserver-testing-junit5
        +    Helidon WebServer Testing JUnit5
        +
        +    
        +        etc/spotbugs/exclude.xml
        +    
        +
        +    
        +        
        +            io.helidon.webserver
        +            helidon-webserver
        +        
        +        
        +            io.helidon.webclient
        +            helidon-webclient
        +        
        +        
        +            io.helidon.common.testing
        +            helidon-common-testing-http-junit5
        +        
        +        
        +            io.helidon.config
        +            helidon-config-yaml
        +        
        +        
        +            org.junit.jupiter
        +            junit-jupiter-api
        +        
        +        
        +            org.hamcrest
        +            hamcrest-all
        +        
        +    
        +
        diff --git a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/DirectClient.java b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/DirectClient.java
        similarity index 94%
        rename from nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/DirectClient.java
        rename to webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/DirectClient.java
        index 36a6ed75d80..7c9739d6f06 100644
        --- a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/DirectClient.java
        +++ b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/DirectClient.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.testing.junit5.webserver;
        +package io.helidon.webserver.testing.junit5;
         
         import java.net.InetSocketAddress;
         import java.net.URI;
        @@ -22,13 +22,13 @@
         import java.security.cert.Certificate;
         import java.util.Optional;
         
        -import io.helidon.common.http.Http;
         import io.helidon.common.socket.PeerInfo;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webclient.http1.Http1ClientConfig;
        -import io.helidon.nima.webclient.http1.Http1ClientRequest;
        -import io.helidon.nima.webserver.Router;
        -import io.helidon.nima.webserver.http.HttpRouting;
        +import io.helidon.http.Http;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webclient.http1.Http1ClientConfig;
        +import io.helidon.webclient.http1.Http1ClientRequest;
        +import io.helidon.webserver.Router;
        +import io.helidon.webserver.http.HttpRouting;
         
         /**
          * Unit testing client that bypasses HTTP transport and directly invokes router.
        diff --git a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/DirectClientConnection.java b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/DirectClientConnection.java
        similarity index 92%
        rename from nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/DirectClientConnection.java
        rename to webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/DirectClientConnection.java
        index 00258065ebc..a817d436087 100644
        --- a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/DirectClientConnection.java
        +++ b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/DirectClientConnection.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.testing.junit5.webserver;
        +package io.helidon.webserver.testing.junit5;
         
         import java.time.Duration;
         import java.util.List;
        @@ -26,13 +26,13 @@
         import io.helidon.common.buffers.DataReader;
         import io.helidon.common.buffers.DataWriter;
         import io.helidon.common.socket.HelidonSocket;
        -import io.helidon.nima.webclient.api.ClientConnection;
        -import io.helidon.nima.webserver.ProtocolConfigs;
        -import io.helidon.nima.webserver.Router;
        -import io.helidon.nima.webserver.WebServer;
        -import io.helidon.nima.webserver.http1.Http1Config;
        -import io.helidon.nima.webserver.http1.Http1ConnectionProvider;
        -import io.helidon.nima.webserver.spi.ServerConnection;
        +import io.helidon.webclient.api.ClientConnection;
        +import io.helidon.webserver.ProtocolConfigs;
        +import io.helidon.webserver.Router;
        +import io.helidon.webserver.WebServer;
        +import io.helidon.webserver.http1.Http1Config;
        +import io.helidon.webserver.http1.Http1ConnectionProvider;
        +import io.helidon.webserver.spi.ServerConnection;
         
         class DirectClientConnection implements ClientConnection {
             private final AtomicBoolean serverStarted = new AtomicBoolean();
        diff --git a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/DirectClientServerContext.java b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/DirectClientServerContext.java
        similarity index 90%
        rename from nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/DirectClientServerContext.java
        rename to webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/DirectClientServerContext.java
        index cbe15f0b23f..03b59ad0f31 100644
        --- a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/DirectClientServerContext.java
        +++ b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/DirectClientServerContext.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.testing.junit5.webserver;
        +package io.helidon.webserver.testing.junit5;
         
         import java.util.concurrent.ExecutorService;
         import java.util.concurrent.Executors;
        @@ -24,13 +24,13 @@
         import io.helidon.common.context.Context;
         import io.helidon.common.socket.HelidonSocket;
         import io.helidon.common.socket.PeerInfo;
        -import io.helidon.nima.http.encoding.ContentEncodingContext;
        -import io.helidon.nima.http.media.MediaContext;
        -import io.helidon.nima.webserver.ConnectionContext;
        -import io.helidon.nima.webserver.ListenerConfig;
        -import io.helidon.nima.webserver.ListenerContext;
        -import io.helidon.nima.webserver.Router;
        -import io.helidon.nima.webserver.http.DirectHandlers;
        +import io.helidon.http.encoding.ContentEncodingContext;
        +import io.helidon.http.media.MediaContext;
        +import io.helidon.webserver.ConnectionContext;
        +import io.helidon.webserver.ListenerConfig;
        +import io.helidon.webserver.ListenerContext;
        +import io.helidon.webserver.Router;
        +import io.helidon.webserver.http.DirectHandlers;
         
         class DirectClientServerContext implements ConnectionContext, ListenerContext {
             private final DataReader serverReader;
        diff --git a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/DirectPeerInfo.java b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/DirectPeerInfo.java
        similarity index 90%
        rename from nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/DirectPeerInfo.java
        rename to webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/DirectPeerInfo.java
        index e54a2a8faf3..58433ff043b 100644
        --- a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/DirectPeerInfo.java
        +++ b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/DirectPeerInfo.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.testing.junit5.webserver;
        +package io.helidon.webserver.testing.junit5;
         
         import java.net.SocketAddress;
         import java.security.Principal;
        @@ -24,7 +24,7 @@
         import io.helidon.common.socket.PeerInfo;
         
         /**
        - * Peer information that can be used with {@link io.helidon.nima.testing.junit5.webserver.DirectSocket}.
        + * Peer information that can be used with {@link DirectSocket}.
          *
          * @param address socket address - socket address of the peer
          * @param host host - for network, this is the used host of the peer
        diff --git a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/DirectSocket.java b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/DirectSocket.java
        similarity index 97%
        rename from nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/DirectSocket.java
        rename to webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/DirectSocket.java
        index a60f6cb26c0..e0628739249 100644
        --- a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/DirectSocket.java
        +++ b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/DirectSocket.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.testing.junit5.webserver;
        +package io.helidon.webserver.testing.junit5;
         
         import io.helidon.common.buffers.BufferData;
         import io.helidon.common.socket.HelidonSocket;
        diff --git a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/DirectWebClient.java b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/DirectWebClient.java
        similarity index 93%
        rename from nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/DirectWebClient.java
        rename to webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/DirectWebClient.java
        index 4960eb5e8d6..7ee9507f018 100644
        --- a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/DirectWebClient.java
        +++ b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/DirectWebClient.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.testing.junit5.webserver;
        +package io.helidon.webserver.testing.junit5;
         
         import java.net.InetSocketAddress;
         import java.security.Principal;
        @@ -22,17 +22,17 @@
         import java.util.Optional;
         import java.util.concurrent.ExecutorService;
         
        -import io.helidon.common.http.Http;
         import io.helidon.common.socket.HelidonSocket;
         import io.helidon.common.socket.PeerInfo;
        -import io.helidon.nima.webclient.api.HttpClientRequest;
        -import io.helidon.nima.webclient.api.WebClient;
        -import io.helidon.nima.webclient.api.WebClientConfig;
        -import io.helidon.nima.webclient.api.WebClientCookieManager;
        -import io.helidon.nima.webclient.spi.Protocol;
        -import io.helidon.nima.webclient.spi.ProtocolConfig;
        -import io.helidon.nima.webserver.Router;
        -import io.helidon.nima.webserver.http.HttpRouting;
        +import io.helidon.http.Http;
        +import io.helidon.webclient.api.HttpClientRequest;
        +import io.helidon.webclient.api.WebClient;
        +import io.helidon.webclient.api.WebClientConfig;
        +import io.helidon.webclient.api.WebClientCookieManager;
        +import io.helidon.webclient.spi.Protocol;
        +import io.helidon.webclient.spi.ProtocolConfig;
        +import io.helidon.webserver.Router;
        +import io.helidon.webserver.http.HttpRouting;
         
         /**
          * Unit testing client that bypasses HTTP transport and directly invokes router.
        diff --git a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/HelidonRoutingJunitExtension.java b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/HelidonRoutingJunitExtension.java
        similarity index 95%
        rename from nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/HelidonRoutingJunitExtension.java
        rename to webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/HelidonRoutingJunitExtension.java
        index 91e25fd84b1..152b13f5b24 100644
        --- a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/HelidonRoutingJunitExtension.java
        +++ b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/HelidonRoutingJunitExtension.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.testing.junit5.webserver;
        +package io.helidon.webserver.testing.junit5;
         
         import java.lang.reflect.InvocationTargetException;
         import java.lang.reflect.Method;
        @@ -27,7 +27,7 @@
         import io.helidon.common.HelidonServiceLoader;
         import io.helidon.common.context.Contexts;
         import io.helidon.logging.common.LogConfig;
        -import io.helidon.nima.testing.junit5.webserver.spi.DirectJunitExtension;
        +import io.helidon.webserver.testing.junit5.spi.DirectJunitExtension;
         
         import org.junit.jupiter.api.extension.AfterAllCallback;
         import org.junit.jupiter.api.extension.AfterEachCallback;
        @@ -39,10 +39,8 @@
         import org.junit.jupiter.api.extension.ParameterResolutionException;
         import org.junit.jupiter.api.extension.ParameterResolver;
         
        -import static io.helidon.nima.testing.junit5.webserver.Junit5Util.withStaticMethods;
        -
         /**
        - * JUnit5 extension to support Helidon Níma WebServer in tests.
        + * JUnit5 extension to support Helidon WebServer in tests.
          */
         class HelidonRoutingJunitExtension implements BeforeAllCallback,
                                                       AfterAllCallback,
        @@ -125,7 +123,7 @@ public Object resolveParameter(ParameterContext parameterContext, ExtensionConte
             }
         
             private void initRoutings() {
        -        withStaticMethods(testClass, SetUpRoute.class, (
        +        Junit5Util.withStaticMethods(testClass, SetUpRoute.class, (
                         (setUpRoute, method) -> {
                             String socketName = setUpRoute.value();
                             SetUpRouteHandler methodConsumer = createRoutingMethodCall(method);
        diff --git a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/HelidonServerJunitExtension.java b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/HelidonServerJunitExtension.java
        similarity index 95%
        rename from nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/HelidonServerJunitExtension.java
        rename to webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/HelidonServerJunitExtension.java
        index 7c9a619c6d5..e9ba5903878 100644
        --- a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/HelidonServerJunitExtension.java
        +++ b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/HelidonServerJunitExtension.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.testing.junit5.webserver;
        +package io.helidon.webserver.testing.junit5;
         
         import java.lang.reflect.Executable;
         import java.lang.reflect.InvocationTargetException;
        @@ -34,11 +34,11 @@
         import io.helidon.common.context.Context;
         import io.helidon.common.context.Contexts;
         import io.helidon.logging.common.LogConfig;
        -import io.helidon.nima.testing.junit5.webserver.spi.ServerJunitExtension;
        -import io.helidon.nima.webserver.ListenerConfig;
        -import io.helidon.nima.webserver.Router;
        -import io.helidon.nima.webserver.WebServer;
        -import io.helidon.nima.webserver.WebServerConfig;
        +import io.helidon.webserver.ListenerConfig;
        +import io.helidon.webserver.Router;
        +import io.helidon.webserver.WebServer;
        +import io.helidon.webserver.WebServerConfig;
        +import io.helidon.webserver.testing.junit5.spi.ServerJunitExtension;
         
         import org.junit.jupiter.api.extension.AfterAllCallback;
         import org.junit.jupiter.api.extension.AfterEachCallback;
        @@ -49,11 +49,11 @@
         import org.junit.jupiter.api.extension.ParameterResolutionException;
         import org.junit.jupiter.api.extension.ParameterResolver;
         
        -import static io.helidon.nima.testing.junit5.webserver.Junit5Util.withStaticMethods;
        -import static io.helidon.nima.webserver.WebServer.DEFAULT_SOCKET_NAME;
        +import static io.helidon.webserver.WebServer.DEFAULT_SOCKET_NAME;
        +import static io.helidon.webserver.testing.junit5.Junit5Util.withStaticMethods;
         
         /**
        - * JUnit5 extension to support Helidon Níma WebServer in tests.
        + * JUnit5 extension to support Helidon WebServer in tests.
          */
         class HelidonServerJunitExtension implements BeforeAllCallback,
                                                      AfterAllCallback,
        diff --git a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/Http1DirectJunitExtension.java b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/Http1DirectJunitExtension.java
        similarity index 94%
        rename from nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/Http1DirectJunitExtension.java
        rename to webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/Http1DirectJunitExtension.java
        index 851e4eb5a3e..8ab0690259b 100644
        --- a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/Http1DirectJunitExtension.java
        +++ b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/Http1DirectJunitExtension.java
        @@ -14,19 +14,19 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.testing.junit5.webserver;
        +package io.helidon.webserver.testing.junit5;
         
         import java.lang.reflect.Method;
         import java.util.HashMap;
         import java.util.Map;
         import java.util.Optional;
         
        -import io.helidon.nima.testing.junit5.webserver.spi.DirectJunitExtension;
        -import io.helidon.nima.webclient.api.WebClient;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webserver.WebServer;
        -import io.helidon.nima.webserver.http.HttpRouting;
        -import io.helidon.nima.webserver.http.HttpRules;
        +import io.helidon.webclient.api.WebClient;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webserver.WebServer;
        +import io.helidon.webserver.http.HttpRouting;
        +import io.helidon.webserver.http.HttpRules;
        +import io.helidon.webserver.testing.junit5.spi.DirectJunitExtension;
         
         import org.junit.jupiter.api.extension.ExtensionContext;
         import org.junit.jupiter.api.extension.ParameterContext;
        @@ -34,7 +34,7 @@
         
         /**
          * A Java {@link java.util.ServiceLoader} provider implementation of
        - * {@link io.helidon.nima.testing.junit5.webserver.spi.DirectJunitExtension} for HTTP/1.1 tests.
        + * {@link io.helidon.webserver.testing.junit5.spi.DirectJunitExtension} for HTTP/1.1 tests.
          */
         public class Http1DirectJunitExtension implements DirectJunitExtension {
             private final Map clients = new HashMap<>();
        diff --git a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/Http1ServerJunitExtension.java b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/Http1ServerJunitExtension.java
        similarity index 91%
        rename from nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/Http1ServerJunitExtension.java
        rename to webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/Http1ServerJunitExtension.java
        index 12b807841e7..9ea15475693 100644
        --- a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/Http1ServerJunitExtension.java
        +++ b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/Http1ServerJunitExtension.java
        @@ -14,22 +14,22 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.testing.junit5.webserver;
        +package io.helidon.webserver.testing.junit5;
         
         import java.util.Map;
         import java.util.Optional;
         import java.util.concurrent.ConcurrentHashMap;
         
         import io.helidon.common.testing.http.junit5.SocketHttpClient;
        -import io.helidon.nima.testing.junit5.webserver.spi.ServerJunitExtension;
        -import io.helidon.nima.webclient.api.WebClient;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webserver.ListenerConfig;
        -import io.helidon.nima.webserver.Router;
        -import io.helidon.nima.webserver.WebServer;
        -import io.helidon.nima.webserver.WebServerConfig;
        -import io.helidon.nima.webserver.http.HttpRouting;
        -import io.helidon.nima.webserver.http.HttpRules;
        +import io.helidon.webclient.api.WebClient;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webserver.ListenerConfig;
        +import io.helidon.webserver.Router;
        +import io.helidon.webserver.WebServer;
        +import io.helidon.webserver.WebServerConfig;
        +import io.helidon.webserver.http.HttpRouting;
        +import io.helidon.webserver.http.HttpRules;
        +import io.helidon.webserver.testing.junit5.spi.ServerJunitExtension;
         
         import org.junit.jupiter.api.extension.ExtensionContext;
         import org.junit.jupiter.api.extension.ParameterContext;
        @@ -37,7 +37,7 @@
         
         /**
          * Java {@link java.util.ServiceLoader} provider implementation of
        - * a {@link io.helidon.nima.testing.junit5.webserver.spi.ServerJunitExtension} that adds support for HTTP/1.1.
        + * a {@link io.helidon.webserver.testing.junit5.spi.ServerJunitExtension} that adds support for HTTP/1.1.
          */
         public class Http1ServerJunitExtension implements ServerJunitExtension {
             private final Map socketHttpClients = new ConcurrentHashMap<>();
        diff --git a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/Junit5Util.java b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/Junit5Util.java
        similarity index 94%
        rename from nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/Junit5Util.java
        rename to webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/Junit5Util.java
        index eaa86940798..c6f3f615271 100644
        --- a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/Junit5Util.java
        +++ b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/Junit5Util.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.testing.junit5.webserver;
        +package io.helidon.webserver.testing.junit5;
         
         import java.lang.annotation.Annotation;
         import java.lang.reflect.Method;
        @@ -23,7 +23,7 @@
         import java.util.LinkedList;
         import java.util.function.BiConsumer;
         
        -import io.helidon.nima.webserver.WebServer;
        +import io.helidon.webserver.WebServer;
         
         /**
          * Utility methods for JUnit5 extensions.
        @@ -33,7 +33,7 @@ private Junit5Util() {
             }
         
             /**
        -     * Discover socket name using {@link io.helidon.nima.testing.junit5.webserver.Socket} annotation.
        +     * Discover socket name using {@link Socket} annotation.
              * If none found, {@link WebServer#DEFAULT_SOCKET_NAME} is returned.
              *
              * @param parameter parameter to check
        diff --git a/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/RoutingTest.java b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/RoutingTest.java
        new file mode 100644
        index 00000000000..00a47622b73
        --- /dev/null
        +++ b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/RoutingTest.java
        @@ -0,0 +1,39 @@
        +/*
        + * Copyright (c) 2022, 2023 Oracle and/or its affiliates.
        + *
        + * Licensed under the Apache License, Version 2.0 (the "License");
        + * you may not use this file except in compliance with the License.
        + * You may obtain a copy of the License at
        + *
        + *     http://www.apache.org/licenses/LICENSE-2.0
        + *
        + * Unless required by applicable law or agreed to in writing, software
        + * distributed under the License is distributed on an "AS IS" BASIS,
        + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        + * See the License for the specific language governing permissions and
        + * limitations under the License.
        + */
        +
        +package io.helidon.webserver.testing.junit5;
        +
        +import java.lang.annotation.ElementType;
        +import java.lang.annotation.Inherited;
        +import java.lang.annotation.Retention;
        +import java.lang.annotation.RetentionPolicy;
        +import java.lang.annotation.Target;
        +
        +import org.junit.jupiter.api.extension.ExtendWith;
        +
        +/**
        + * Test of router without opening a socket.
        + * Can be used together with:
        + * 
          + *
        • {@link SetUpRoute}
        • + *
        + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +@ExtendWith(HelidonRoutingJunitExtension.class) +@Inherited +public @interface RoutingTest { +} diff --git a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/ServerTest.java b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/ServerTest.java similarity index 81% rename from nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/ServerTest.java rename to webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/ServerTest.java index e4a05c0a4ad..5611b0cb7f3 100644 --- a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/ServerTest.java +++ b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/ServerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.testing.junit5.webserver; +package io.helidon.webserver.testing.junit5; import java.lang.annotation.ElementType; import java.lang.annotation.Inherited; @@ -28,8 +28,8 @@ * Test of server that opens a socket (for integration tests). * Can be used together with: *
          - *
        • {@link io.helidon.nima.testing.junit5.webserver.SetUpRoute}
        • - *
        • {@link io.helidon.nima.testing.junit5.webserver.SetUpServer}
        • + *
        • {@link SetUpRoute}
        • + *
        • {@link SetUpServer}
        • *
        */ @Retention(RetentionPolicy.RUNTIME) diff --git a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/SetUpRoute.java b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/SetUpRoute.java similarity index 89% rename from nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/SetUpRoute.java rename to webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/SetUpRoute.java index 653ed8c3142..a00ea8d7f61 100644 --- a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/SetUpRoute.java +++ b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/SetUpRoute.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022 Oracle and/or its affiliates. + * Copyright (c) 2020, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.testing.junit5.webserver; +package io.helidon.webserver.testing.junit5; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import io.helidon.nima.webserver.WebServer; +import io.helidon.webserver.WebServer; /** * A static method configuring router (and/or socket) for the server. diff --git a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/SetUpServer.java b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/SetUpServer.java similarity index 89% rename from nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/SetUpServer.java rename to webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/SetUpServer.java index c666b3b3891..7ab4f37c5c2 100644 --- a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/SetUpServer.java +++ b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/SetUpServer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022 Oracle and/or its affiliates. + * Copyright (c) 2020, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.testing.junit5.webserver; +package io.helidon.webserver.testing.junit5; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/Socket.java b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/Socket.java similarity index 96% rename from nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/Socket.java rename to webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/Socket.java index 59dfe286b5c..ff24494d96e 100644 --- a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/Socket.java +++ b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/Socket.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.testing.junit5.webserver; +package io.helidon.webserver.testing.junit5; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/package-info.java b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/package-info.java new file mode 100644 index 00000000000..0104012af32 --- /dev/null +++ b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/package-info.java @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebServer Testing JUnit5 Support. + * + * @see io.helidon.webserver.testing.junit5.ServerTest + * @see io.helidon.webserver.testing.junit5.RoutingTest + */ +package io.helidon.webserver.testing.junit5; diff --git a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/spi/DirectJunitExtension.java b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/spi/DirectJunitExtension.java similarity index 91% rename from nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/spi/DirectJunitExtension.java rename to webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/spi/DirectJunitExtension.java index cb75165f155..6e0eadae420 100644 --- a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/spi/DirectJunitExtension.java +++ b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/spi/DirectJunitExtension.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.testing.junit5.webserver.spi; +package io.helidon.webserver.testing.junit5.spi; import java.lang.reflect.Method; import java.util.Optional; @@ -46,7 +46,7 @@ default Object resolveParameter(ParameterContext parameterContext, /** * Check if the type is supported and return a handler for it. * - * @param type type of the parameter to {@link io.helidon.nima.testing.junit5.webserver.SetUpRoute} method + * @param type type of the parameter to {@link io.helidon.webserver.testing.junit5.SetUpRoute} method * @return parameter handler if the type is supported, empty otherwise */ default Optional> setUpRouteParamHandler(Class type) { @@ -55,9 +55,9 @@ default Optional> setUpRouteParamHandler(Class type) { /** * Handler to provide an instance that can be injected as a parameter to - * {@link io.helidon.nima.testing.junit5.webserver.SetUpRoute} static methods. + * {@link io.helidon.webserver.testing.junit5.SetUpRoute} static methods. * - * @param type of the parameter (such as {@link io.helidon.nima.webserver.http.HttpRouting.Builder} + * @param type of the parameter (such as {@link io.helidon.webserver.http.HttpRouting.Builder} */ interface ParamHandler { /** diff --git a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/spi/HelidonJunitExtension.java b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/spi/HelidonJunitExtension.java similarity index 92% rename from nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/spi/HelidonJunitExtension.java rename to webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/spi/HelidonJunitExtension.java index d8c3e5afaa6..5d30791816d 100644 --- a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/spi/HelidonJunitExtension.java +++ b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/spi/HelidonJunitExtension.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.testing.junit5.webserver.spi; +package io.helidon.webserver.testing.junit5.spi; import org.junit.jupiter.api.extension.AfterAllCallback; import org.junit.jupiter.api.extension.AfterEachCallback; @@ -26,8 +26,8 @@ /** * Common interface for JUnit extensions that can extend features of the - * {@link io.helidon.nima.testing.junit5.webserver.ServerTest} or - * {@link io.helidon.nima.testing.junit5.webserver.RoutingTest}. + * {@link io.helidon.webserver.testing.junit5.ServerTest} or + * {@link io.helidon.webserver.testing.junit5.RoutingTest}. */ public interface HelidonJunitExtension extends BeforeAllCallback, AfterAllCallback, diff --git a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/spi/ServerJunitExtension.java b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/spi/ServerJunitExtension.java similarity index 86% rename from nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/spi/ServerJunitExtension.java rename to webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/spi/ServerJunitExtension.java index 6902a760e5b..c9419f1b1b1 100644 --- a/nima/testing/junit5/webserver/src/main/java/io/helidon/nima/testing/junit5/webserver/spi/ServerJunitExtension.java +++ b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/spi/ServerJunitExtension.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.nima.testing.junit5.webserver.spi; +package io.helidon.webserver.testing.junit5.spi; import java.util.Optional; -import io.helidon.nima.webserver.ListenerConfig; -import io.helidon.nima.webserver.Router; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; +import io.helidon.webserver.ListenerConfig; +import io.helidon.webserver.Router; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.ParameterContext; @@ -41,7 +41,7 @@ default void updateServerBuilder(WebServerConfig.Builder builder) { } /** - * Called for sockets defined by {@link io.helidon.nima.testing.junit5.webserver.SetUpRoute}. + * Called for sockets defined by {@link io.helidon.webserver.testing.junit5.SetUpRoute}. * * @param socketName name of the socket * @param listenerBuilder listener configuration builder @@ -74,7 +74,7 @@ default Object resolveParameter(ParameterContext parameterContext, /** * Check if the type is supported and return a handler for it. * - * @param type type of the parameter to {@link io.helidon.nima.testing.junit5.webserver.SetUpRoute} method + * @param type type of the parameter to {@link io.helidon.webserver.testing.junit5.SetUpRoute} method * @return parameter handler if the type is supported, empty otherwise */ default Optional> setUpRouteParamHandler(Class type) { @@ -82,7 +82,7 @@ default Optional> setUpRouteParamHandler(Class type) { } /** - * Handler of server test parameters of methods annotated with {@link io.helidon.nima.testing.junit5.webserver.SetUpRoute}. + * Handler of server test parameters of methods annotated with {@link io.helidon.webserver.testing.junit5.SetUpRoute}. * * @param */ @@ -109,9 +109,9 @@ T get(String socketName, * @param listenerBuilder builder of the listener * @param routerBuilder router builder * @param value the value we provided with - * {@link #get(String, io.helidon.nima.webserver.WebServerConfig.Builder, - * io.helidon.nima.webserver.ListenerConfig.Builder, - * io.helidon.nima.webserver.Router.RouterBuilder)} + * {@link #get(String, io.helidon.webserver.WebServerConfig.Builder, + * io.helidon.webserver.ListenerConfig.Builder, + * io.helidon.webserver.Router.RouterBuilder)} */ default void handle(String socketName, WebServerConfig.Builder serverBuilder, diff --git a/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/spi/package-info.java b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/spi/package-info.java new file mode 100644 index 00000000000..29704247de2 --- /dev/null +++ b/webserver/testing/junit5/junit5/src/main/java/io/helidon/webserver/testing/junit5/spi/package-info.java @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebServer Testing JUnit5 SPI. + * Provides a mechanism to additional types (such as WebSocket clients, gRPC clients etc.). + * + * @see io.helidon.webserver.testing.junit5.spi.DirectJunitExtension + * @see io.helidon.webserver.testing.junit5.spi.ServerJunitExtension + */ +package io.helidon.webserver.testing.junit5.spi; diff --git a/webserver/testing/junit5/junit5/src/main/java/module-info.java b/webserver/testing/junit5/junit5/src/main/java/module-info.java new file mode 100644 index 00000000000..8a897917ebb --- /dev/null +++ b/webserver/testing/junit5/junit5/src/main/java/module-info.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebServer Testing JUnit5 Support. + * + * @see io.helidon.webserver.testing.junit5.ServerTest + * @see io.helidon.webserver.testing.junit5.RoutingTest + */ +module io.helidon.webserver.testing.junit5 { + requires transitive io.helidon.common.testing.http.junit5; + requires transitive io.helidon.webserver; + requires transitive io.helidon.webclient; + requires io.helidon.logging.common; + + requires transitive org.junit.jupiter.api; + requires transitive hamcrest.all; + + exports io.helidon.webserver.testing.junit5; + exports io.helidon.webserver.testing.junit5.spi; + + uses io.helidon.webserver.testing.junit5.spi.ServerJunitExtension; + uses io.helidon.webserver.testing.junit5.spi.DirectJunitExtension; + + provides io.helidon.webserver.testing.junit5.spi.ServerJunitExtension + with io.helidon.webserver.testing.junit5.Http1ServerJunitExtension; + + provides io.helidon.webserver.testing.junit5.spi.DirectJunitExtension + with io.helidon.webserver.testing.junit5.Http1DirectJunitExtension; + + opens io.helidon.webserver.testing.junit5 to org.junit.platform.commons; +} \ No newline at end of file diff --git a/nima/testing/junit5/webserver/src/test/java/io/helidon/nima/testing/junit5/webserver/TestRoutingTest.java b/webserver/testing/junit5/junit5/src/test/java/io/helidon/webserver/testing/junit5/TestRoutingTest.java similarity index 96% rename from nima/testing/junit5/webserver/src/test/java/io/helidon/nima/testing/junit5/webserver/TestRoutingTest.java rename to webserver/testing/junit5/junit5/src/test/java/io/helidon/webserver/testing/junit5/TestRoutingTest.java index bee11fdbe0b..97d31853255 100644 --- a/nima/testing/junit5/webserver/src/test/java/io/helidon/nima/testing/junit5/webserver/TestRoutingTest.java +++ b/webserver/testing/junit5/junit5/src/test/java/io/helidon/webserver/testing/junit5/TestRoutingTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.testing.junit5.webserver; +package io.helidon.webserver.testing.junit5; import java.security.Principal; import java.security.cert.Certificate; @@ -22,9 +22,9 @@ import java.util.LinkedList; import java.util.List; -import io.helidon.common.http.Http; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.http.Http; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.http.HttpRouting; import org.junit.jupiter.api.Test; diff --git a/nima/testing/junit5/webserver/src/test/java/io/helidon/nima/testing/junit5/webserver/TestServerTest.java b/webserver/testing/junit5/junit5/src/test/java/io/helidon/webserver/testing/junit5/TestServerTest.java similarity index 94% rename from nima/testing/junit5/webserver/src/test/java/io/helidon/nima/testing/junit5/webserver/TestServerTest.java rename to webserver/testing/junit5/junit5/src/test/java/io/helidon/webserver/testing/junit5/TestServerTest.java index 2c1c1e47038..4e6768c2435 100644 --- a/nima/testing/junit5/webserver/src/test/java/io/helidon/nima/testing/junit5/webserver/TestServerTest.java +++ b/webserver/testing/junit5/junit5/src/test/java/io/helidon/webserver/testing/junit5/TestServerTest.java @@ -14,17 +14,17 @@ * limitations under the License. */ -package io.helidon.nima.testing.junit5.webserver; +package io.helidon.webserver.testing.junit5; import java.net.URI; import io.helidon.common.context.Context; import io.helidon.common.testing.http.junit5.SocketHttpClient; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webserver.ListenerConfig; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webserver.ListenerConfig; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.HttpRouting; import org.junit.jupiter.api.Test; diff --git a/webserver/testing/junit5/pom.xml b/webserver/testing/junit5/pom.xml new file mode 100644 index 00000000000..a33c2f9a1e9 --- /dev/null +++ b/webserver/testing/junit5/pom.xml @@ -0,0 +1,42 @@ + + + + + 4.0.0 + + io.helidon.webserver.testing + helidon-webserver-testing-project + 4.0.0-SNAPSHOT + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5-project + Helidon WebServer Testing JUnit5 Project + + pom + + + junit5 + websocket + http2 + + + diff --git a/webserver/testing/junit5/websocket/pom.xml b/webserver/testing/junit5/websocket/pom.xml new file mode 100644 index 00000000000..5cb29d84ce8 --- /dev/null +++ b/webserver/testing/junit5/websocket/pom.xml @@ -0,0 +1,56 @@ + + + + + 4.0.0 + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5-project + 4.0.0-SNAPSHOT + + + helidon-webserver-testing-junit5-websocket + Helidon WebServer Testing JUnit5 WebSocket + + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 + + + io.helidon.webclient + helidon-webclient-websocket + + + io.helidon.webserver + helidon-webserver-websocket + + + org.junit.jupiter + junit-jupiter-api + + + org.hamcrest + hamcrest-all + provided + + + diff --git a/nima/testing/junit5/websocket/src/main/java/io/helidon/nima/testing/junit5/websocket/DirectWsClient.java b/webserver/testing/junit5/websocket/src/main/java/io/helidon/webserver/testing/junit5/websocket/DirectWsClient.java similarity index 86% rename from nima/testing/junit5/websocket/src/main/java/io/helidon/nima/testing/junit5/websocket/DirectWsClient.java rename to webserver/testing/junit5/websocket/src/main/java/io/helidon/webserver/testing/junit5/websocket/DirectWsClient.java index da2c46b8d08..981eb116f99 100644 --- a/nima/testing/junit5/websocket/src/main/java/io/helidon/nima/testing/junit5/websocket/DirectWsClient.java +++ b/webserver/testing/junit5/websocket/src/main/java/io/helidon/webserver/testing/junit5/websocket/DirectWsClient.java @@ -14,20 +14,20 @@ * limitations under the License. */ -package io.helidon.nima.testing.junit5.websocket; +package io.helidon.webserver.testing.junit5.websocket; import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.List; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpPrologue; -import io.helidon.nima.websocket.WsListener; -import io.helidon.nima.websocket.client.WsClient; -import io.helidon.nima.websocket.client.WsClientConfig; -import io.helidon.nima.websocket.webserver.WsRoute; -import io.helidon.nima.websocket.webserver.WsRouting; +import io.helidon.http.Http; +import io.helidon.http.HttpPrologue; +import io.helidon.webclient.websocket.WsClient; +import io.helidon.webclient.websocket.WsClientConfig; +import io.helidon.webserver.websocket.WsRoute; +import io.helidon.webserver.websocket.WsRouting; +import io.helidon.websocket.WsListener; /** * A client for WebSocket, that directly invokes routing (and bypasses network). diff --git a/nima/testing/junit5/websocket/src/main/java/io/helidon/nima/testing/junit5/websocket/DirectWsConnection.java b/webserver/testing/junit5/websocket/src/main/java/io/helidon/webserver/testing/junit5/websocket/DirectWsConnection.java similarity index 92% rename from nima/testing/junit5/websocket/src/main/java/io/helidon/nima/testing/junit5/websocket/DirectWsConnection.java rename to webserver/testing/junit5/websocket/src/main/java/io/helidon/webserver/testing/junit5/websocket/DirectWsConnection.java index 9ef243dca89..bc20d39d81f 100644 --- a/nima/testing/junit5/websocket/src/main/java/io/helidon/nima/testing/junit5/websocket/DirectWsConnection.java +++ b/webserver/testing/junit5/websocket/src/main/java/io/helidon/webserver/testing/junit5/websocket/DirectWsConnection.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.testing.junit5.websocket; +package io.helidon.webserver.testing.junit5.websocket; import java.net.InetSocketAddress; import java.time.Duration; @@ -29,19 +29,19 @@ import io.helidon.common.buffers.BufferData; import io.helidon.common.buffers.DataReader; import io.helidon.common.buffers.DataWriter; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.WritableHeaders; import io.helidon.common.socket.HelidonSocket; import io.helidon.common.socket.PeerInfo; -import io.helidon.nima.testing.junit5.webserver.DirectPeerInfo; -import io.helidon.nima.testing.junit5.webserver.DirectSocket; -import io.helidon.nima.webclient.api.ClientConnection; -import io.helidon.nima.webserver.ConnectionContext; -import io.helidon.nima.webserver.Router; -import io.helidon.nima.websocket.WsListener; -import io.helidon.nima.websocket.client.ClientWsConnection; -import io.helidon.nima.websocket.webserver.WsConnection; -import io.helidon.nima.websocket.webserver.WsRoute; +import io.helidon.http.HttpPrologue; +import io.helidon.http.WritableHeaders; +import io.helidon.webclient.api.ClientConnection; +import io.helidon.webclient.websocket.ClientWsConnection; +import io.helidon.webserver.ConnectionContext; +import io.helidon.webserver.Router; +import io.helidon.webserver.testing.junit5.DirectPeerInfo; +import io.helidon.webserver.testing.junit5.DirectSocket; +import io.helidon.webserver.websocket.WsConnection; +import io.helidon.webserver.websocket.WsRoute; +import io.helidon.websocket.WsListener; class DirectWsConnection { private final AtomicBoolean serverStarted = new AtomicBoolean(); diff --git a/nima/testing/junit5/websocket/src/main/java/io/helidon/nima/testing/junit5/websocket/DirectWsServerContext.java b/webserver/testing/junit5/websocket/src/main/java/io/helidon/webserver/testing/junit5/websocket/DirectWsServerContext.java similarity index 89% rename from nima/testing/junit5/websocket/src/main/java/io/helidon/nima/testing/junit5/websocket/DirectWsServerContext.java rename to webserver/testing/junit5/websocket/src/main/java/io/helidon/webserver/testing/junit5/websocket/DirectWsServerContext.java index 8dd359cefb2..5e158ce0bca 100644 --- a/nima/testing/junit5/websocket/src/main/java/io/helidon/nima/testing/junit5/websocket/DirectWsServerContext.java +++ b/webserver/testing/junit5/websocket/src/main/java/io/helidon/webserver/testing/junit5/websocket/DirectWsServerContext.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.testing.junit5.websocket; +package io.helidon.webserver.testing.junit5.websocket; import java.util.concurrent.ExecutorService; @@ -23,13 +23,13 @@ import io.helidon.common.context.Context; import io.helidon.common.socket.HelidonSocket; import io.helidon.common.socket.PeerInfo; -import io.helidon.nima.http.encoding.ContentEncodingContext; -import io.helidon.nima.http.media.MediaContext; -import io.helidon.nima.webserver.ConnectionContext; -import io.helidon.nima.webserver.ListenerConfig; -import io.helidon.nima.webserver.ListenerContext; -import io.helidon.nima.webserver.Router; -import io.helidon.nima.webserver.http.DirectHandlers; +import io.helidon.http.encoding.ContentEncodingContext; +import io.helidon.http.media.MediaContext; +import io.helidon.webserver.ConnectionContext; +import io.helidon.webserver.ListenerConfig; +import io.helidon.webserver.ListenerContext; +import io.helidon.webserver.Router; +import io.helidon.webserver.http.DirectHandlers; class DirectWsServerContext implements ConnectionContext, ListenerContext { private final ExecutorService executor; diff --git a/nima/testing/junit5/websocket/src/main/java/io/helidon/nima/testing/junit5/websocket/WsDirectExtension.java b/webserver/testing/junit5/websocket/src/main/java/io/helidon/webserver/testing/junit5/websocket/WsDirectExtension.java similarity index 91% rename from nima/testing/junit5/websocket/src/main/java/io/helidon/nima/testing/junit5/websocket/WsDirectExtension.java rename to webserver/testing/junit5/websocket/src/main/java/io/helidon/webserver/testing/junit5/websocket/WsDirectExtension.java index eff8f3691a5..eed95b88dd7 100644 --- a/nima/testing/junit5/websocket/src/main/java/io/helidon/nima/testing/junit5/websocket/WsDirectExtension.java +++ b/webserver/testing/junit5/websocket/src/main/java/io/helidon/webserver/testing/junit5/websocket/WsDirectExtension.java @@ -14,18 +14,18 @@ * limitations under the License. */ -package io.helidon.nima.testing.junit5.websocket; +package io.helidon.webserver.testing.junit5.websocket; import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; import java.util.Optional; -import io.helidon.nima.testing.junit5.webserver.Junit5Util; -import io.helidon.nima.testing.junit5.webserver.spi.DirectJunitExtension; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.websocket.client.WsClient; -import io.helidon.nima.websocket.webserver.WsRouting; +import io.helidon.webclient.websocket.WsClient; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.testing.junit5.Junit5Util; +import io.helidon.webserver.testing.junit5.spi.DirectJunitExtension; +import io.helidon.webserver.websocket.WsRouting; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.ParameterContext; @@ -33,7 +33,7 @@ /** * A {@link java.util.ServiceLoader} provider implementation that adds support for injection of WebSocket related - * artifacts, such as {@link io.helidon.nima.testing.junit5.websocket.DirectWsClient} in Helidon Níma unit tests. + * artifacts, such as {@link DirectWsClient} in Helidon WebServer unit tests. */ public class WsDirectExtension implements DirectJunitExtension { private final Map clients = new HashMap<>(); diff --git a/nima/testing/junit5/websocket/src/main/java/io/helidon/nima/testing/junit5/websocket/WsServerExtension.java b/webserver/testing/junit5/websocket/src/main/java/io/helidon/webserver/testing/junit5/websocket/WsServerExtension.java similarity index 83% rename from nima/testing/junit5/websocket/src/main/java/io/helidon/nima/testing/junit5/websocket/WsServerExtension.java rename to webserver/testing/junit5/websocket/src/main/java/io/helidon/webserver/testing/junit5/websocket/WsServerExtension.java index 8e5edf5653e..179af77d392 100644 --- a/nima/testing/junit5/websocket/src/main/java/io/helidon/nima/testing/junit5/websocket/WsServerExtension.java +++ b/webserver/testing/junit5/websocket/src/main/java/io/helidon/webserver/testing/junit5/websocket/WsServerExtension.java @@ -14,18 +14,18 @@ * limitations under the License. */ -package io.helidon.nima.testing.junit5.websocket; +package io.helidon.webserver.testing.junit5.websocket; import java.util.Optional; -import io.helidon.nima.testing.junit5.webserver.Junit5Util; -import io.helidon.nima.testing.junit5.webserver.spi.ServerJunitExtension; -import io.helidon.nima.webserver.ListenerConfig; -import io.helidon.nima.webserver.Router; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; -import io.helidon.nima.websocket.client.WsClient; -import io.helidon.nima.websocket.webserver.WsRouting; +import io.helidon.webclient.websocket.WsClient; +import io.helidon.webserver.ListenerConfig; +import io.helidon.webserver.Router; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; +import io.helidon.webserver.testing.junit5.Junit5Util; +import io.helidon.webserver.testing.junit5.spi.ServerJunitExtension; +import io.helidon.webserver.websocket.WsRouting; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.ParameterContext; @@ -33,7 +33,7 @@ /** * A {@link java.util.ServiceLoader} provider implementation that adds support for injection of WebSocket related - * artifacts, such as {@link io.helidon.nima.websocket.client.WsClient} in Helidon Níma integration tests. + * artifacts, such as {@link io.helidon.webclient.websocket.WsClient} in Helidon WebServer integration tests. */ public class WsServerExtension implements ServerJunitExtension { @Override diff --git a/webserver/testing/junit5/websocket/src/main/java/io/helidon/webserver/testing/junit5/websocket/package-info.java b/webserver/testing/junit5/websocket/src/main/java/io/helidon/webserver/testing/junit5/websocket/package-info.java new file mode 100644 index 00000000000..e98180b74cf --- /dev/null +++ b/webserver/testing/junit5/websocket/src/main/java/io/helidon/webserver/testing/junit5/websocket/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebServer Testing JUnit 5 Support for WebSocket. + */ +package io.helidon.webserver.testing.junit5.websocket; diff --git a/webserver/testing/junit5/websocket/src/main/java/module-info.java b/webserver/testing/junit5/websocket/src/main/java/module-info.java new file mode 100644 index 00000000000..0c0c0f5e1dc --- /dev/null +++ b/webserver/testing/junit5/websocket/src/main/java/module-info.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebServer Testing JUnit 5 Support for WebSocket. + */ +module io.helidon.webserver.testing.junit5.websocket { + requires transitive io.helidon.webserver.testing.junit5; + requires io.helidon.webserver.websocket; + requires io.helidon.webclient.websocket; + + exports io.helidon.webserver.testing.junit5.websocket; + + provides io.helidon.webserver.testing.junit5.spi.ServerJunitExtension + with io.helidon.webserver.testing.junit5.websocket.WsServerExtension; + + provides io.helidon.webserver.testing.junit5.spi.DirectJunitExtension + with io.helidon.webserver.testing.junit5.websocket.WsDirectExtension; +} \ No newline at end of file diff --git a/nima/testing/junit5/websocket/src/test/java/io/helidon/nima/testing/junit5/websocket/WsDirectTestingTest.java b/webserver/testing/junit5/websocket/src/test/java/io/helidon/webserver/testing/junit5/websocket/WsDirectTestingTest.java similarity index 79% rename from nima/testing/junit5/websocket/src/test/java/io/helidon/nima/testing/junit5/websocket/WsDirectTestingTest.java rename to webserver/testing/junit5/websocket/src/test/java/io/helidon/webserver/testing/junit5/websocket/WsDirectTestingTest.java index 86c3809d37a..099962ead17 100644 --- a/nima/testing/junit5/websocket/src/test/java/io/helidon/nima/testing/junit5/websocket/WsDirectTestingTest.java +++ b/webserver/testing/junit5/websocket/src/test/java/io/helidon/webserver/testing/junit5/websocket/WsDirectTestingTest.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.nima.testing.junit5.websocket; +package io.helidon.webserver.testing.junit5.websocket; -import io.helidon.nima.testing.junit5.webserver.DirectClient; -import io.helidon.nima.testing.junit5.webserver.RoutingTest; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.websocket.client.WsClient; +import io.helidon.webserver.testing.junit5.DirectClient; +import io.helidon.webserver.testing.junit5.RoutingTest; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.websocket.WsClient; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.instanceOf; diff --git a/nima/testing/junit5/websocket/src/test/java/io/helidon/nima/testing/junit5/websocket/WsSocketAbstractTestingTest.java b/webserver/testing/junit5/websocket/src/test/java/io/helidon/webserver/testing/junit5/websocket/WsSocketAbstractTestingTest.java similarity index 90% rename from nima/testing/junit5/websocket/src/test/java/io/helidon/nima/testing/junit5/websocket/WsSocketAbstractTestingTest.java rename to webserver/testing/junit5/websocket/src/test/java/io/helidon/webserver/testing/junit5/websocket/WsSocketAbstractTestingTest.java index 5a302cf2c51..e94f67d6b76 100644 --- a/nima/testing/junit5/websocket/src/test/java/io/helidon/nima/testing/junit5/websocket/WsSocketAbstractTestingTest.java +++ b/webserver/testing/junit5/websocket/src/test/java/io/helidon/webserver/testing/junit5/websocket/WsSocketAbstractTestingTest.java @@ -14,20 +14,20 @@ * limitations under the License. */ -package io.helidon.nima.testing.junit5.websocket; +package io.helidon.webserver.testing.junit5.websocket; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.testing.junit5.webserver.Socket; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.websocket.WsCloseCodes; -import io.helidon.nima.websocket.WsListener; -import io.helidon.nima.websocket.WsSession; -import io.helidon.nima.websocket.client.WsClient; -import io.helidon.nima.websocket.webserver.WsRouting; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webserver.testing.junit5.Socket; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.websocket.WsCloseCodes; +import io.helidon.websocket.WsListener; +import io.helidon.websocket.WsSession; +import io.helidon.webclient.websocket.WsClient; +import io.helidon.webserver.websocket.WsRouting; import org.junit.jupiter.api.Test; diff --git a/nima/testing/junit5/websocket/src/test/java/io/helidon/nima/testing/junit5/websocket/WsSocketServerTestingTest.java b/webserver/testing/junit5/websocket/src/test/java/io/helidon/webserver/testing/junit5/websocket/WsSocketServerTestingTest.java similarity index 80% rename from nima/testing/junit5/websocket/src/test/java/io/helidon/nima/testing/junit5/websocket/WsSocketServerTestingTest.java rename to webserver/testing/junit5/websocket/src/test/java/io/helidon/webserver/testing/junit5/websocket/WsSocketServerTestingTest.java index 57c3f4b4679..e03e6fe8ec4 100644 --- a/nima/testing/junit5/websocket/src/test/java/io/helidon/nima/testing/junit5/websocket/WsSocketServerTestingTest.java +++ b/webserver/testing/junit5/websocket/src/test/java/io/helidon/webserver/testing/junit5/websocket/WsSocketServerTestingTest.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.nima.testing.junit5.websocket; +package io.helidon.webserver.testing.junit5.websocket; -import io.helidon.nima.testing.junit5.webserver.DirectClient; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.websocket.client.WsClient; +import io.helidon.webserver.testing.junit5.DirectClient; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.websocket.WsClient; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.MatcherAssert.assertThat; diff --git a/nima/testing/junit5/websocket/src/test/resources/logging.properties b/webserver/testing/junit5/websocket/src/test/resources/logging.properties similarity index 100% rename from nima/testing/junit5/websocket/src/test/resources/logging.properties rename to webserver/testing/junit5/websocket/src/test/resources/logging.properties diff --git a/webserver/testing/pom.xml b/webserver/testing/pom.xml new file mode 100644 index 00000000000..f69930d8b09 --- /dev/null +++ b/webserver/testing/pom.xml @@ -0,0 +1,40 @@ + + + + + 4.0.0 + + io.helidon.webserver + helidon-webserver-project + 4.0.0-SNAPSHOT + + + io.helidon.webserver.testing + helidon-webserver-testing-project + Helidon WebServer Testing Project + + pom + + + junit5 + + + diff --git a/webserver/tests/access-log/pom.xml b/webserver/tests/access-log/pom.xml new file mode 100644 index 00000000000..8ae43768a27 --- /dev/null +++ b/webserver/tests/access-log/pom.xml @@ -0,0 +1,56 @@ + + + + 4.0.0 + + io.helidon.webserver.tests + helidon-webserver-tests-project + 4.0.0-SNAPSHOT + + + helidon-webserver-tests-access-log + Helidon WebServer Tests Access Log + WebServer Access Log tests + + + + io.helidon.webserver + helidon-webserver + + + io.helidon.webserver + helidon-webserver-access-log + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + diff --git a/nima/tests/integration/webserver/access-log/src/test/java/io/helidon/nima/tests/integration/server/accesslog/AccessLogTest.java b/webserver/tests/access-log/src/test/java/io/helidon/webserver/tests/accesslog/AccessLogTest.java similarity index 86% rename from nima/tests/integration/webserver/access-log/src/test/java/io/helidon/nima/tests/integration/server/accesslog/AccessLogTest.java rename to webserver/tests/access-log/src/test/java/io/helidon/webserver/tests/accesslog/AccessLogTest.java index cd54303bba4..7aca6fa1728 100644 --- a/nima/tests/integration/webserver/access-log/src/test/java/io/helidon/nima/tests/integration/server/accesslog/AccessLogTest.java +++ b/webserver/tests/access-log/src/test/java/io/helidon/webserver/tests/accesslog/AccessLogTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.tests.integration.server.accesslog; +package io.helidon.webserver.tests.accesslog; import java.io.ByteArrayOutputStream; import java.io.UnsupportedEncodingException; @@ -27,19 +27,19 @@ import java.util.logging.LogRecord; import java.util.logging.StreamHandler; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.common.testing.http.junit5.SocketHttpClient; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.accesslog.AccessLogFeature; -import io.helidon.nima.webserver.accesslog.HostLogEntry; -import io.helidon.nima.webserver.accesslog.RequestLineLogEntry; -import io.helidon.nima.webserver.accesslog.StatusLogEntry; -import io.helidon.nima.webserver.accesslog.TimestampLogEntry; -import io.helidon.nima.webserver.accesslog.UserLogEntry; -import io.helidon.nima.webserver.http.HttpRouting; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.accesslog.AccessLogFeature; +import io.helidon.webserver.accesslog.HostLogEntry; +import io.helidon.webserver.accesslog.RequestLineLogEntry; +import io.helidon.webserver.accesslog.StatusLogEntry; +import io.helidon.webserver.accesslog.TimestampLogEntry; +import io.helidon.webserver.accesslog.UserLogEntry; +import io.helidon.webserver.http.HttpRouting; import org.junit.jupiter.api.Test; diff --git a/webserver/tests/access-log/src/test/resources/logging-test.properties b/webserver/tests/access-log/src/test/resources/logging-test.properties new file mode 100644 index 00000000000..a576117aadc --- /dev/null +++ b/webserver/tests/access-log/src/test/resources/logging-test.properties @@ -0,0 +1,27 @@ +# +# Copyright (c) 2022, 2023 Oracle and/or its affiliates. +# +# 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. +# +handlers=java.util.logging.ConsoleHandler +java.util.logging.ConsoleHandler.level=FINEST +java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter +java.util.logging.SimpleFormatter.format=%1$tH:%1$tM:%1$tS %4$s %3$s %5$s%6$s%n +# Global logging level. Can be overridden by specific loggers +.level=INFO + +io.helidon.webserver.accesslog.MemoryLogHandler.level=FINEST +io.helidon.webserver.accesslog.MemoryLogHandler.append=false +io.helidon.webserver.AccessLog.level=INFO +io.helidon.webserver.AccessLog.useParentHandlers=false +io.helidon.webserver.AccessLog.handlers=io.helidon.webserver.tests.accesslog.AccessLogTest$MemoryLogHandler diff --git a/webserver/tests/gh2631/pom.xml b/webserver/tests/gh2631/pom.xml new file mode 100644 index 00000000000..49b703d71b2 --- /dev/null +++ b/webserver/tests/gh2631/pom.xml @@ -0,0 +1,60 @@ + + + + 4.0.0 + + io.helidon.webserver.tests + helidon-webserver-tests-project + 4.0.0-SNAPSHOT + + + helidon-webserver-tests-gh2631 + Helidon WebServer Tests GH 2631 + + + + io.helidon.webserver + helidon-webserver + + + io.helidon.webserver + helidon-webserver-static-content + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 + test + + + io.helidon.logging + helidon-logging-jul + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + + \ No newline at end of file diff --git a/tests/integration/webserver/gh2631/src/main/java/io/helidon/tests/integration/webserver/gh2631/Gh2631.java b/webserver/tests/gh2631/src/main/java/io/helidon/webserver/tests/gh2631/Gh2631.java similarity index 89% rename from tests/integration/webserver/gh2631/src/main/java/io/helidon/tests/integration/webserver/gh2631/Gh2631.java rename to webserver/tests/gh2631/src/main/java/io/helidon/webserver/tests/gh2631/Gh2631.java index abca395730d..32a40a82d23 100644 --- a/tests/integration/webserver/gh2631/src/main/java/io/helidon/tests/integration/webserver/gh2631/Gh2631.java +++ b/webserver/tests/gh2631/src/main/java/io/helidon/webserver/tests/gh2631/Gh2631.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.tests.integration.webserver.gh2631; +package io.helidon.webserver.tests.gh2631; import java.nio.file.Paths; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.staticcontent.StaticContentService; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.staticcontent.StaticContentService; public class Gh2631 { public static void main(String[] args) { diff --git a/tests/integration/webserver/gh2631/src/main/resources/fallback/index.txt b/webserver/tests/gh2631/src/main/resources/fallback/index.txt similarity index 100% rename from tests/integration/webserver/gh2631/src/main/resources/fallback/index.txt rename to webserver/tests/gh2631/src/main/resources/fallback/index.txt diff --git a/tests/integration/webserver/gh2631/src/main/resources/logging.properties b/webserver/tests/gh2631/src/main/resources/logging.properties similarity index 100% rename from tests/integration/webserver/gh2631/src/main/resources/logging.properties rename to webserver/tests/gh2631/src/main/resources/logging.properties diff --git a/tests/integration/webserver/gh2631/src/main/resources/web/first/index.txt b/webserver/tests/gh2631/src/main/resources/web/first/index.txt similarity index 100% rename from tests/integration/webserver/gh2631/src/main/resources/web/first/index.txt rename to webserver/tests/gh2631/src/main/resources/web/first/index.txt diff --git a/tests/integration/webserver/gh2631/src/main/resources/web/index.txt b/webserver/tests/gh2631/src/main/resources/web/index.txt similarity index 100% rename from tests/integration/webserver/gh2631/src/main/resources/web/index.txt rename to webserver/tests/gh2631/src/main/resources/web/index.txt diff --git a/tests/integration/webserver/gh2631/src/test/java/io/helidon/tests/integration/webserver/gh2631/Gh2631Test.java b/webserver/tests/gh2631/src/test/java/io/helidon/webserver/tests/gh2631/Gh2631Test.java similarity index 87% rename from tests/integration/webserver/gh2631/src/test/java/io/helidon/tests/integration/webserver/gh2631/Gh2631Test.java rename to webserver/tests/gh2631/src/test/java/io/helidon/webserver/tests/gh2631/Gh2631Test.java index 2f72dfba1e1..5540975f319 100644 --- a/tests/integration/webserver/gh2631/src/test/java/io/helidon/tests/integration/webserver/gh2631/Gh2631Test.java +++ b/webserver/tests/gh2631/src/test/java/io/helidon/webserver/tests/gh2631/Gh2631Test.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package io.helidon.tests.integration.webserver.gh2631; - -import io.helidon.common.http.Http; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpServer; -import io.helidon.nima.webclient.api.HttpClientResponse; -import io.helidon.nima.webclient.http1.Http1Client; -import io.helidon.nima.webclient.http1.Http1ClientResponse; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.WebServerConfig; +package io.helidon.webserver.tests.gh2631; + +import io.helidon.http.Http; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpServer; +import io.helidon.webclient.api.HttpClientResponse; +import io.helidon.webclient.http1.Http1Client; +import io.helidon.webclient.http1.Http1ClientResponse; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.WebServerConfig; import org.junit.jupiter.api.Test; diff --git a/webserver/tests/grpc/pom.xml b/webserver/tests/grpc/pom.xml new file mode 100644 index 00000000000..46a9a91acd9 --- /dev/null +++ b/webserver/tests/grpc/pom.xml @@ -0,0 +1,99 @@ + + + + 4.0.0 + + io.helidon.webserver.tests + helidon-webserver-tests-project + 4.0.0-SNAPSHOT + + + helidon-webserver-tests-grpc + Helidon WebServer Tests gRPC + WebServer gRPC tests + + + + io.helidon.webserver + helidon-webserver-grpc + + + com.google.protobuf + protobuf-java + + + + + javax.annotation + javax.annotation-api + 1.3.2 + true + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + io.grpc + grpc-netty + test + + + + + + + kr.motd.maven + os-maven-plugin + ${version.plugin.os} + + + + + org.xolstice.maven.plugins + protobuf-maven-plugin + + + + compile + compile-custom + + + + + com.google.protobuf:protoc:3.5.1-1:exe:${os.detected.classifier} + grpc-java + io.grpc:protoc-gen-grpc-java:${version.lib.grpc}:exe:${os.detected.classifier} + + + + + + diff --git a/nima/tests/integration/grpc/server/src/main/java/io/helidon/nima/tests/integration/grpc/webserver/BindableStringService.java b/webserver/tests/grpc/src/main/java/io/helidon/webserver/tests/grpc/BindableStringService.java similarity index 88% rename from nima/tests/integration/grpc/server/src/main/java/io/helidon/nima/tests/integration/grpc/webserver/BindableStringService.java rename to webserver/tests/grpc/src/main/java/io/helidon/webserver/tests/grpc/BindableStringService.java index e70a88dae07..f7710b036eb 100644 --- a/nima/tests/integration/grpc/server/src/main/java/io/helidon/nima/tests/integration/grpc/webserver/BindableStringService.java +++ b/webserver/tests/grpc/src/main/java/io/helidon/webserver/tests/grpc/BindableStringService.java @@ -14,20 +14,20 @@ * limitations under the License. */ -package io.helidon.nima.tests.integration.grpc.webserver; +package io.helidon.webserver.tests.grpc; import java.util.Locale; import java.util.stream.Collectors; import java.util.stream.Stream; -import io.helidon.nima.grpc.strings.StringServiceGrpc; -import io.helidon.nima.grpc.strings.Strings; -import io.helidon.nima.grpc.webserver.CollectingObserver; +import io.helidon.webserver.grpc.strings.StringServiceGrpc; +import io.helidon.webserver.grpc.strings.Strings; +import io.helidon.webserver.grpc.CollectingObserver; import io.grpc.stub.StreamObserver; -import static io.helidon.nima.grpc.webserver.ResponseHelper.complete; -import static io.helidon.nima.grpc.webserver.ResponseHelper.stream; +import static io.helidon.webserver.grpc.ResponseHelper.complete; +import static io.helidon.webserver.grpc.ResponseHelper.stream; public class BindableStringService extends StringServiceGrpc.StringServiceImplBase { diff --git a/nima/tests/integration/grpc/server/src/main/java/io/helidon/nima/tests/integration/grpc/webserver/EventService.java b/webserver/tests/grpc/src/main/java/io/helidon/webserver/tests/grpc/EventService.java similarity index 96% rename from nima/tests/integration/grpc/server/src/main/java/io/helidon/nima/tests/integration/grpc/webserver/EventService.java rename to webserver/tests/grpc/src/main/java/io/helidon/webserver/tests/grpc/EventService.java index 28da3326fa3..7a85be64979 100644 --- a/nima/tests/integration/grpc/server/src/main/java/io/helidon/nima/tests/integration/grpc/webserver/EventService.java +++ b/webserver/tests/grpc/src/main/java/io/helidon/webserver/tests/grpc/EventService.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.tests.integration.grpc.webserver; +package io.helidon.webserver.tests.grpc; import java.util.ArrayList; import java.util.HashSet; @@ -24,14 +24,14 @@ import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; -import io.helidon.nima.grpc.events.Events; -import io.helidon.nima.grpc.webserver.GrpcService; +import io.helidon.webserver.grpc.events.Events; +import io.helidon.webserver.grpc.GrpcService; import com.google.protobuf.Descriptors; import com.google.protobuf.Empty; import io.grpc.stub.StreamObserver; -import static io.helidon.nima.grpc.webserver.ResponseHelper.complete; +import static io.helidon.webserver.grpc.ResponseHelper.complete; /** * A simple service to send events to subscriber listeners. diff --git a/nima/tests/integration/grpc/server/src/main/java/io/helidon/nima/tests/integration/grpc/webserver/StringService.java b/webserver/tests/grpc/src/main/java/io/helidon/webserver/tests/grpc/StringService.java similarity index 87% rename from nima/tests/integration/grpc/server/src/main/java/io/helidon/nima/tests/integration/grpc/webserver/StringService.java rename to webserver/tests/grpc/src/main/java/io/helidon/webserver/tests/grpc/StringService.java index a156f82635f..1593d295df4 100644 --- a/nima/tests/integration/grpc/server/src/main/java/io/helidon/nima/tests/integration/grpc/webserver/StringService.java +++ b/webserver/tests/grpc/src/main/java/io/helidon/webserver/tests/grpc/StringService.java @@ -14,22 +14,22 @@ * limitations under the License. */ -package io.helidon.nima.tests.integration.grpc.webserver; +package io.helidon.webserver.tests.grpc; import java.util.Locale; import java.util.stream.Collectors; import java.util.stream.Stream; -import io.helidon.nima.grpc.strings.Strings; -import io.helidon.nima.grpc.strings.Strings.StringMessage; -import io.helidon.nima.grpc.webserver.CollectingObserver; -import io.helidon.nima.grpc.webserver.GrpcService; +import io.helidon.webserver.grpc.strings.Strings; +import io.helidon.webserver.grpc.strings.Strings.StringMessage; +import io.helidon.webserver.grpc.CollectingObserver; +import io.helidon.webserver.grpc.GrpcService; import com.google.protobuf.Descriptors; import io.grpc.stub.StreamObserver; -import static io.helidon.nima.grpc.webserver.ResponseHelper.complete; -import static io.helidon.nima.grpc.webserver.ResponseHelper.stream; +import static io.helidon.webserver.grpc.ResponseHelper.complete; +import static io.helidon.webserver.grpc.ResponseHelper.stream; class StringService implements GrpcService { @Override diff --git a/webserver/tests/grpc/src/main/proto/events.proto b/webserver/tests/grpc/src/main/proto/events.proto new file mode 100644 index 00000000000..61cbdd3cd95 --- /dev/null +++ b/webserver/tests/grpc/src/main/proto/events.proto @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * 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. + */ + + +syntax = "proto3"; +option java_package = "io.helidon.webserver.grpc.events"; + +import "google/protobuf/empty.proto"; + +service EventService { + rpc Send (Message) returns (google.protobuf.Empty) {} + rpc Events (stream EventRequest) returns (stream EventResponse) {} +} + +message Message { + string text = 2; +} + +message EventRequest { + int64 id = 1; + enum Action { + SUBSCRIBE = 0; + UNSUBSCRIBE = 1; + } + Action action = 2; +} + +message EventResponse { + oneof response_type { + Subscribed subscribed = 1; + Unsubscribed unsubscribed = 2; + Event event = 3; + } +} + +message Subscribed { + int64 id = 1; +} + +message Unsubscribed { + int64 id = 1; +} + +message Event { + int64 id = 1; + string text = 2; +} \ No newline at end of file diff --git a/webserver/tests/grpc/src/main/proto/strings.proto b/webserver/tests/grpc/src/main/proto/strings.proto new file mode 100644 index 00000000000..17f1d1ebfea --- /dev/null +++ b/webserver/tests/grpc/src/main/proto/strings.proto @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2021 Oracle and/or its affiliates. + * + * 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. + */ + + +syntax = "proto3"; +option java_package = "io.helidon.webserver.grpc.strings"; + +service StringService { + rpc Upper (StringMessage) returns (StringMessage) {} + rpc Lower (StringMessage) returns (StringMessage) {} + rpc Split (StringMessage) returns (stream StringMessage) {} + rpc Join (stream StringMessage) returns (StringMessage) {} + rpc Echo (stream StringMessage) returns (stream StringMessage) {} +} + +message StringMessage { + string text = 1; +} diff --git a/nima/tests/integration/grpc/server/src/test/java/io/helidon/nima/tests/integration/grpc/webserver/BaseStringServiceTest.java b/webserver/tests/grpc/src/test/java/io/helidon/webserver/tests/grpc/BaseStringServiceTest.java similarity index 92% rename from nima/tests/integration/grpc/server/src/test/java/io/helidon/nima/tests/integration/grpc/webserver/BaseStringServiceTest.java rename to webserver/tests/grpc/src/test/java/io/helidon/webserver/tests/grpc/BaseStringServiceTest.java index 5cf620e13e3..154db0a4b71 100644 --- a/nima/tests/integration/grpc/server/src/test/java/io/helidon/nima/tests/integration/grpc/webserver/BaseStringServiceTest.java +++ b/webserver/tests/grpc/src/test/java/io/helidon/webserver/tests/grpc/BaseStringServiceTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.tests.integration.grpc.webserver; +package io.helidon.webserver.tests.grpc; import java.util.LinkedList; import java.util.List; @@ -22,13 +22,10 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.TimeUnit; -import io.helidon.nima.grpc.strings.StringServiceGrpc; -import io.helidon.nima.grpc.strings.Strings.StringMessage; -import io.helidon.nima.grpc.webserver.GrpcRouting; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webserver.Router; -import io.helidon.nima.webserver.WebServer; +import io.helidon.webserver.grpc.strings.StringServiceGrpc; +import io.helidon.webserver.grpc.strings.Strings.StringMessage; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.WebServer; import io.grpc.ManagedChannel; import io.grpc.ManagedChannelBuilder; diff --git a/webserver/tests/grpc/src/test/java/io/helidon/webserver/tests/grpc/BindableGrpcServiceTest.java b/webserver/tests/grpc/src/test/java/io/helidon/webserver/tests/grpc/BindableGrpcServiceTest.java new file mode 100644 index 00000000000..5d0b339f10c --- /dev/null +++ b/webserver/tests/grpc/src/test/java/io/helidon/webserver/tests/grpc/BindableGrpcServiceTest.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.webserver.tests.grpc; + +import io.helidon.webserver.grpc.strings.Strings; +import io.helidon.webserver.grpc.GrpcRouting; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webserver.Router; +import io.helidon.webserver.WebServer; + +@ServerTest +class BindableGrpcServiceTest + extends BaseStringServiceTest { + BindableGrpcServiceTest(WebServer server) { + super(server); + } + + @SetUpRoute + static void routing(Router.RouterBuilder router) { + router.addRouting(GrpcRouting.builder().service(Strings.getDescriptor(), new BindableStringService())); + } +} \ No newline at end of file diff --git a/nima/tests/integration/grpc/server/src/test/java/io/helidon/nima/tests/integration/grpc/webserver/EventsTest.java b/webserver/tests/grpc/src/test/java/io/helidon/webserver/tests/grpc/EventsTest.java similarity index 93% rename from nima/tests/integration/grpc/server/src/test/java/io/helidon/nima/tests/integration/grpc/webserver/EventsTest.java rename to webserver/tests/grpc/src/test/java/io/helidon/webserver/tests/grpc/EventsTest.java index 6b504a258a3..c137c81de07 100644 --- a/nima/tests/integration/grpc/server/src/test/java/io/helidon/nima/tests/integration/grpc/webserver/EventsTest.java +++ b/webserver/tests/grpc/src/test/java/io/helidon/webserver/tests/grpc/EventsTest.java @@ -14,20 +14,20 @@ * limitations under the License. */ -package io.helidon.nima.tests.integration.grpc.webserver; +package io.helidon.webserver.tests.grpc; import java.util.ArrayList; import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import io.helidon.nima.grpc.events.EventServiceGrpc; -import io.helidon.nima.grpc.events.Events; -import io.helidon.nima.grpc.webserver.GrpcRouting; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webserver.Router; -import io.helidon.nima.webserver.WebServer; +import io.helidon.webserver.grpc.events.EventServiceGrpc; +import io.helidon.webserver.grpc.events.Events; +import io.helidon.webserver.grpc.GrpcRouting; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webserver.Router; +import io.helidon.webserver.WebServer; import io.grpc.ManagedChannel; import io.grpc.ManagedChannelBuilder; diff --git a/nima/tests/integration/grpc/server/src/test/java/io/helidon/nima/tests/integration/grpc/webserver/InterceptorGrpcServiceTest.java b/webserver/tests/grpc/src/test/java/io/helidon/webserver/tests/grpc/InterceptorGrpcServiceTest.java similarity index 87% rename from nima/tests/integration/grpc/server/src/test/java/io/helidon/nima/tests/integration/grpc/webserver/InterceptorGrpcServiceTest.java rename to webserver/tests/grpc/src/test/java/io/helidon/webserver/tests/grpc/InterceptorGrpcServiceTest.java index ca431613e20..7d68165e641 100644 --- a/nima/tests/integration/grpc/server/src/test/java/io/helidon/nima/tests/integration/grpc/webserver/InterceptorGrpcServiceTest.java +++ b/webserver/tests/grpc/src/test/java/io/helidon/webserver/tests/grpc/InterceptorGrpcServiceTest.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.nima.tests.integration.grpc.webserver; - -import io.helidon.nima.grpc.strings.Strings; -import io.helidon.nima.grpc.webserver.GrpcRouting; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webserver.Router; -import io.helidon.nima.webserver.WebServer; +package io.helidon.webserver.tests.grpc; + +import io.helidon.webserver.grpc.strings.Strings; +import io.helidon.webserver.grpc.GrpcRouting; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webserver.Router; +import io.helidon.webserver.WebServer; import io.grpc.Metadata; import io.grpc.ServerCall; diff --git a/nima/tests/integration/grpc/server/src/test/java/io/helidon/nima/tests/integration/grpc/webserver/ServiceDefinitionGrpcServiceTest.java b/webserver/tests/grpc/src/test/java/io/helidon/webserver/tests/grpc/ServiceDefinitionGrpcServiceTest.java similarity index 75% rename from nima/tests/integration/grpc/server/src/test/java/io/helidon/nima/tests/integration/grpc/webserver/ServiceDefinitionGrpcServiceTest.java rename to webserver/tests/grpc/src/test/java/io/helidon/webserver/tests/grpc/ServiceDefinitionGrpcServiceTest.java index b943be6262c..0bfe64e9e5e 100644 --- a/nima/tests/integration/grpc/server/src/test/java/io/helidon/nima/tests/integration/grpc/webserver/ServiceDefinitionGrpcServiceTest.java +++ b/webserver/tests/grpc/src/test/java/io/helidon/webserver/tests/grpc/ServiceDefinitionGrpcServiceTest.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.helidon.nima.tests.integration.grpc.webserver; +package io.helidon.webserver.tests.grpc; -import io.helidon.nima.grpc.webserver.GrpcRouting; -import io.helidon.nima.testing.junit5.webserver.ServerTest; -import io.helidon.nima.testing.junit5.webserver.SetUpRoute; -import io.helidon.nima.webserver.Router; -import io.helidon.nima.webserver.WebServer; +import io.helidon.webserver.grpc.GrpcRouting; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webserver.Router; +import io.helidon.webserver.WebServer; @ServerTest class ServiceDefinitionGrpcServiceTest diff --git a/webserver/tests/grpc/src/test/java/io/helidon/webserver/tests/grpc/StringServiceTest.java b/webserver/tests/grpc/src/test/java/io/helidon/webserver/tests/grpc/StringServiceTest.java new file mode 100644 index 00000000000..98d45848e69 --- /dev/null +++ b/webserver/tests/grpc/src/test/java/io/helidon/webserver/tests/grpc/StringServiceTest.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.webserver.tests.grpc; + +import io.helidon.webserver.grpc.GrpcRouting; +import io.helidon.webserver.testing.junit5.ServerTest; +import io.helidon.webserver.testing.junit5.SetUpRoute; +import io.helidon.webserver.Router; +import io.helidon.webserver.WebServer; + +@ServerTest +class StringServiceTest + extends BaseStringServiceTest { + StringServiceTest(WebServer server) { + super(server); + } + + @SetUpRoute + static void routing(Router.RouterBuilder router) { + router.addRouting(GrpcRouting.builder().service(new StringService())); + } +} diff --git a/webserver/tests/grpc/src/test/resources/logging.properties b/webserver/tests/grpc/src/test/resources/logging.properties new file mode 100644 index 00000000000..d8b7bcf95d8 --- /dev/null +++ b/webserver/tests/grpc/src/test/resources/logging.properties @@ -0,0 +1,21 @@ +# +# Copyright (c) 2022, 2023 Oracle and/or its affiliates. +# +# 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. +# +handlers=io.helidon.logging.jul.HelidonConsoleHandler +java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS.%1$tL %5$s%6$s%n +# Global logging level. Can be overridden by specific loggers +.level=INFO + +# io.helidon.webserver.level=FINEST diff --git a/webserver/tests/http2/pom.xml b/webserver/tests/http2/pom.xml new file mode 100644 index 00000000000..e2e52853cba --- /dev/null +++ b/webserver/tests/http2/pom.xml @@ -0,0 +1,62 @@ + + + + 4.0.0 + + io.helidon.webserver.tests + helidon-webserver-tests-project + 4.0.0-SNAPSHOT + + + helidon-webserver-tests-http2 + Helidon WebServer Tests HTTP/2 + WebServer HTTP/2 tests + + + + io.helidon.webserver + helidon-webserver-http2 + + + io.helidon.webserver.testing.junit5 + helidon-webserver-testing-junit5 + test + + + io.helidon.common + helidon-common-reactive + test + + + io.helidon.webclient + helidon-webclient-http2 + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + diff --git a/nima/tests/integration/http2/server/src/test/java/io/helidon/nima/tests/integration/http2/webserver/CutConnectionTest.java b/webserver/tests/http2/src/test/java/io/helidon/webserver/tests/http2/CutConnectionTest.java similarity index 88% rename from nima/tests/integration/http2/server/src/test/java/io/helidon/nima/tests/integration/http2/webserver/CutConnectionTest.java rename to webserver/tests/http2/src/test/java/io/helidon/webserver/tests/http2/CutConnectionTest.java index b71af81b910..097af9acd5e 100644 --- a/nima/tests/integration/http2/server/src/test/java/io/helidon/nima/tests/integration/http2/webserver/CutConnectionTest.java +++ b/webserver/tests/http2/src/test/java/io/helidon/webserver/tests/http2/CutConnectionTest.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.nima.tests.integration.http2.webserver; +package io.helidon.webserver.tests.http2; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.logging.common.LogConfig; -import io.helidon.nima.http2.webserver.Http2Route; -import io.helidon.nima.webserver.WebServer; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http2.Http2Route; +import io.helidon.webserver.WebServer; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; import org.junit.jupiter.api.Test; import java.io.IOException; @@ -47,7 +47,7 @@ public class CutConnectionTest { private static final AssertingHandler ASSERTING_HANDLER = new AssertingHandler(); - private static final Logger NIMA_LOGGER = Logger.getLogger("io.helidon.nima"); + private static final Logger WEBSERVER_LOGGER = Logger.getLogger("io.helidon.webserver"); private static final int TIME_OUT_SEC = 10; static { @@ -80,9 +80,9 @@ void testStringRoute() throws Exception { ExecutorService exec = Executors.newSingleThreadExecutor(); Level originalLevel = Level.INFO; try { - originalLevel = NIMA_LOGGER.getLevel(); - NIMA_LOGGER.setLevel(Level.FINE); - NIMA_LOGGER.addHandler(ASSERTING_HANDLER); + originalLevel = WEBSERVER_LOGGER.getLevel(); + WEBSERVER_LOGGER.setLevel(Level.FINE); + WEBSERVER_LOGGER.addHandler(ASSERTING_HANDLER); WebServer server = WebServer.builder() .host("localhost") .routing(r -> r.route(Http2Route.route(Http.Method.GET, "/stream", CutConnectionTest::stream))) @@ -116,8 +116,8 @@ void testStringRoute() throws Exception { SocketClosedLog log = ASSERTING_HANDLER.socketClosedLog.get(TIME_OUT_SEC, TimeUnit.SECONDS); assertThat(log.record.getLevel(), is(Level.FINE)); } finally { - NIMA_LOGGER.removeHandler(ASSERTING_HANDLER); - NIMA_LOGGER.setLevel(originalLevel); + WEBSERVER_LOGGER.removeHandler(ASSERTING_HANDLER); + WEBSERVER_LOGGER.setLevel(originalLevel); } } @@ -129,7 +129,7 @@ private record SocketClosedLog(LogRecord record, SocketException e) { /** * DEBUG level logging for attempts to write to closed socket is expected: *
        {@code
        -     * 023.05.23 14:51:53 FINE io.helidon.nima.http2.webserver.Http2Connection !thread!: Socket error on writer thread
        +     * 023.05.23 14:51:53 FINE io.helidon.webserver.http2.Http2Connection !thread!: Socket error on writer thread
              * java.io.UncheckedIOException: java.net.SocketException: Socket closed
              * 	at io.helidon.common.buffers.FixedBufferData.writeTo(FixedBufferData.java:74)
              * 	at io.helidon.common.buffers.CompositeArrayBufferData.writeTo(CompositeArrayBufferData.java:41)
        diff --git a/nima/tests/integration/http2/server/src/test/java/io/helidon/nima/tests/integration/http2/webserver/FlowControlTest.java b/webserver/tests/http2/src/test/java/io/helidon/webserver/tests/http2/FlowControlTest.java
        similarity index 94%
        rename from nima/tests/integration/http2/server/src/test/java/io/helidon/nima/tests/integration/http2/webserver/FlowControlTest.java
        rename to webserver/tests/http2/src/test/java/io/helidon/webserver/tests/http2/FlowControlTest.java
        index 1c4eb97037c..61ab66cad53 100644
        --- a/nima/tests/integration/http2/server/src/test/java/io/helidon/nima/tests/integration/http2/webserver/FlowControlTest.java
        +++ b/webserver/tests/http2/src/test/java/io/helidon/webserver/tests/http2/FlowControlTest.java
        @@ -13,7 +13,7 @@
          * See the License for the specific language governing permissions and
          * limitations under the License.
          */
        -package io.helidon.nima.tests.integration.http2.webserver;
        +package io.helidon.webserver.tests.http2;
         
         import java.io.IOException;
         import java.io.InputStream;
        @@ -34,21 +34,21 @@
         
         import io.helidon.common.reactive.BufferedEmittingPublisher;
         import io.helidon.common.reactive.Multi;
        -import io.helidon.nima.http2.WindowSize;
        -import io.helidon.nima.http2.webclient.Http2Client;
        -import io.helidon.nima.http2.webserver.Http2Config;
        -import io.helidon.nima.http2.webserver.Http2ConnectionSelector;
        -import io.helidon.nima.http2.webserver.Http2Route;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpServer;
        -import io.helidon.nima.webserver.WebServer;
        -import io.helidon.nima.webserver.WebServerConfig;
        +import io.helidon.http.http2.WindowSize;
        +import io.helidon.webclient.http2.Http2Client;
        +import io.helidon.webserver.http2.Http2Config;
        +import io.helidon.webserver.http2.Http2ConnectionSelector;
        +import io.helidon.webserver.http2.Http2Route;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpServer;
        +import io.helidon.webserver.WebServer;
        +import io.helidon.webserver.WebServerConfig;
         
         import org.junit.jupiter.api.AfterAll;
         import org.junit.jupiter.api.Test;
         
        -import static io.helidon.common.http.Http.Method.GET;
        -import static io.helidon.common.http.Http.Method.PUT;
        +import static io.helidon.http.Http.Method.GET;
        +import static io.helidon.http.Http.Method.PUT;
         import static java.lang.System.Logger.Level.DEBUG;
         import static org.hamcrest.MatcherAssert.assertThat;
         import static org.hamcrest.Matchers.is;
        diff --git a/webserver/tests/http2/src/test/java/io/helidon/webserver/tests/http2/GetTest.java b/webserver/tests/http2/src/test/java/io/helidon/webserver/tests/http2/GetTest.java
        new file mode 100644
        index 00000000000..e2778c48c13
        --- /dev/null
        +++ b/webserver/tests/http2/src/test/java/io/helidon/webserver/tests/http2/GetTest.java
        @@ -0,0 +1,174 @@
        +/*
        + * Copyright (c) 2022, 2023 Oracle and/or its affiliates.
        + *
        + * Licensed under the Apache License, Version 2.0 (the "License");
        + * you may not use this file except in compliance with the License.
        + * You may obtain a copy of the License at
        + *
        + *     http://www.apache.org/licenses/LICENSE-2.0
        + *
        + * Unless required by applicable law or agreed to in writing, software
        + * distributed under the License is distributed on an "AS IS" BASIS,
        + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        + * See the License for the specific language governing permissions and
        + * limitations under the License.
        + */
        +
        +package io.helidon.webserver.tests.http2;
        +
        +import java.io.IOException;
        +import java.io.OutputStream;
        +import java.io.UncheckedIOException;
        +import java.net.URI;
        +import java.net.http.HttpClient;
        +import java.net.http.HttpRequest;
        +import java.net.http.HttpResponse;
        +import java.time.Duration;
        +import java.util.Optional;
        +import java.util.OptionalLong;
        +import java.util.Random;
        +
        +import io.helidon.http.Http;
        +import io.helidon.http.Http.HeaderName;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webserver.http.HttpRouting;
        +import io.helidon.webserver.http.ServerRequest;
        +import io.helidon.webserver.http.ServerResponse;
        +
        +import org.junit.jupiter.api.Test;
        +
        +import static org.hamcrest.CoreMatchers.is;
        +import static org.hamcrest.MatcherAssert.assertThat;
        +
        +@ServerTest
        +class GetTest {
        +    private static final byte[] BYTES = new byte[256];
        +    private static final HeaderName REQUEST_HEADER_NAME = Http.HeaderNames.create("X-ReQUEst-header");
        +    private static final String REQUEST_HEADER_VALUE = "some nice value";
        +    private static final HeaderName RESPONSE_HEADER_NAME = Http.HeaderNames.create("X-REsponSE-HeADER");
        +    private static final String RESPONSE_HEADER_VALUE_STRING = "another nice value";
        +    private static final Http.Header RESPONSE_HEADER_VALUE = Http.Headers.create(RESPONSE_HEADER_NAME,
        +                                                                                 RESPONSE_HEADER_VALUE_STRING);
        +
        +    static {
        +        Random random = new Random();
        +        random.nextBytes(BYTES);
        +    }
        +
        +    private final HttpClient client;
        +    private final URI uri;
        +
        +    GetTest(URI uri) {
        +        this.uri = uri;
        +        client = HttpClient.newBuilder()
        +                .version(HttpClient.Version.HTTP_2)
        +                .connectTimeout(Duration.ofSeconds(5))
        +                .build();
        +    }
        +
        +    @SetUpRoute
        +    static void routing(HttpRouting.Builder router) {
        +        router.route(Http.Method.GET, "/string", Routes::string)
        +                .route(Http.Method.GET, "/bytes", Routes::bytes)
        +                .route(Http.Method.GET, "/stream", Routes::outputStream)
        +                .route(Http.Method.GET, "/headers", Routes::headers);
        +    }
        +
        +    @Test
        +    void testStringRoute() throws IOException, InterruptedException {
        +        HttpResponse response = client.send(HttpRequest.newBuilder()
        +                                                            .timeout(Duration.ofSeconds(5))
        +                                                            .uri(uri.resolve("/string"))
        +                                                            .GET()
        +                                                            .build(), HttpResponse.BodyHandlers.ofString());
        +
        +        assertThat(response.statusCode(), is(Http.Status.OK_200.code()));
        +        String entity = response.body();
        +        assertThat(entity, is("Hello"));
        +        java.net.http.HttpHeaders headers = response.headers();
        +        assertThat(headers.firstValueAsLong("content-length"), is(OptionalLong.of(5)));
        +        assertThat(response.version(), is(HttpClient.Version.HTTP_2));
        +    }
        +
        +    @Test
        +    void testByteRoute() throws IOException, InterruptedException {
        +        HttpResponse response = client.send(HttpRequest.newBuilder()
        +                                                            .timeout(Duration.ofSeconds(5))
        +                                                            .uri(uri.resolve("/bytes"))
        +                                                            .GET()
        +                                                            .build(), HttpResponse.BodyHandlers.ofByteArray());
        +
        +        assertThat(response.statusCode(), is(Http.Status.OK_200.code()));
        +        byte[] entity = response.body();
        +        assertThat(entity, is(BYTES));
        +        java.net.http.HttpHeaders headers = response.headers();
        +        assertThat(headers.firstValueAsLong("content-length"), is(OptionalLong.of(BYTES.length)));
        +        assertThat(response.version(), is(HttpClient.Version.HTTP_2));
        +    }
        +
        +    @Test
        +    void testStreamRoute() throws IOException, InterruptedException {
        +        HttpResponse response = client.send(HttpRequest.newBuilder()
        +                                                            .timeout(Duration.ofSeconds(5))
        +                                                            .uri(uri.resolve("/stream"))
        +                                                            .GET()
        +                                                            .build(), HttpResponse.BodyHandlers.ofByteArray());
        +
        +        assertThat(response.statusCode(), is(Http.Status.OK_200.code()));
        +        byte[] entity = response.body();
        +        assertThat(entity, is(BYTES));
        +        java.net.http.HttpHeaders headers = response.headers();
        +        assertThat(headers.firstValueAsLong("content-length"), is(OptionalLong.of(BYTES.length)));
        +        assertThat(response.version(), is(HttpClient.Version.HTTP_2));
        +    }
        +
        +    @Test
        +    void testHeadersRoute() throws IOException, InterruptedException {
        +        HttpResponse response = client.send(HttpRequest.newBuilder()
        +                                                            .timeout(Duration.ofSeconds(5))
        +                                                            .uri(uri.resolve("/headers"))
        +                                                            .header(REQUEST_HEADER_NAME.lowerCase(),
        +                                                                    REQUEST_HEADER_VALUE)
        +                                                            .GET()
        +                                                            .build(), HttpResponse.BodyHandlers.ofString());
        +
        +        assertThat(response.statusCode(), is(Http.Status.OK_200.code()));
        +        String entity = response.body();
        +        assertThat(entity, is("Hello"));
        +        java.net.http.HttpHeaders headers = response.headers();
        +        assertThat(headers.firstValueAsLong("content-length"), is(OptionalLong.of(5)));
        +        assertThat("Should contain echoed request header",
        +                   headers.firstValue(REQUEST_HEADER_NAME.lowerCase()),
        +                   is(Optional.of(REQUEST_HEADER_VALUE)));
        +        assertThat("Should contain configured response header",
        +                   headers.firstValue(RESPONSE_HEADER_NAME.lowerCase()),
        +                   is(Optional.of(RESPONSE_HEADER_VALUE_STRING)));
        +        assertThat(response.version(), is(HttpClient.Version.HTTP_2));
        +    }
        +
        +    private static class Routes {
        +        private static String string() {
        +            return "Hello";
        +        }
        +
        +        private static byte[] bytes() {
        +            return BYTES;
        +        }
        +
        +        private static void outputStream(ServerRequest req, ServerResponse res) {
        +            try (OutputStream outputStream = res.outputStream()) {
        +                outputStream.write(BYTES);
        +            } catch (IOException e) {
        +                throw new UncheckedIOException(e);
        +            }
        +        }
        +
        +        private static void headers(ServerRequest req, ServerResponse res) {
        +            res.header(req.headers().get(REQUEST_HEADER_NAME));
        +            res.header(RESPONSE_HEADER_VALUE);
        +            res.send("Hello");
        +        }
        +    }
        +
        +}
        diff --git a/webserver/tests/http2/src/test/java/io/helidon/webserver/tests/http2/HeadersTest.java b/webserver/tests/http2/src/test/java/io/helidon/webserver/tests/http2/HeadersTest.java
        new file mode 100644
        index 00000000000..24d829771cc
        --- /dev/null
        +++ b/webserver/tests/http2/src/test/java/io/helidon/webserver/tests/http2/HeadersTest.java
        @@ -0,0 +1,186 @@
        +/*
        + * Copyright (c) 2023 Oracle and/or its affiliates.
        + *
        + * Licensed under the Apache License, Version 2.0 (the "License");
        + * you may not use this file except in compliance with the License.
        + * You may obtain a copy of the License at
        + *
        + *     http://www.apache.org/licenses/LICENSE-2.0
        + *
        + * Unless required by applicable law or agreed to in writing, software
        + * distributed under the License is distributed on an "AS IS" BASIS,
        + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        + * See the License for the specific language governing permissions and
        + * limitations under the License.
        + */
        +
        +package io.helidon.webserver.tests.http2;
        +
        +import java.io.IOException;
        +import java.net.URI;
        +import java.net.http.HttpClient;
        +import java.net.http.HttpRequest;
        +import java.net.http.HttpResponse;
        +import java.time.Duration;
        +import java.util.HashSet;
        +import java.util.List;
        +import java.util.Set;
        +import java.util.stream.Collectors;
        +
        +import io.helidon.webserver.http2.Http2Config;
        +import io.helidon.webserver.http2.Http2ConnectionSelector;
        +import io.helidon.webserver.http2.Http2Route;
        +import io.helidon.webserver.http2.Http2Upgrader;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webserver.testing.junit5.SetUpServer;
        +import io.helidon.webserver.WebServerConfig;
        +import io.helidon.webserver.WebServer;
        +import io.helidon.webserver.http.HttpRouting;
        +import io.helidon.webserver.http1.Http1Config;
        +import io.helidon.webserver.http1.Http1ConnectionSelector;
        +
        +import org.hamcrest.Matchers;
        +import org.junit.jupiter.api.Assertions;
        +import org.junit.jupiter.api.Test;
        +
        +import static io.helidon.http.Http.Method.GET;
        +import static org.hamcrest.CoreMatchers.is;
        +import static org.hamcrest.MatcherAssert.assertThat;
        +
        +@ServerTest
        +public class HeadersTest {
        +
        +    private static final Duration TIMEOUT = Duration.ofSeconds(10);
        +    private static final String DATA = "Helidon!!!".repeat(10);
        +
        +    @SetUpServer
        +    static void setUpServer(WebServerConfig.Builder serverBuilder) {
        +        Http2Config http2Config = Http2Config.builder()
        +                .sendErrorDetails(true)
        +                .maxHeaderListSize(128_000)
        +                .build();
        +
        +        serverBuilder.port(-1)
        +                .protocolsDiscoverServices(false)
        +                // HTTP/2 prior knowledge config
        +                .addConnectionSelector(Http2ConnectionSelector.builder()
        +                                               .http2Config(http2Config)
        +                                               .build())
        +                // HTTP/1.1 -> HTTP/2 upgrade config
        +                .addConnectionSelector(Http1ConnectionSelector.builder()
        +                                               .config(Http1Config.create())
        +                        .addUpgrader(Http2Upgrader.create(http2Config))
        +                        .build());
        +    }
        +
        +    @SetUpRoute
        +    static void router(HttpRouting.Builder router) {
        +        router.route(Http2Route.route(GET, "/ping", (req, res) -> res.send("pong")));
        +        router.route(Http2Route.route(GET, "/cont-out",
        +                (req, res) -> {
        +                    for (int i = 0; i < 500; i++) {
        +                        res.header("test-header-" + i, DATA + i);
        +                    }
        +                    res.send();
        +                }
        +        ));
        +        router.route(Http2Route.route(GET, "/cont-in",
        +                (req, res) -> {
        +                    String joinedHeaders = req.headers()
        +                            .stream()
        +                            .filter(h -> h.name().startsWith("test-header-"))
        +                            .map(h -> h.name() + "=" + h.value())
        +                            .collect(Collectors.joining("\n"));
        +                    res.send(joinedHeaders);
        +                }
        +        ));
        +    }
        +
        +    @Test
        +    void serverOutbound(WebServer server) throws IOException, InterruptedException {
        +        URI base = URI.create("http://localhost:" + server.port());
        +        HttpClient client = http2Client(base);
        +
        +        Set expected = new HashSet<>(500);
        +        for (int i = 0; i < 500; i++) {
        +            expected.add("test-header-" + i + "=" + DATA + i);
        +        }
        +
        +        HttpResponse res = client.send(HttpRequest.newBuilder()
        +                .timeout(TIMEOUT)
        +                .uri(base.resolve("/cont-out"))
        +                .GET()
        +                .build(), HttpResponse.BodyHandlers.ofString());
        +
        +        List actual = res.headers()
        +                .map()
        +                .entrySet()
        +                .stream()
        +                .filter(e -> e.getKey().startsWith("test-header-"))
        +                .map(e -> e.getKey() + "=" + String.join("", e.getValue()))
        +                .toList();
        +
        +        assertThat(res.statusCode(), is(200));
        +        assertThat(actual, Matchers.containsInAnyOrder(expected.toArray(new String[0])));
        +    }
        +
        +    @Test
        +    void serverInbound(WebServer server) throws IOException, InterruptedException {
        +        URI base = URI.create("http://localhost:" + server.port());
        +        HttpClient client = http2Client(base);
        +
        +        HttpRequest.Builder req = HttpRequest.newBuilder()
        +                .timeout(TIMEOUT)
        +                .GET();
        +
        +        Set expected = new HashSet<>(500);
        +        for (int i = 0; i < 800; i++) {
        +            req.setHeader("test-header-" + i, DATA + i);
        +            expected.add("test-header-" + i + "=" + DATA + i);
        +        }
        +
        +        HttpResponse res = client.send(req.uri(base.resolve("/cont-in")).build(),
        +                HttpResponse.BodyHandlers.ofString());
        +
        +        assertThat(res.statusCode(), is(200));
        +        assertThat(List.of(res.body().split("\n")), Matchers.containsInAnyOrder(expected.toArray(new String[0])));
        +    }
        +
        +    @Test
        +    void serverInboundTooLarge(WebServer server) throws IOException, InterruptedException {
        +        URI base = URI.create("http://localhost:" + server.port());
        +        HttpClient client = http2Client(base);
        +
        +        HttpRequest.Builder req = HttpRequest.newBuilder()
        +                .timeout(TIMEOUT)
        +                .GET();
        +
        +        for (int i = 0; i < 5200; i++) {
        +            req.setHeader("test-header-" + i, DATA + i);
        +        }
        +
        +        // There is no way how to access GO_AWAY status code and additional data with JDK Http client
        +        Assertions.assertThrows(IOException.class,
        +                () -> client.send(req.uri(base.resolve("/cont-in")).build(),
        +                        HttpResponse.BodyHandlers.ofString()));
        +    }
        +
        +    private HttpClient http2Client(URI base) throws IOException, InterruptedException {
        +        HttpClient client = HttpClient.newBuilder()
        +                .version(HttpClient.Version.HTTP_2)
        +                .connectTimeout(TIMEOUT)
        +                .build();
        +
        +        HttpRequest req = HttpRequest.newBuilder()
        +                .timeout(TIMEOUT)
        +                .GET()
        +                .uri(base.resolve("/ping"))
        +                .build();
        +
        +        // Java client can't do the prior knowledge
        +        client.send(req, HttpResponse.BodyHandlers.ofString());
        +        return client;
        +    }
        +
        +}
        diff --git a/nima/tests/integration/http2/server/src/test/java/io/helidon/nima/tests/integration/http2/webserver/Http2ErrorHandlingWithOutputStreamTest.java b/webserver/tests/http2/src/test/java/io/helidon/webserver/tests/http2/Http2ErrorHandlingWithOutputStreamTest.java
        similarity index 93%
        rename from nima/tests/integration/http2/server/src/test/java/io/helidon/nima/tests/integration/http2/webserver/Http2ErrorHandlingWithOutputStreamTest.java
        rename to webserver/tests/http2/src/test/java/io/helidon/webserver/tests/http2/Http2ErrorHandlingWithOutputStreamTest.java
        index 8bb32414464..5976a0af7d5 100644
        --- a/nima/tests/integration/http2/server/src/test/java/io/helidon/nima/tests/integration/http2/webserver/Http2ErrorHandlingWithOutputStreamTest.java
        +++ b/webserver/tests/http2/src/test/java/io/helidon/webserver/tests/http2/Http2ErrorHandlingWithOutputStreamTest.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.http2.webserver;
        +package io.helidon.webserver.tests.http2;
         
         import java.io.IOException;
         import java.io.OutputStream;
        @@ -27,26 +27,26 @@
         import java.util.Optional;
         
         import io.helidon.common.configurable.Resource;
        -import io.helidon.common.http.Http;
        +import io.helidon.http.Http;
         import io.helidon.common.pki.Keys;
        -import io.helidon.nima.common.tls.Tls;
        -import io.helidon.nima.http2.webserver.Http2Route;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.testing.junit5.webserver.SetUpServer;
        -import io.helidon.nima.webserver.WebServer;
        -import io.helidon.nima.webserver.WebServerConfig;
        -import io.helidon.nima.webserver.http.ErrorHandler;
        -import io.helidon.nima.webserver.http.HttpRouting;
        -import io.helidon.nima.webserver.http.ServerRequest;
        -import io.helidon.nima.webserver.http.ServerResponse;
        +import io.helidon.common.tls.Tls;
        +import io.helidon.webserver.http2.Http2Route;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webserver.testing.junit5.SetUpServer;
        +import io.helidon.webserver.WebServer;
        +import io.helidon.webserver.WebServerConfig;
        +import io.helidon.webserver.http.ErrorHandler;
        +import io.helidon.webserver.http.HttpRouting;
        +import io.helidon.webserver.http.ServerRequest;
        +import io.helidon.webserver.http.ServerResponse;
         
         import org.hamcrest.BaseMatcher;
         import org.hamcrest.Description;
         import org.hamcrest.Matcher;
         import org.junit.jupiter.api.Test;
         
        -import static io.helidon.common.http.Http.Method.GET;
        +import static io.helidon.http.Http.Method.GET;
         import static org.hamcrest.CoreMatchers.containsString;
         import static org.hamcrest.CoreMatchers.instanceOf;
         import static org.hamcrest.CoreMatchers.is;
        diff --git a/nima/tests/integration/http2/server/src/test/java/io/helidon/nima/tests/integration/http2/webserver/Http2ServerTest.java b/webserver/tests/http2/src/test/java/io/helidon/webserver/tests/http2/Http2ServerTest.java
        similarity index 88%
        rename from nima/tests/integration/http2/server/src/test/java/io/helidon/nima/tests/integration/http2/webserver/Http2ServerTest.java
        rename to webserver/tests/http2/src/test/java/io/helidon/webserver/tests/http2/Http2ServerTest.java
        index d17257c4da7..560813e22cd 100644
        --- a/nima/tests/integration/http2/server/src/test/java/io/helidon/nima/tests/integration/http2/webserver/Http2ServerTest.java
        +++ b/webserver/tests/http2/src/test/java/io/helidon/webserver/tests/http2/Http2ServerTest.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.http2.webserver;
        +package io.helidon.webserver.tests.http2;
         
         import java.io.IOException;
         import java.net.URI;
        @@ -25,26 +25,26 @@
         import java.util.Optional;
         
         import io.helidon.common.configurable.Resource;
        -import io.helidon.common.http.Http;
        -import io.helidon.common.http.Http.Header;
        -import io.helidon.common.http.Http.HeaderNames;
        +import io.helidon.http.Http;
        +import io.helidon.http.Http.Header;
        +import io.helidon.http.Http.HeaderNames;
         import io.helidon.common.pki.Keys;
        -import io.helidon.nima.common.tls.Tls;
        -import io.helidon.nima.http2.webserver.Http2Route;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.testing.junit5.webserver.SetUpServer;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webclient.http1.Http1ClientResponse;
        -import io.helidon.nima.webserver.WebServer;
        -import io.helidon.nima.webserver.WebServerConfig;
        -import io.helidon.nima.webserver.http.HttpRouting;
        -import io.helidon.nima.webserver.http.ServerRequest;
        -import io.helidon.nima.webserver.http.ServerResponse;
        +import io.helidon.common.tls.Tls;
        +import io.helidon.webserver.http2.Http2Route;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webserver.testing.junit5.SetUpServer;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webclient.http1.Http1ClientResponse;
        +import io.helidon.webserver.WebServer;
        +import io.helidon.webserver.WebServerConfig;
        +import io.helidon.webserver.http.HttpRouting;
        +import io.helidon.webserver.http.ServerRequest;
        +import io.helidon.webserver.http.ServerResponse;
         
         import org.junit.jupiter.api.Test;
         
        -import static io.helidon.common.http.Http.Method.GET;
        +import static io.helidon.http.Http.Method.GET;
         import static org.hamcrest.CoreMatchers.is;
         import static org.hamcrest.MatcherAssert.assertThat;
         
        diff --git a/nima/tests/integration/http2/server/src/test/java/io/helidon/nima/tests/integration/http2/webserver/Http2WebServerStopIdleTest.java b/webserver/tests/http2/src/test/java/io/helidon/webserver/tests/http2/Http2WebServerStopIdleTest.java
        similarity index 95%
        rename from nima/tests/integration/http2/server/src/test/java/io/helidon/nima/tests/integration/http2/webserver/Http2WebServerStopIdleTest.java
        rename to webserver/tests/http2/src/test/java/io/helidon/webserver/tests/http2/Http2WebServerStopIdleTest.java
        index 801bc6e6075..c41b41dd87e 100644
        --- a/nima/tests/integration/http2/server/src/test/java/io/helidon/nima/tests/integration/http2/webserver/Http2WebServerStopIdleTest.java
        +++ b/webserver/tests/http2/src/test/java/io/helidon/webserver/tests/http2/Http2WebServerStopIdleTest.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.http2.webserver;
        +package io.helidon.webserver.tests.http2;
         
         import java.io.IOException;
         import java.net.URI;
        @@ -25,8 +25,8 @@
         
         import io.helidon.common.configurable.Resource;
         import io.helidon.common.pki.Keys;
        -import io.helidon.nima.common.tls.Tls;
        -import io.helidon.nima.webserver.WebServer;
        +import io.helidon.common.tls.Tls;
        +import io.helidon.webserver.WebServer;
         
         import org.junit.jupiter.api.Test;
         
        diff --git a/webserver/tests/http2/src/test/java/io/helidon/webserver/tests/http2/PostTest.java b/webserver/tests/http2/src/test/java/io/helidon/webserver/tests/http2/PostTest.java
        new file mode 100644
        index 00000000000..f50542ed13d
        --- /dev/null
        +++ b/webserver/tests/http2/src/test/java/io/helidon/webserver/tests/http2/PostTest.java
        @@ -0,0 +1,231 @@
        +/*
        + * Copyright (c) 2022, 2023 Oracle and/or its affiliates.
        + *
        + * Licensed under the Apache License, Version 2.0 (the "License");
        + * you may not use this file except in compliance with the License.
        + * You may obtain a copy of the License at
        + *
        + *     http://www.apache.org/licenses/LICENSE-2.0
        + *
        + * Unless required by applicable law or agreed to in writing, software
        + * distributed under the License is distributed on an "AS IS" BASIS,
        + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        + * See the License for the specific language governing permissions and
        + * limitations under the License.
        + */
        +
        +package io.helidon.webserver.tests.http2;
        +
        +import java.io.IOException;
        +import java.io.InputStream;
        +import java.io.OutputStream;
        +import java.io.UncheckedIOException;
        +import java.net.URI;
        +import java.net.http.HttpClient;
        +import java.net.http.HttpRequest;
        +import java.net.http.HttpResponse;
        +import java.time.Duration;
        +import java.util.Optional;
        +import java.util.OptionalLong;
        +import java.util.Random;
        +
        +import io.helidon.http.Http;
        +import io.helidon.http.Http.HeaderName;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webserver.http.Handler;
        +import io.helidon.webserver.http.HttpRouting;
        +import io.helidon.webserver.http.ServerRequest;
        +import io.helidon.webserver.http.ServerResponse;
        +
        +import org.junit.jupiter.api.Test;
        +
        +import static org.hamcrest.CoreMatchers.is;
        +import static org.hamcrest.MatcherAssert.assertThat;
        +
        +@ServerTest
        +class PostTest {
        +    private static final byte[] BYTES = new byte[256];
        +    private static final HeaderName REQUEST_HEADER_NAME = Http.HeaderNames.create("X-REquEst-HEADeR");
        +    private static final String REQUEST_HEADER_VALUE_STRING = "some nice value";
        +    private static final Http.Header REQUEST_HEADER_VALUE = Http.Headers.create(REQUEST_HEADER_NAME, REQUEST_HEADER_VALUE_STRING);
        +    private static final HeaderName RESPONSE_HEADER_NAME = Http.HeaderNames.create("X-REsponSE-HeADER");
        +    private static final String RESPONSE_HEADER_VALUE_STRING = "another nice value";
        +    private static final Http.Header RESPONSE_HEADER_VALUE = Http.Headers.create(RESPONSE_HEADER_NAME,
        +                                                                                 RESPONSE_HEADER_VALUE_STRING);
        +
        +    static {
        +        Random random = new Random();
        +        random.nextBytes(BYTES);
        +    }
        +
        +    private final HttpClient client;
        +    private final URI uri;
        +
        +    PostTest(URI uri) {
        +        this.uri = uri;
        +        client = HttpClient.newBuilder()
        +                .version(HttpClient.Version.HTTP_2)
        +                .connectTimeout(Duration.ofSeconds(5))
        +                .build();
        +    }
        +
        +    @SetUpRoute
        +    static void routing(HttpRouting.Builder router) {
        +        router.route(Http.Method.POST, "/string", Handler.create(String.class, Routes::string))
        +                .route(Http.Method.POST, "/bytes", Handler.create(byte[].class, Routes::bytes))
        +                .route(Http.Method.POST, "/streamed", Routes::streamed)
        +                .route(Http.Method.POST, "/headers", Routes::headers)
        +                .route(Http.Method.POST, "/nocontent", Routes::noContent);
        +    }
        +
        +    @Test
        +    void testStringRoute() throws IOException, InterruptedException {
        +        // do a head request (will get 404) to upgrade
        +        client.send(HttpRequest.newBuilder()
        +                            .HEAD()
        +                            .uri(uri.resolve("/string"))
        +                            .build(), HttpResponse.BodyHandlers.discarding());
        +
        +        HttpResponse response = client.send(HttpRequest.newBuilder()
        +                                                            .timeout(Duration.ofSeconds(5))
        +                                                            .uri(uri.resolve("/string"))
        +                                                            .POST(HttpRequest.BodyPublishers.ofString("Hello"))
        +                                                            .build(), HttpResponse.BodyHandlers.ofString());
        +
        +        assertThat(response.statusCode(), is(Http.Status.OK_200.code()));
        +        String entity = response.body();
        +        assertThat(entity, is("Hello"));
        +        java.net.http.HttpHeaders headers = response.headers();
        +        assertThat(headers.firstValueAsLong("content-length"), is(OptionalLong.of(5)));
        +        assertThat(response.version(), is(HttpClient.Version.HTTP_2));
        +    }
        +
        +    @Test
        +    void testByteRoute() throws IOException, InterruptedException {
        +        // do a head request (will get 404) to upgrade
        +        client.send(HttpRequest.newBuilder()
        +                            .HEAD()
        +                            .uri(uri.resolve("/string"))
        +                            .build(), HttpResponse.BodyHandlers.discarding());
        +
        +        HttpResponse response = client.send(HttpRequest.newBuilder()
        +                                                            .timeout(Duration.ofSeconds(5))
        +                                                            .uri(uri.resolve("/bytes"))
        +                                                            .POST(HttpRequest.BodyPublishers.ofByteArray(BYTES))
        +                                                            .build(), HttpResponse.BodyHandlers.ofByteArray());
        +
        +        assertThat(response.statusCode(), is(Http.Status.OK_200.code()));
        +        byte[] entity = response.body();
        +        assertThat(entity, is(BYTES));
        +        java.net.http.HttpHeaders headers = response.headers();
        +        assertThat(headers.firstValueAsLong("content-length"), is(OptionalLong.of(BYTES.length)));
        +        assertThat(response.version(), is(HttpClient.Version.HTTP_2));
        +    }
        +
        +    @Test
        +    void testStreamedRoute() throws IOException, InterruptedException {
        +        // do a head request (will get 404) to upgrade
        +        client.send(HttpRequest.newBuilder()
        +                            .HEAD()
        +                            .uri(uri.resolve("/string"))
        +                            .build(), HttpResponse.BodyHandlers.discarding());
        +
        +        HttpResponse response = client.send(HttpRequest.newBuilder()
        +                                                            .timeout(Duration.ofSeconds(5))
        +                                                            .uri(uri.resolve("/streamed"))
        +                                                            .POST(HttpRequest.BodyPublishers.ofByteArray(BYTES))
        +                                                            .build(), HttpResponse.BodyHandlers.ofByteArray());
        +
        +        assertThat(response.statusCode(), is(Http.Status.OK_200.code()));
        +        byte[] entity = response.body();
        +        assertThat(entity, is(BYTES));
        +        java.net.http.HttpHeaders headers = response.headers();
        +        assertThat(headers.firstValueAsLong("content-length"), is(OptionalLong.of(BYTES.length)));
        +        assertThat(response.version(), is(HttpClient.Version.HTTP_2));
        +    }
        +
        +    @Test
        +    void testHeadersRoute() throws IOException, InterruptedException {
        +        // do a head request (will get 404) to upgrade
        +        client.send(HttpRequest.newBuilder()
        +                            .HEAD()
        +                            .uri(uri.resolve("/string"))
        +                            .build(), HttpResponse.BodyHandlers.discarding());
        +
        +        HttpResponse response = client.send(HttpRequest.newBuilder()
        +                                                            .timeout(Duration.ofSeconds(5))
        +                                                            .uri(uri.resolve("/headers"))
        +                                                            .header(REQUEST_HEADER_NAME.lowerCase(),
        +                                                                    REQUEST_HEADER_VALUE_STRING)
        +                                                            .POST(HttpRequest.BodyPublishers.ofString("Hello"))
        +                                                            .build(), HttpResponse.BodyHandlers.ofString());
        +
        +        assertThat(response.statusCode(), is(Http.Status.OK_200.code()));
        +        String entity = response.body();
        +        assertThat(entity, is("Hello"));
        +        java.net.http.HttpHeaders headers = response.headers();
        +        assertThat(headers.firstValueAsLong("content-length"), is(OptionalLong.of(5)));
        +        assertThat("Should contain echoed request header",
        +                   headers.firstValue(REQUEST_HEADER_NAME.lowerCase()),
        +                   is(Optional.of(REQUEST_HEADER_VALUE_STRING)));
        +        assertThat("Should contain configured response header",
        +                   headers.firstValue(RESPONSE_HEADER_NAME.lowerCase()),
        +                   is(Optional.of(RESPONSE_HEADER_VALUE_STRING)));
        +        assertThat(response.version(), is(HttpClient.Version.HTTP_2));
        +    }
        +
        +    @Test
        +    void testNoContentRoute() throws IOException, InterruptedException {
        +        // do a head request (will get 404) to upgrade
        +        client.send(HttpRequest.newBuilder()
        +                            .HEAD()
        +                            .uri(uri.resolve("/nocontent"))
        +                            .build(), HttpResponse.BodyHandlers.discarding());
        +
        +        HttpResponse response = client.send(HttpRequest.newBuilder()
        +                                                            .timeout(Duration.ofSeconds(5))
        +                                                            .uri(uri.resolve("/nocontent"))
        +                                                            .header(REQUEST_HEADER_NAME.lowerCase(),
        +                                                                    REQUEST_HEADER_VALUE_STRING)
        +                                                            .POST(HttpRequest.BodyPublishers.ofString("Hello"))
        +                                                            .build(), HttpResponse.BodyHandlers.ofString());
        +
        +        assertThat(response.statusCode(), is(Http.Status.NO_CONTENT_204.code()));
        +    }
        +
        +    private static class Routes {
        +        public static void noContent(ServerRequest req, ServerResponse res) {
        +            res.status(Http.Status.NO_CONTENT_204);
        +            res.send();
        +        }
        +
        +        private static String string(String request) {
        +            return request;
        +        }
        +
        +        private static byte[] bytes(byte[] bytes) {
        +            return bytes;
        +        }
        +
        +        private static void streamed(ServerRequest req, ServerResponse res) {
        +            byte[] buffer = new byte[512];
        +            try (InputStream inputStream = req.content().inputStream(); OutputStream outputStream = res.outputStream()) {
        +                int read;
        +                while ((read = inputStream.read(buffer)) > 0) {
        +                    outputStream.write(buffer, 0, read);
        +                }
        +            } catch (IOException e) {
        +                throw new UncheckedIOException(e);
        +            }
        +        }
        +
        +        private static void headers(ServerRequest req, ServerResponse res) {
        +            res.header(req.headers().get(REQUEST_HEADER_NAME));
        +            res.header(RESPONSE_HEADER_VALUE);
        +            String entity = req.content().as(String.class);
        +            res.send(entity);
        +        }
        +    }
        +
        +}
        diff --git a/nima/tests/integration/http2/server/src/test/resources/certificate.p12 b/webserver/tests/http2/src/test/resources/certificate.p12
        similarity index 100%
        rename from nima/tests/integration/http2/server/src/test/resources/certificate.p12
        rename to webserver/tests/http2/src/test/resources/certificate.p12
        diff --git a/webserver/tests/http2/src/test/resources/logging-test.properties b/webserver/tests/http2/src/test/resources/logging-test.properties
        new file mode 100644
        index 00000000000..fa0e37bbca3
        --- /dev/null
        +++ b/webserver/tests/http2/src/test/resources/logging-test.properties
        @@ -0,0 +1,22 @@
        +#
        +# Copyright (c) 2022, 2023 Oracle and/or its affiliates.
        +#
        +# 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.
        +#
        +handlers=java.util.logging.ConsoleHandler
        +java.util.logging.ConsoleHandler.level=FINEST
        +java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
        +java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS.%1$tL %5$s%6$s%n
        +# Global logging level. Can be overridden by specific loggers
        +.level=INFO
        +io.helidon.webserver.level=INFO
        diff --git a/webserver/tests/imperative/pom.xml b/webserver/tests/imperative/pom.xml
        new file mode 100644
        index 00000000000..2dd44473f91
        --- /dev/null
        +++ b/webserver/tests/imperative/pom.xml
        @@ -0,0 +1,100 @@
        +
        +
        +
        +    4.0.0
        +    
        +        io.helidon.webserver.tests
        +        helidon-webserver-tests-project
        +        4.0.0-SNAPSHOT
        +    
        +
        +    helidon-webserver-tests-imperative
        +    Helidon WebServer Tests Imperative
        +    Validation of imperative APIs and their dependencies
        +
        +    
        +        
        +            io.helidon.webserver
        +            helidon-webserver
        +        
        +        
        +            io.helidon.config
        +            helidon-config-yaml
        +        
        +        
        +            io.helidon.webserver.testing.junit5
        +            helidon-webserver-testing-junit5
        +            test
        +        
        +        
        +            org.junit.jupiter
        +            junit-jupiter-api
        +            test
        +        
        +        
        +            org.hamcrest
        +            hamcrest-all
        +            test
        +        
        +    
        +
        +    
        +        
        +            
        +                org.apache.maven.plugins
        +                maven-failsafe-plugin
        +                
        +                    
        +                        
        +                            integration-test
        +                            verify
        +                        
        +                    
        +                
        +            
        +            
        +                org.apache.maven.plugins
        +                maven-enforcer-plugin
        +                
        +                    
        +                        enforce-config-not-included
        +                        
        +                            enforce
        +                        
        +                        
        +                            
        +                                
        +                                    
        +                                        
        +                                        io.helidon.inject:helidon-inject-runtime
        +                                        io.helidon.inject.configdriven:helidon-configdriven-runtime
        +                                    
        +                                
        +                            
        +                            true
        +                        
        +                    
        +                
        +            
        +        
        +    
        +
        diff --git a/webserver/tests/imperative/src/main/java/io/helidon/webserver/tests/imperative/ImperativeMain.java b/webserver/tests/imperative/src/main/java/io/helidon/webserver/tests/imperative/ImperativeMain.java
        new file mode 100644
        index 00000000000..e48afb5fc82
        --- /dev/null
        +++ b/webserver/tests/imperative/src/main/java/io/helidon/webserver/tests/imperative/ImperativeMain.java
        @@ -0,0 +1,54 @@
        +/*
        + * Copyright (c) 2023 Oracle and/or its affiliates.
        + *
        + * Licensed under the Apache License, Version 2.0 (the "License");
        + * you may not use this file except in compliance with the License.
        + * You may obtain a copy of the License at
        + *
        + *     http://www.apache.org/licenses/LICENSE-2.0
        + *
        + * Unless required by applicable law or agreed to in writing, software
        + * distributed under the License is distributed on an "AS IS" BASIS,
        + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        + * See the License for the specific language governing permissions and
        + * limitations under the License.
        + */
        +
        +package io.helidon.webserver.tests.imperative;
        +
        +import io.helidon.common.config.Config;
        +import io.helidon.common.config.GlobalConfig;
        +import io.helidon.http.Http;
        +import io.helidon.webserver.WebServer;
        +import io.helidon.webserver.http.HttpRouting;
        +
        +/**
        + * Main class of this example, starts the server.
        + */
        +public final class ImperativeMain {
        +    private ImperativeMain() {
        +    }
        +
        +    /**
        +     * Start the example.
        +     *
        +     * @param args ignored
        +     */
        +    public static void main(String[] args) {
        +        Config config = GlobalConfig.config();
        +
        +        WebServer server = WebServer.create(ws -> ws.config(config.get("server"))
        +                        .routing(ImperativeMain::routing))
        +                .start();
        +
        +        System.out.println("Server started. Server configuration: " + server.prototype());
        +    }
        +
        +    static void routing(HttpRouting.Builder routing) {
        +        Http.Method list = Http.Method.create("LIST");
        +
        +        routing.get("/", (req, res) -> res.send("Hello World!"))
        +                .route(list, "/", (req, res) -> res.send("lll"))
        +                .route(list, (req, res) -> res.send("listed"));
        +    }
        +}
        diff --git a/nima/tests/integration/imperative/src/main/resources/application.yaml b/webserver/tests/imperative/src/main/resources/application.yaml
        similarity index 100%
        rename from nima/tests/integration/imperative/src/main/resources/application.yaml
        rename to webserver/tests/imperative/src/main/resources/application.yaml
        diff --git a/nima/tests/integration/imperative/src/test/java/io/helidon/nima/tests/integration/imperative/ImperativeMainTest.java b/webserver/tests/imperative/src/test/java/io/helidon/webserver/tests/imperative/ImperativeMainTest.java
        similarity index 82%
        rename from nima/tests/integration/imperative/src/test/java/io/helidon/nima/tests/integration/imperative/ImperativeMainTest.java
        rename to webserver/tests/imperative/src/test/java/io/helidon/webserver/tests/imperative/ImperativeMainTest.java
        index 715cbf6969e..9682521312f 100644
        --- a/nima/tests/integration/imperative/src/test/java/io/helidon/nima/tests/integration/imperative/ImperativeMainTest.java
        +++ b/webserver/tests/imperative/src/test/java/io/helidon/webserver/tests/imperative/ImperativeMainTest.java
        @@ -14,13 +14,13 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.imperative;
        +package io.helidon.webserver.tests.imperative;
         
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.testing.junit5.webserver.Socket;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webserver.http.HttpRouting;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webserver.testing.junit5.Socket;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webserver.http.HttpRouting;
         
         import org.junit.jupiter.api.Test;
         
        diff --git a/webserver/tests/mtls/README.md b/webserver/tests/mtls/README.md
        new file mode 100644
        index 00000000000..1249553db2d
        --- /dev/null
        +++ b/webserver/tests/mtls/README.md
        @@ -0,0 +1,101 @@
        +## WebServer tests mTLS 
        +
        +This readme describes how to generate the PKCS#12 files used by the tests.
        +
        +### Root CA
        +
        +```bash
        +openssl req -new -sha256 -newkey rsa:2048 \
        +	-keyout ca.key \
        +	-subj "/CN=Helidon-Test-CA" \
        +	-out ca.csr \
        +	-passout pass:password
        +
        +openssl x509 -req \
        +	-in ca.csr \
        +	-signkey ca.key \
        +	-out ca.crt \
        +	-days 99999 -sha256 -passin pass:password
        +```
        +
        +### Client Certificate
        +
        +```bash
        +openssl req -new -sha256 -newkey rsa:2048 \
        +	-keyout client.key \
        +	-subj "/CN=Helidon-Test-Client" \
        +	-out client.csr \
        +	-extensions v3_req \
        +	-passout pass:password
        +
        +openssl x509 -req \
        +	-in client.csr \
        +	-CA ca.crt \
        +	-CAkey ca.key \
        +	-out client.crt \
        +	-extfile <(printf "subjectAltName = DNS:localhost") \
        +	-days 99999 -sha256 -passin pass:password
        +
        +openssl pkcs12 \
        +	-inkey client.key \
        +	-in <(cat client.crt ca.crt) \
        +	-export \
        +	-out src/main/resources/client.p12 \
        +	-passin pass:password \
        +	-passout pass:password
        +```
        +
        +### Server Certificate
        +
        +
        +```bash
        +openssl req -new -sha256 -newkey rsa:2048 \
        +	-keyout server.key \
        +	-subj "/CN=Helidon-Test-Server" \
        +	-out server.csr \
        +	-extensions v3_req \
        +	-passout pass:password
        +
        +openssl x509 -req \
        +	-in server.csr \
        +	-CA ca.crt \
        +	-CAkey ca.key \
        +	-out server.crt \
        +	-extfile <(printf "subjectAltName = DNS:localhost") \
        +	-days 99999 -sha256 -passin pass:password
        +
        +openssl pkcs12 \
        +	-inkey server.key \
        +	-in <(cat server.crt ca.crt) \
        +	-export \
        +	-out src/main/resources/server.p12 \
        +	-passin pass:password \
        +	-passout pass:password
        +```
        +
        +### Secondary Server Certificate
        +
        +```bash
        +openssl req -new -sha256 -newkey rsa:2048 \
        +	-keyout server2.key \
        +	-subj "/CN=Helidon-Test-Server-Secondary" \
        +	-out server2.csr \
        +	-extensions v3_req \
        +	-passout pass:password
        +
        +openssl x509 -req \
        +	-in server2.csr \
        +	-CA ca.crt \
        +	-CAkey ca.key \
        +	-out server2.crt \
        +	-extfile <(printf "subjectAltName = DNS:localhost") \
        +	-days 99999 -sha256 -passin pass:password
        +
        +openssl pkcs12 \
        +	-inkey server2.key \
        +	-in <(cat server2.crt ca.crt) \
        +	-export \
        +	-out src/main/resources/second-valid/server.p12 \
        +	-passin pass:password \
        +	-passout pass:password
        +```
        diff --git a/webserver/tests/mtls/pom.xml b/webserver/tests/mtls/pom.xml
        new file mode 100644
        index 00000000000..443e80509de
        --- /dev/null
        +++ b/webserver/tests/mtls/pom.xml
        @@ -0,0 +1,52 @@
        +
        +
        +
        +    4.0.0
        +    
        +        io.helidon.webserver.tests
        +        helidon-webserver-tests-project
        +        4.0.0-SNAPSHOT
        +    
        +
        +    helidon-webserver-tests-mtls
        +    Helidon WebServer Tests MTLS
        +    WebServer Mutual TLS tests
        +
        +    
        +        
        +            io.helidon.webserver
        +            helidon-webserver
        +        
        +        
        +            io.helidon.webserver.testing.junit5
        +            helidon-webserver-testing-junit5
        +            test
        +        
        +        
        +            org.junit.jupiter
        +            junit-jupiter-api
        +            test
        +        
        +        
        +            org.hamcrest
        +            hamcrest-all
        +            test
        +        
        +    
        +
        diff --git a/webserver/tests/mtls/src/main/resources/client.p12 b/webserver/tests/mtls/src/main/resources/client.p12
        new file mode 100644
        index 00000000000..5cc22fe073e
        Binary files /dev/null and b/webserver/tests/mtls/src/main/resources/client.p12 differ
        diff --git a/webserver/tests/mtls/src/main/resources/logging.properties b/webserver/tests/mtls/src/main/resources/logging.properties
        new file mode 100644
        index 00000000000..e68d9bc9384
        --- /dev/null
        +++ b/webserver/tests/mtls/src/main/resources/logging.properties
        @@ -0,0 +1,20 @@
        +#
        +# Copyright (c) 2022, 2023 Oracle and/or its affiliates.
        +#
        +# 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.
        +#
        +handlers=java.util.logging.ConsoleHandler
        +java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS.%1$tL %5$s%6$s%n
        +# Global logging level. Can be overridden by specific loggers
        +.level=INFO
        +
        diff --git a/webserver/tests/mtls/src/main/resources/second-valid/server.p12 b/webserver/tests/mtls/src/main/resources/second-valid/server.p12
        new file mode 100644
        index 00000000000..5db950bca17
        Binary files /dev/null and b/webserver/tests/mtls/src/main/resources/second-valid/server.p12 differ
        diff --git a/webserver/tests/mtls/src/main/resources/server.p12 b/webserver/tests/mtls/src/main/resources/server.p12
        new file mode 100644
        index 00000000000..a5b24f2de59
        Binary files /dev/null and b/webserver/tests/mtls/src/main/resources/server.p12 differ
        diff --git a/nima/tests/integration/webserver/mtls/src/test/java/io/helidon/nima/tests/integration/server/mtls/MtlsTest.java b/webserver/tests/mtls/src/test/java/io/helidon/webserver/tests/mtls/MtlsTest.java
        similarity index 86%
        rename from nima/tests/integration/webserver/mtls/src/test/java/io/helidon/nima/tests/integration/server/mtls/MtlsTest.java
        rename to webserver/tests/mtls/src/test/java/io/helidon/webserver/tests/mtls/MtlsTest.java
        index 678a0efa3f3..cd4fdb55aab 100644
        --- a/nima/tests/integration/webserver/mtls/src/test/java/io/helidon/nima/tests/integration/server/mtls/MtlsTest.java
        +++ b/webserver/tests/mtls/src/test/java/io/helidon/webserver/tests/mtls/MtlsTest.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server.mtls;
        +package io.helidon.webserver.tests.mtls;
         
         import java.security.Principal;
         import java.security.cert.Certificate;
        @@ -23,19 +23,19 @@
         import java.util.List;
         
         import io.helidon.common.configurable.Resource;
        -import io.helidon.common.http.Http;
        +import io.helidon.http.Http;
         import io.helidon.common.pki.Keys;
        -import io.helidon.nima.common.tls.Tls;
        -import io.helidon.nima.common.tls.TlsClientAuth;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.testing.junit5.webserver.SetUpServer;
        -import io.helidon.nima.webclient.api.ClientResponseTyped;
        -import io.helidon.nima.webclient.api.WebClient;
        -import io.helidon.nima.webserver.WebServer;
        -import io.helidon.nima.webserver.WebServerConfig;
        -import io.helidon.nima.webserver.http.HttpRouting;
        -import io.helidon.nima.webserver.http.ServerResponse;
        +import io.helidon.common.tls.Tls;
        +import io.helidon.common.tls.TlsClientAuth;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webserver.testing.junit5.SetUpServer;
        +import io.helidon.webclient.api.ClientResponseTyped;
        +import io.helidon.webclient.api.WebClient;
        +import io.helidon.webserver.WebServer;
        +import io.helidon.webserver.WebServerConfig;
        +import io.helidon.webserver.http.HttpRouting;
        +import io.helidon.webserver.http.ServerResponse;
         
         import org.junit.jupiter.api.Test;
         
        @@ -138,7 +138,7 @@ void testMutualTlsPrincipal() {
                         .request(String.class);
         
                 assertThat(response.status(), is(Http.Status.OK_200));
        -        assertThat(response.entity(), is("C=CZ,CN=Helidon-client,OU=Prague,O=Oracle"));
        +        assertThat(response.entity(), is("CN=Helidon-Test-Client"));
             }
         
             @Test
        @@ -148,7 +148,7 @@ void testMutualTlsCertificates() {
                         .request(String.class);
         
                 assertThat(response.status(), is(Http.Status.OK_200));
        -        assertThat(response.entity(), is("X.509:C=CZ,CN=Helidon-client,OU=Prague,O=Oracle|X.509:CN=Helidon-CA"));
        +        assertThat(response.entity(), is("X.509:CN=Helidon-Test-Client|X.509:CN=Helidon-Test-CA"));
             }
         
             @Test
        @@ -158,7 +158,7 @@ void testTlsReload() {
                         .request(String.class);
         
                 assertThat(response.status(), is(Http.Status.OK_200));
        -        assertThat(response.entity(), is("X.509:CN=localhost|X.509:CN=Helidon-CA"));
        +        assertThat(response.entity(), is("X.509:CN=Helidon-Test-Server|X.509:CN=Helidon-Test-CA"));
         
                 response = client.method(Http.Method.GET)
                         .uri("/reload")
        @@ -171,7 +171,7 @@ void testTlsReload() {
                         .request(String.class);
         
                 assertThat(response.status(), is(Http.Status.OK_200));
        -        assertThat(response.entity(), is("X.509:CN=localhost|X.509:CN=Nima-CA"));
        +        assertThat(response.entity(), is("X.509:CN=Helidon-Test-Server-Secondary|X.509:CN=Helidon-Test-CA"));
             }
         
             private static void sendCertificateString(Certificate[] certs, ServerResponse res) {
        diff --git a/webserver/tests/observe/health/pom.xml b/webserver/tests/observe/health/pom.xml
        new file mode 100644
        index 00000000000..c2d2fccc284
        --- /dev/null
        +++ b/webserver/tests/observe/health/pom.xml
        @@ -0,0 +1,55 @@
        +
        +
        +
        +    4.0.0
        +    
        +        io.helidon.webserver.tests.observe
        +        helidon-webserver-tests-observe-project
        +        4.0.0-SNAPSHOT
        +    
        +
        +    helidon-webserver-observe-tests-health
        +    Helidon WebServer Tests Observe Health
        +
        +    
        +        
        +            io.helidon.webserver
        +            helidon-webserver
        +        
        +        
        +            io.helidon.webserver.observe
        +            helidon-webserver-observe-health
        +        
        +        
        +            io.helidon.webserver.testing.junit5
        +            helidon-webserver-testing-junit5
        +            test
        +        
        +        
        +            org.junit.jupiter
        +            junit-jupiter-api
        +            test
        +        
        +        
        +            org.hamcrest
        +            hamcrest-all
        +            test
        +        
        +    
        +
        diff --git a/nima/tests/integration/observe/health/src/test/java/io/helidon/nima/tests/integration/observe/health/MyHealthCheck.java b/webserver/tests/observe/health/src/test/java/io/helidon/webserver/tests/observe/health/MyHealthCheck.java
        similarity index 92%
        rename from nima/tests/integration/observe/health/src/test/java/io/helidon/nima/tests/integration/observe/health/MyHealthCheck.java
        rename to webserver/tests/observe/health/src/test/java/io/helidon/webserver/tests/observe/health/MyHealthCheck.java
        index f7a93ee453c..9646aba9c89 100644
        --- a/nima/tests/integration/observe/health/src/test/java/io/helidon/nima/tests/integration/observe/health/MyHealthCheck.java
        +++ b/webserver/tests/observe/health/src/test/java/io/helidon/webserver/tests/observe/health/MyHealthCheck.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2022 Oracle and/or its affiliates.
        + * Copyright (c) 2022, 2023 Oracle and/or its affiliates.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.observe.health;
        +package io.helidon.webserver.tests.observe.health;
         
         import io.helidon.health.HealthCheck;
         import io.helidon.health.HealthCheckResponse;
        diff --git a/nima/tests/integration/observe/health/src/test/java/io/helidon/nima/tests/integration/observe/health/ObserveHealthDetailsTest.java b/webserver/tests/observe/health/src/test/java/io/helidon/webserver/tests/observe/health/ObserveHealthDetailsTest.java
        similarity index 93%
        rename from nima/tests/integration/observe/health/src/test/java/io/helidon/nima/tests/integration/observe/health/ObserveHealthDetailsTest.java
        rename to webserver/tests/observe/health/src/test/java/io/helidon/webserver/tests/observe/health/ObserveHealthDetailsTest.java
        index 40994b818f2..08202de95b2 100644
        --- a/nima/tests/integration/observe/health/src/test/java/io/helidon/nima/tests/integration/observe/health/ObserveHealthDetailsTest.java
        +++ b/webserver/tests/observe/health/src/test/java/io/helidon/webserver/tests/observe/health/ObserveHealthDetailsTest.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2022 Oracle and/or its affiliates.
        + * Copyright (c) 2022, 2023 Oracle and/or its affiliates.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        @@ -14,20 +14,20 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.observe.health;
        +package io.helidon.webserver.tests.observe.health;
         
         import java.io.IOException;
         
        -import io.helidon.common.http.Http;
        +import io.helidon.http.Http;
         import io.helidon.health.HealthCheckResponse;
        -import io.helidon.nima.observe.ObserveFeature;
        -import io.helidon.nima.observe.health.HealthFeature;
        -import io.helidon.nima.observe.health.HealthObserveProvider;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webclient.http1.Http1ClientResponse;
        -import io.helidon.nima.webserver.http.HttpRouting;
        +import io.helidon.webserver.observe.ObserveFeature;
        +import io.helidon.webserver.observe.health.HealthFeature;
        +import io.helidon.webserver.observe.health.HealthObserveProvider;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webclient.http1.Http1ClientResponse;
        +import io.helidon.webserver.http.HttpRouting;
         
         import jakarta.json.JsonArray;
         import jakarta.json.JsonObject;
        diff --git a/nima/tests/integration/observe/health/src/test/java/io/helidon/nima/tests/integration/observe/health/ObserveHealthTest.java b/webserver/tests/observe/health/src/test/java/io/helidon/webserver/tests/observe/health/ObserveHealthTest.java
        similarity index 91%
        rename from nima/tests/integration/observe/health/src/test/java/io/helidon/nima/tests/integration/observe/health/ObserveHealthTest.java
        rename to webserver/tests/observe/health/src/test/java/io/helidon/webserver/tests/observe/health/ObserveHealthTest.java
        index 4a27ad9791f..600cf1a8639 100644
        --- a/nima/tests/integration/observe/health/src/test/java/io/helidon/nima/tests/integration/observe/health/ObserveHealthTest.java
        +++ b/webserver/tests/observe/health/src/test/java/io/helidon/webserver/tests/observe/health/ObserveHealthTest.java
        @@ -14,18 +14,18 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.observe.health;
        -
        -import io.helidon.common.http.Http;
        -import io.helidon.common.http.Http.Headers;
        -import io.helidon.nima.observe.ObserveFeature;
        -import io.helidon.nima.observe.health.HealthFeature;
        -import io.helidon.nima.observe.health.HealthObserveProvider;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webclient.http1.Http1ClientResponse;
        -import io.helidon.nima.webserver.http.HttpRouting;
        +package io.helidon.webserver.tests.observe.health;
        +
        +import io.helidon.http.Http;
        +import io.helidon.http.Http.Headers;
        +import io.helidon.webserver.observe.ObserveFeature;
        +import io.helidon.webserver.observe.health.HealthFeature;
        +import io.helidon.webserver.observe.health.HealthObserveProvider;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webclient.http1.Http1ClientResponse;
        +import io.helidon.webserver.http.HttpRouting;
         
         import org.junit.jupiter.api.BeforeEach;
         import org.junit.jupiter.api.Test;
        diff --git a/webserver/tests/observe/health/src/test/resources/logging-test.properties b/webserver/tests/observe/health/src/test/resources/logging-test.properties
        new file mode 100644
        index 00000000000..3b95ec3e414
        --- /dev/null
        +++ b/webserver/tests/observe/health/src/test/resources/logging-test.properties
        @@ -0,0 +1,22 @@
        +#
        +# Copyright (c) 2022, 2023 Oracle and/or its affiliates.
        +#
        +# 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.
        +#
        +handlers=java.util.logging.ConsoleHandler
        +java.util.logging.ConsoleHandler.level=FINEST
        +java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
        +java.util.logging.SimpleFormatter.format=%1$tH:%1$tM:%1$tS %4$s %3$s %5$s%6$s%n
        +# Global logging level. Can be overridden by specific loggers
        +.level=INFO
        +io.helidon.webserver.level=INFO
        diff --git a/webserver/tests/observe/pom.xml b/webserver/tests/observe/pom.xml
        new file mode 100644
        index 00000000000..0592ce4fea9
        --- /dev/null
        +++ b/webserver/tests/observe/pom.xml
        @@ -0,0 +1,39 @@
        +
        +
        +
        +
        +    4.0.0
        +    
        +        io.helidon.webserver.tests
        +        helidon-webserver-tests-project
        +        4.0.0-SNAPSHOT
        +    
        +
        +    io.helidon.webserver.tests.observe
        +    helidon-webserver-tests-observe-project
        +    Helidon WebServer Tests Observe Project
        +
        +    pom
        +
        +    
        +        health
        +    
        +
        diff --git a/webserver/tests/pom.xml b/webserver/tests/pom.xml
        new file mode 100644
        index 00000000000..0e2be0ddb60
        --- /dev/null
        +++ b/webserver/tests/pom.xml
        @@ -0,0 +1,61 @@
        +
        +
        +
        +
        +    4.0.0
        +    
        +        io.helidon.webserver
        +        helidon-webserver-project
        +        4.0.0-SNAPSHOT
        +    
        +
        +    io.helidon.webserver.tests
        +    helidon-webserver-tests-project
        +    Helidon WebServer Tests Project
        +
        +    pom
        +
        +    
        +        access-log
        +        gh2631
        +        grpc
        +        http2
        +        imperative
        +        mtls
        +        observe
        +        resource-limits
        +        sse
        +        static-content
        +        upgrade
        +        webserver
        +        websocket
        +    
        +
        +    
        +        true
        +        true
        +        true
        +        true
        +        true
        +        true
        +        true
        +    
        +
        diff --git a/webserver/tests/resource-limits/pom.xml b/webserver/tests/resource-limits/pom.xml
        new file mode 100644
        index 00000000000..214fb6cf18a
        --- /dev/null
        +++ b/webserver/tests/resource-limits/pom.xml
        @@ -0,0 +1,81 @@
        +
        +
        +
        +    4.0.0
        +    
        +        io.helidon.webserver.tests
        +        helidon-webserver-tests-project
        +        4.0.0-SNAPSHOT
        +    
        +
        +    helidon-webserver-tests-resource-limits
        +    Helidon WebServer Tests Resource Limits
        +
        +    
        +        
        +            io.helidon.common
        +            helidon-common-key-util
        +        
        +        
        +            io.helidon.logging
        +            helidon-logging-common
        +        
        +        
        +            io.helidon.common
        +            helidon-common-configurable
        +        
        +        
        +            io.helidon.webserver
        +            helidon-webserver
        +        
        +        
        +            io.helidon.webserver
        +            helidon-webserver-http2
        +        
        +        
        +            io.helidon.webclient
        +            helidon-webclient-http2
        +            test
        +        
        +        
        +            io.helidon.webserver
        +            helidon-webserver-websocket
        +        
        +        
        +            io.helidon.webserver.testing.junit5
        +            helidon-webserver-testing-junit5
        +            test
        +        
        +        
        +            io.helidon.webserver.testing.junit5
        +            helidon-webserver-testing-junit5-http2
        +            test
        +        
        +        
        +            org.junit.jupiter
        +            junit-jupiter-api
        +            test
        +        
        +        
        +            org.hamcrest
        +            hamcrest-all
        +            test
        +        
        +    
        +
        \ No newline at end of file
        diff --git a/tests/integration/webserver/resource-limits/src/test/java/io/helidon/tests/integration/webserver/resourcelimit/IdleTimeoutTest.java b/webserver/tests/resource-limits/src/test/java/io/helidon/webserver/tests/resourcelimit/IdleTimeoutTest.java
        similarity index 86%
        rename from tests/integration/webserver/resource-limits/src/test/java/io/helidon/tests/integration/webserver/resourcelimit/IdleTimeoutTest.java
        rename to webserver/tests/resource-limits/src/test/java/io/helidon/webserver/tests/resourcelimit/IdleTimeoutTest.java
        index f54dd504d63..031ff6893d5 100644
        --- a/tests/integration/webserver/resource-limits/src/test/java/io/helidon/tests/integration/webserver/resourcelimit/IdleTimeoutTest.java
        +++ b/webserver/tests/resource-limits/src/test/java/io/helidon/webserver/tests/resourcelimit/IdleTimeoutTest.java
        @@ -14,18 +14,18 @@
          * limitations under the License.
          */
         
        -package io.helidon.tests.integration.webserver.resourcelimit;
        +package io.helidon.webserver.tests.resourcelimit;
         
         import java.time.Duration;
         import java.util.List;
         
        -import io.helidon.common.http.Http;
        +import io.helidon.http.Http;
         import io.helidon.common.testing.http.junit5.SocketHttpClient;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.testing.junit5.webserver.SetUpServer;
        -import io.helidon.nima.webserver.WebServerConfig;
        -import io.helidon.nima.webserver.http.HttpRules;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webserver.testing.junit5.SetUpServer;
        +import io.helidon.webserver.WebServerConfig;
        +import io.helidon.webserver.http.HttpRules;
         
         import org.junit.jupiter.api.Disabled;
         import org.junit.jupiter.api.Test;
        diff --git a/tests/integration/webserver/resource-limits/src/test/java/io/helidon/tests/integration/webserver/resourcelimit/MaxConcurrentRequestsTest.java b/webserver/tests/resource-limits/src/test/java/io/helidon/webserver/tests/resourcelimit/MaxConcurrentRequestsTest.java
        similarity index 83%
        rename from tests/integration/webserver/resource-limits/src/test/java/io/helidon/tests/integration/webserver/resourcelimit/MaxConcurrentRequestsTest.java
        rename to webserver/tests/resource-limits/src/test/java/io/helidon/webserver/tests/resourcelimit/MaxConcurrentRequestsTest.java
        index 3a0855e2911..d2a707cb00c 100644
        --- a/tests/integration/webserver/resource-limits/src/test/java/io/helidon/tests/integration/webserver/resourcelimit/MaxConcurrentRequestsTest.java
        +++ b/webserver/tests/resource-limits/src/test/java/io/helidon/webserver/tests/resourcelimit/MaxConcurrentRequestsTest.java
        @@ -14,21 +14,21 @@
          * limitations under the License.
          */
         
        -package io.helidon.tests.integration.webserver.resourcelimit;
        +package io.helidon.webserver.tests.resourcelimit;
         
         import java.util.List;
         import java.util.concurrent.CountDownLatch;
         
        -import io.helidon.common.http.Http;
        +import io.helidon.http.Http;
         import io.helidon.common.testing.http.junit5.SocketHttpClient;
        -import io.helidon.nima.http2.webclient.Http2Client;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.testing.junit5.webserver.SetUpServer;
        -import io.helidon.nima.webclient.api.ClientResponseTyped;
        -import io.helidon.nima.webclient.api.WebClient;
        -import io.helidon.nima.webserver.WebServerConfig;
        -import io.helidon.nima.webserver.http.HttpRules;
        +import io.helidon.webclient.http2.Http2Client;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webserver.testing.junit5.SetUpServer;
        +import io.helidon.webclient.api.ClientResponseTyped;
        +import io.helidon.webclient.api.WebClient;
        +import io.helidon.webserver.WebServerConfig;
        +import io.helidon.webserver.http.HttpRules;
         
         import org.junit.jupiter.api.BeforeEach;
         import org.junit.jupiter.api.Test;
        diff --git a/tests/integration/webserver/resource-limits/src/test/java/io/helidon/tests/integration/webserver/resourcelimit/MaxTcpConnectionsTest.java b/webserver/tests/resource-limits/src/test/java/io/helidon/webserver/tests/resourcelimit/MaxTcpConnectionsTest.java
        similarity index 84%
        rename from tests/integration/webserver/resource-limits/src/test/java/io/helidon/tests/integration/webserver/resourcelimit/MaxTcpConnectionsTest.java
        rename to webserver/tests/resource-limits/src/test/java/io/helidon/webserver/tests/resourcelimit/MaxTcpConnectionsTest.java
        index d89648507fa..a921a8d726b 100644
        --- a/tests/integration/webserver/resource-limits/src/test/java/io/helidon/tests/integration/webserver/resourcelimit/MaxTcpConnectionsTest.java
        +++ b/webserver/tests/resource-limits/src/test/java/io/helidon/webserver/tests/resourcelimit/MaxTcpConnectionsTest.java
        @@ -14,21 +14,21 @@
          * limitations under the License.
          */
         
        -package io.helidon.tests.integration.webserver.resourcelimit;
        +package io.helidon.webserver.tests.resourcelimit;
         
         import java.io.UncheckedIOException;
         import java.time.Duration;
         import java.util.List;
         
        -import io.helidon.common.http.Http;
        +import io.helidon.http.Http;
         import io.helidon.common.testing.http.junit5.SocketHttpClient;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.testing.junit5.webserver.SetUpServer;
        -import io.helidon.nima.webclient.api.ClientResponseTyped;
        -import io.helidon.nima.webclient.api.WebClient;
        -import io.helidon.nima.webserver.WebServerConfig;
        -import io.helidon.nima.webserver.http.HttpRules;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webserver.testing.junit5.SetUpServer;
        +import io.helidon.webclient.api.ClientResponseTyped;
        +import io.helidon.webclient.api.WebClient;
        +import io.helidon.webserver.WebServerConfig;
        +import io.helidon.webserver.http.HttpRules;
         
         import org.junit.jupiter.api.RepeatedTest;
         
        diff --git a/tests/integration/webserver/resource-limits/src/test/resources/logging-test.properties b/webserver/tests/resource-limits/src/test/resources/logging-test.properties
        similarity index 100%
        rename from tests/integration/webserver/resource-limits/src/test/resources/logging-test.properties
        rename to webserver/tests/resource-limits/src/test/resources/logging-test.properties
        diff --git a/webserver/tests/sse/pom.xml b/webserver/tests/sse/pom.xml
        new file mode 100644
        index 00000000000..101f7a418cf
        --- /dev/null
        +++ b/webserver/tests/sse/pom.xml
        @@ -0,0 +1,73 @@
        +
        +
        +
        +    4.0.0
        +    
        +        io.helidon.webserver.tests
        +        helidon-webserver-tests-project
        +        4.0.0-SNAPSHOT
        +    
        +
        +    helidon-webserver-tests-sse
        +    Helidon WebServer Tests SSE
        +    WebServer SSE tests
        +
        +    
        +        
        +            io.helidon.webserver
        +            helidon-webserver-sse
        +            test
        +        
        +        
        +            io.helidon.webclient
        +            helidon-webclient-sse
        +            test
        +        
        +        
        +            io.helidon.http.media
        +            helidon-http-media-jsonp
        +            test
        +        
        +        
        +            jakarta.json
        +            jakarta.json-api
        +            test
        +        
        +        
        +            io.helidon.http.media
        +            helidon-http-media-jsonb
        +            test
        +        
        +        
        +            io.helidon.webserver.testing.junit5
        +            helidon-webserver-testing-junit5
        +            test
        +        
        +        
        +            org.junit.jupiter
        +            junit-jupiter-api
        +            test
        +        
        +        
        +            org.hamcrest
        +            hamcrest-all
        +            test
        +        
        +    
        +
        diff --git a/webserver/tests/sse/src/main/resources/logging.properties b/webserver/tests/sse/src/main/resources/logging.properties
        new file mode 100644
        index 00000000000..0e19300461d
        --- /dev/null
        +++ b/webserver/tests/sse/src/main/resources/logging.properties
        @@ -0,0 +1,20 @@
        +#
        +# Copyright (c) 2023 Oracle and/or its affiliates.
        +#
        +# 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.
        +#
        +handlers=java.util.logging.ConsoleHandler
        +java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS.%1$tL %5$s%6$s%n
        +# Global logging level. Can be overridden by specific loggers
        +.level=INFO
        +io.helidon.webserver.level=INFO
        diff --git a/nima/tests/integration/sse/server/src/test/java/io/helidon/nima/tests/integration/sse/webserver/SseBaseTest.java b/webserver/tests/sse/src/test/java/io/helidon/webserver/tests/sse/SseBaseTest.java
        similarity index 92%
        rename from nima/tests/integration/sse/server/src/test/java/io/helidon/nima/tests/integration/sse/webserver/SseBaseTest.java
        rename to webserver/tests/sse/src/test/java/io/helidon/webserver/tests/sse/SseBaseTest.java
        index 823012f0a0b..c25552ecb46 100644
        --- a/nima/tests/integration/sse/server/src/test/java/io/helidon/nima/tests/integration/sse/webserver/SseBaseTest.java
        +++ b/webserver/tests/sse/src/test/java/io/helidon/webserver/tests/sse/SseBaseTest.java
        @@ -14,12 +14,12 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.sse.webserver;
        +package io.helidon.webserver.tests.sse;
         
        -import io.helidon.nima.sse.SseEvent;
        -import io.helidon.nima.sse.webserver.SseSink;
        -import io.helidon.nima.webserver.http.ServerRequest;
        -import io.helidon.nima.webserver.http.ServerResponse;
        +import io.helidon.http.sse.SseEvent;
        +import io.helidon.webserver.sse.SseSink;
        +import io.helidon.webserver.http.ServerRequest;
        +import io.helidon.webserver.http.ServerResponse;
         import jakarta.json.Json;
         import jakarta.json.JsonObject;
         
        diff --git a/nima/tests/integration/sse/server/src/test/java/io/helidon/nima/tests/integration/sse/webserver/SseClientTest.java b/webserver/tests/sse/src/test/java/io/helidon/webserver/tests/sse/SseClientTest.java
        similarity index 87%
        rename from nima/tests/integration/sse/server/src/test/java/io/helidon/nima/tests/integration/sse/webserver/SseClientTest.java
        rename to webserver/tests/sse/src/test/java/io/helidon/webserver/tests/sse/SseClientTest.java
        index 5ef1165d01a..771193fcf0c 100644
        --- a/nima/tests/integration/sse/server/src/test/java/io/helidon/nima/tests/integration/sse/webserver/SseClientTest.java
        +++ b/webserver/tests/sse/src/test/java/io/helidon/webserver/tests/sse/SseClientTest.java
        @@ -14,27 +14,27 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.sse.webserver;
        +package io.helidon.webserver.tests.sse;
         
         import java.util.concurrent.CountDownLatch;
         import java.util.concurrent.TimeUnit;
         
         import io.helidon.common.media.type.MediaTypes;
        -import io.helidon.nima.sse.SseEvent;
        -import io.helidon.nima.sse.webclient.SseSource;
        -import io.helidon.nima.sse.webserver.SseSink;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webclient.http1.Http1ClientResponse;
        -import io.helidon.nima.webserver.http.HttpRules;
        -import io.helidon.nima.webserver.http.ServerRequest;
        -import io.helidon.nima.webserver.http.ServerResponse;
        +import io.helidon.http.sse.SseEvent;
        +import io.helidon.webclient.sse.SseSource;
        +import io.helidon.webserver.sse.SseSink;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webclient.http1.Http1ClientResponse;
        +import io.helidon.webserver.http.HttpRules;
        +import io.helidon.webserver.http.ServerRequest;
        +import io.helidon.webserver.http.ServerResponse;
         
         import jakarta.json.JsonObject;
         import org.junit.jupiter.api.Test;
         
        -import static io.helidon.common.http.Http.Headers.ACCEPT_EVENT_STREAM;
        +import static io.helidon.http.Http.Headers.ACCEPT_EVENT_STREAM;
         import static org.hamcrest.CoreMatchers.is;
         import static org.hamcrest.CoreMatchers.notNullValue;
         import static org.hamcrest.MatcherAssert.assertThat;
        diff --git a/nima/tests/integration/sse/server/src/test/java/io/helidon/nima/tests/integration/sse/webserver/SseEventTest.java b/webserver/tests/sse/src/test/java/io/helidon/webserver/tests/sse/SseEventTest.java
        similarity index 95%
        rename from nima/tests/integration/sse/server/src/test/java/io/helidon/nima/tests/integration/sse/webserver/SseEventTest.java
        rename to webserver/tests/sse/src/test/java/io/helidon/webserver/tests/sse/SseEventTest.java
        index 09c5cc78878..48858f99edd 100644
        --- a/nima/tests/integration/sse/server/src/test/java/io/helidon/nima/tests/integration/sse/webserver/SseEventTest.java
        +++ b/webserver/tests/sse/src/test/java/io/helidon/webserver/tests/sse/SseEventTest.java
        @@ -14,11 +14,11 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.sse.webserver;
        +package io.helidon.webserver.tests.sse;
         
         import io.helidon.common.media.type.MediaTypes;
        -import io.helidon.nima.http.media.MediaContext;
        -import io.helidon.nima.sse.SseEvent;
        +import io.helidon.http.media.MediaContext;
        +import io.helidon.http.sse.SseEvent;
         
         import org.junit.jupiter.api.Test;
         
        diff --git a/nima/tests/integration/sse/server/src/test/java/io/helidon/nima/tests/integration/sse/webserver/SseServerMediaTest.java b/webserver/tests/sse/src/test/java/io/helidon/webserver/tests/sse/SseServerMediaTest.java
        similarity index 82%
        rename from nima/tests/integration/sse/server/src/test/java/io/helidon/nima/tests/integration/sse/webserver/SseServerMediaTest.java
        rename to webserver/tests/sse/src/test/java/io/helidon/webserver/tests/sse/SseServerMediaTest.java
        index f953b000e2b..0702ba806a4 100644
        --- a/nima/tests/integration/sse/server/src/test/java/io/helidon/nima/tests/integration/sse/webserver/SseServerMediaTest.java
        +++ b/webserver/tests/sse/src/test/java/io/helidon/webserver/tests/sse/SseServerMediaTest.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.sse.webserver;
        +package io.helidon.webserver.tests.sse;
         
         import java.io.IOException;
         import java.io.OutputStream;
        @@ -24,33 +24,33 @@
         import io.helidon.common.GenericType;
         import io.helidon.common.Weighted;
         import io.helidon.common.config.Config;
        -import io.helidon.common.http.Headers;
        -import io.helidon.common.http.Http;
        -import io.helidon.common.http.HttpMediaType;
        -import io.helidon.common.http.WritableHeaders;
        -import io.helidon.nima.http.media.EntityWriter;
        -import io.helidon.nima.http.media.MediaSupport;
        -import io.helidon.nima.http.media.StringSupport;
        -import io.helidon.nima.http.media.spi.MediaSupportProvider;
        -import io.helidon.nima.sse.SseEvent;
        -import io.helidon.nima.sse.webserver.SseSink;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webclient.http1.Http1ClientResponse;
        -import io.helidon.nima.webserver.http.HttpRules;
        -import io.helidon.nima.webserver.http.ServerRequest;
        -import io.helidon.nima.webserver.http.ServerResponse;
        +import io.helidon.http.Headers;
        +import io.helidon.http.Http;
        +import io.helidon.http.HttpMediaType;
        +import io.helidon.http.WritableHeaders;
        +import io.helidon.http.media.EntityWriter;
        +import io.helidon.http.media.MediaSupport;
        +import io.helidon.http.media.StringSupport;
        +import io.helidon.http.media.spi.MediaSupportProvider;
        +import io.helidon.http.sse.SseEvent;
        +import io.helidon.webserver.sse.SseSink;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webclient.http1.Http1ClientResponse;
        +import io.helidon.webserver.http.HttpRules;
        +import io.helidon.webserver.http.ServerRequest;
        +import io.helidon.webserver.http.ServerResponse;
         
         import org.junit.jupiter.api.Test;
         
        -import static io.helidon.common.http.Http.Headers.ACCEPT_EVENT_STREAM;
        +import static io.helidon.http.Http.Headers.ACCEPT_EVENT_STREAM;
         import static org.hamcrest.CoreMatchers.is;
         import static org.hamcrest.MatcherAssert.assertThat;
         
         /**
          * Test that shows how to serialize an individual SSE event using a custom
        - * {@link io.helidon.nima.http.media.spi.MediaSupportProvider} and a user-defined
        + * {@link io.helidon.http.media.spi.MediaSupportProvider} and a user-defined
          * media type. Each SSE event can be given a different media type.
          */
         @ServerTest
        diff --git a/nima/tests/integration/sse/server/src/test/java/io/helidon/nima/tests/integration/sse/webserver/SseServerTest.java b/webserver/tests/sse/src/test/java/io/helidon/webserver/tests/sse/SseServerTest.java
        similarity index 84%
        rename from nima/tests/integration/sse/server/src/test/java/io/helidon/nima/tests/integration/sse/webserver/SseServerTest.java
        rename to webserver/tests/sse/src/test/java/io/helidon/webserver/tests/sse/SseServerTest.java
        index bfa6d43d90a..4dbf54ea613 100644
        --- a/nima/tests/integration/sse/server/src/test/java/io/helidon/nima/tests/integration/sse/webserver/SseServerTest.java
        +++ b/webserver/tests/sse/src/test/java/io/helidon/webserver/tests/sse/SseServerTest.java
        @@ -14,19 +14,19 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.sse.webserver;
        +package io.helidon.webserver.tests.sse;
         
        -import io.helidon.common.http.Http;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webclient.http1.Http1ClientResponse;
        -import io.helidon.nima.webserver.http.HttpRules;
        +import io.helidon.http.Http;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webclient.http1.Http1ClientResponse;
        +import io.helidon.webserver.http.HttpRules;
         
         import org.junit.jupiter.api.Test;
         
        -import static io.helidon.common.http.Http.Headers.ACCEPT_EVENT_STREAM;
        -import static io.helidon.common.http.Http.Headers.ACCEPT_JSON;
        +import static io.helidon.http.Http.Headers.ACCEPT_EVENT_STREAM;
        +import static io.helidon.http.Http.Headers.ACCEPT_JSON;
         import static org.hamcrest.CoreMatchers.is;
         import static org.hamcrest.MatcherAssert.assertThat;
         
        diff --git a/webserver/tests/sse/src/test/resources/META-INF/services/io.helidon.http.media.spi.MediaSupportProvider b/webserver/tests/sse/src/test/resources/META-INF/services/io.helidon.http.media.spi.MediaSupportProvider
        new file mode 100644
        index 00000000000..4873e615c83
        --- /dev/null
        +++ b/webserver/tests/sse/src/test/resources/META-INF/services/io.helidon.http.media.spi.MediaSupportProvider
        @@ -0,0 +1 @@
        +io.helidon.webserver.tests.sse.SseServerMediaTest$MyStringSupportProvider
        diff --git a/webserver/tests/static-content/pom.xml b/webserver/tests/static-content/pom.xml
        new file mode 100644
        index 00000000000..d2c152b4cb5
        --- /dev/null
        +++ b/webserver/tests/static-content/pom.xml
        @@ -0,0 +1,56 @@
        +
        +
        +
        +    4.0.0
        +    
        +        io.helidon.webserver.tests
        +        helidon-webserver-tests-project
        +        4.0.0-SNAPSHOT
        +    
        +
        +    helidon-tests-static-content
        +    Helidon WebServer Tests Static Content
        +    WebServer Static Content tests
        +
        +    
        +        
        +            io.helidon.webserver
        +            helidon-webserver
        +        
        +        
        +            io.helidon.webserver
        +            helidon-webserver-static-content
        +        
        +        
        +            io.helidon.webserver.testing.junit5
        +            helidon-webserver-testing-junit5
        +            test
        +        
        +        
        +            org.junit.jupiter
        +            junit-jupiter-api
        +            test
        +        
        +        
        +            org.hamcrest
        +            hamcrest-all
        +            test
        +        
        +    
        +
        diff --git a/webserver/tests/static-content/src/test/java/io/helidon/webserver/tests/staticcontent/StaticContentTest.java b/webserver/tests/static-content/src/test/java/io/helidon/webserver/tests/staticcontent/StaticContentTest.java
        new file mode 100644
        index 00000000000..d016ede09ad
        --- /dev/null
        +++ b/webserver/tests/static-content/src/test/java/io/helidon/webserver/tests/staticcontent/StaticContentTest.java
        @@ -0,0 +1,84 @@
        +/*
        + * Copyright (c) 2022, 2023 Oracle and/or its affiliates.
        + *
        + * Licensed under the Apache License, Version 2.0 (the "License");
        + * you may not use this file except in compliance with the License.
        + * You may obtain a copy of the License at
        + *
        + *     http://www.apache.org/licenses/LICENSE-2.0
        + *
        + * Unless required by applicable law or agreed to in writing, software
        + * distributed under the License is distributed on an "AS IS" BASIS,
        + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        + * See the License for the specific language governing permissions and
        + * limitations under the License.
        + */
        +
        +package io.helidon.webserver.tests.staticcontent;
        +
        +import io.helidon.http.Http;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webclient.http1.Http1ClientResponse;
        +import io.helidon.webserver.http.HttpRouting;
        +import io.helidon.webserver.staticcontent.StaticContentService;
        +
        +import org.junit.jupiter.api.Test;
        +
        +import static org.hamcrest.CoreMatchers.is;
        +import static org.hamcrest.MatcherAssert.assertThat;
        +
        +@ServerTest
        +class StaticContentTest {
        +    private final Http1Client client;
        +
        +    StaticContentTest(Http1Client client) {
        +        this.client = client;
        +    }
        +
        +    @SetUpRoute
        +    static void routing(HttpRouting.Builder routing) {
        +        routing.register("/files", StaticContentService.builder("static")
        +                        .welcomeFileName("welcome.txt")
        +                        .build())
        +                .get("/files/default", (req, res) -> res.send("Nexted"));
        +    }
        +
        +    @Test
        +    void testWelcomeFile() {
        +        String response = client.get("/files/")
        +                .requestEntity(String.class);
        +        assertThat(response, is("Welcome"));
        +    }
        +
        +    @Test
        +    void testStaticContent() {
        +        String response = client.get("/files/static-content.txt")
        +                .requestEntity(String.class);
        +        assertThat(response, is("Hi"));
        +    }
        +
        +    @Test
        +    void testNexted() {
        +        String response = client.get("/files/default")
        +                .requestEntity(String.class);
        +        assertThat(response, is("Nexted"));
        +    }
        +
        +    @Test
        +    void testNotFound() {
        +        try (Http1ClientResponse response = client.get("/files/notThere")
        +                .request()) {
        +            assertThat(response.status(), is(Http.Status.NOT_FOUND_404));
        +        }
        +    }
        +
        +    @Test
        +    void testOutOfDirectory() {
        +        try (Http1ClientResponse response = client.get("/files/../logging-test.properties")
        +                .request()) {
        +            assertThat(response.status(), is(Http.Status.NOT_FOUND_404));
        +        }
        +    }
        +}
        diff --git a/webserver/tests/static-content/src/test/resources/logging-test.properties b/webserver/tests/static-content/src/test/resources/logging-test.properties
        new file mode 100644
        index 00000000000..45dfc6ab984
        --- /dev/null
        +++ b/webserver/tests/static-content/src/test/resources/logging-test.properties
        @@ -0,0 +1,23 @@
        +#
        +# Copyright (c) 2022, 2023 Oracle and/or its affiliates.
        +#
        +# 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.
        +#
        +handlers=java.util.logging.ConsoleHandler
        +java.util.logging.ConsoleHandler.level=FINEST
        +java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
        +java.util.logging.SimpleFormatter.format=%1$tH:%1$tM:%1$tS %4$s %3$s %5$s%6$s%n
        +# Global logging level. Can be overridden by specific loggers
        +.level=INFO
        +io.helidon.webserver.level=WARNING
        +
        diff --git a/nima/tests/integration/webserver/static-content/src/test/resources/static/static-content.txt b/webserver/tests/static-content/src/test/resources/static/static-content.txt
        similarity index 100%
        rename from nima/tests/integration/webserver/static-content/src/test/resources/static/static-content.txt
        rename to webserver/tests/static-content/src/test/resources/static/static-content.txt
        diff --git a/nima/tests/integration/webserver/static-content/src/test/resources/static/welcome.txt b/webserver/tests/static-content/src/test/resources/static/welcome.txt
        similarity index 100%
        rename from nima/tests/integration/webserver/static-content/src/test/resources/static/welcome.txt
        rename to webserver/tests/static-content/src/test/resources/static/welcome.txt
        diff --git a/webserver/tests/upgrade/pom.xml b/webserver/tests/upgrade/pom.xml
        new file mode 100644
        index 00000000000..fe273578556
        --- /dev/null
        +++ b/webserver/tests/upgrade/pom.xml
        @@ -0,0 +1,117 @@
        +
        +
        +
        +    4.0.0
        +    
        +        io.helidon.webserver.tests
        +        helidon-webserver-tests-project
        +        4.0.0-SNAPSHOT
        +    
        +
        +    helidon-webserver-tests-upgrade
        +    Helidon WebServer Tests Upgrade
        +
        +    
        +        
        +            io.helidon.common
        +            helidon-common-key-util
        +        
        +        
        +            io.helidon.logging
        +            helidon-logging-common
        +        
        +        
        +            io.helidon.common
        +            helidon-common-configurable
        +        
        +        
        +            io.helidon.webserver
        +            helidon-webserver
        +        
        +        
        +            io.helidon.webserver
        +            helidon-webserver-http2
        +        
        +        
        +            io.helidon.webclient
        +            helidon-webclient-http2
        +            test
        +        
        +        
        +            io.helidon.webserver
        +            helidon-webserver-websocket
        +        
        +        
        +            io.helidon.http.encoding
        +            helidon-http-encoding-deflate
        +        
        +        
        +            io.helidon.http.encoding
        +            helidon-http-encoding-gzip
        +        
        +        
        +            io.helidon.logging
        +            helidon-logging-jul
        +        
        +        
        +            io.helidon.webserver.testing.junit5
        +            helidon-webserver-testing-junit5
        +            test
        +        
        +        
        +            org.junit.jupiter
        +            junit-jupiter-api
        +            test
        +        
        +        
        +            org.hamcrest
        +            hamcrest-all
        +            test
        +        
        +        
        +            org.junit.jupiter
        +            junit-jupiter-params
        +            test
        +        
        +    
        +
        +    
        +        
        +            
        +                org.apache.maven.plugins
        +                maven-compiler-plugin
        +                
        +                    
        +                        default-testCompile
        +                        
        +                            
        +                            
        +                                --add-modules
        +                                java.net.http
        +                            
        +                        
        +                    
        +                
        +            
        +        
        +    
        +
        +
        \ No newline at end of file
        diff --git a/tests/integration/webserver/upgrade/src/main/java/io/helidon/integration/webserver/upgrade/EchoWsListener.java b/webserver/tests/upgrade/src/main/java/io/helidon/webserver/tests/upgrade/EchoWsListener.java
        similarity index 90%
        rename from tests/integration/webserver/upgrade/src/main/java/io/helidon/integration/webserver/upgrade/EchoWsListener.java
        rename to webserver/tests/upgrade/src/main/java/io/helidon/webserver/tests/upgrade/EchoWsListener.java
        index 184596c7ff4..22d91c96e23 100644
        --- a/tests/integration/webserver/upgrade/src/main/java/io/helidon/integration/webserver/upgrade/EchoWsListener.java
        +++ b/webserver/tests/upgrade/src/main/java/io/helidon/webserver/tests/upgrade/EchoWsListener.java
        @@ -14,12 +14,12 @@
          * limitations under the License.
          */
         
        -package io.helidon.integration.webserver.upgrade;
        +package io.helidon.webserver.tests.upgrade;
         
         import java.lang.System.Logger.Level;
         
        -import io.helidon.nima.websocket.WsListener;
        -import io.helidon.nima.websocket.WsSession;
        +import io.helidon.websocket.WsListener;
        +import io.helidon.websocket.WsSession;
         
         public class EchoWsListener implements WsListener {
         
        diff --git a/webserver/tests/upgrade/src/main/java/io/helidon/webserver/tests/upgrade/Main.java b/webserver/tests/upgrade/src/main/java/io/helidon/webserver/tests/upgrade/Main.java
        new file mode 100644
        index 00000000000..94c6dfa6e82
        --- /dev/null
        +++ b/webserver/tests/upgrade/src/main/java/io/helidon/webserver/tests/upgrade/Main.java
        @@ -0,0 +1,71 @@
        +/*
        + * Copyright (c) 2022, 2023 Oracle and/or its affiliates.
        + *
        + * Licensed under the Apache License, Version 2.0 (the "License");
        + * you may not use this file except in compliance with the License.
        + * You may obtain a copy of the License at
        + *
        + *     http://www.apache.org/licenses/LICENSE-2.0
        + *
        + * Unless required by applicable law or agreed to in writing, software
        + * distributed under the License is distributed on an "AS IS" BASIS,
        + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        + * See the License for the specific language governing permissions and
        + * limitations under the License.
        + */
        +
        +package io.helidon.webserver.tests.upgrade;
        +
        +import io.helidon.common.configurable.Resource;
        +import io.helidon.http.Http;
        +import io.helidon.http.PathMatchers;
        +import io.helidon.common.pki.Keys;
        +import io.helidon.logging.common.LogConfig;
        +import io.helidon.webserver.http2.Http2Route;
        +import io.helidon.webserver.WebServer;
        +import io.helidon.webserver.http1.Http1Route;
        +import io.helidon.webserver.websocket.WsRouting;
        +
        +import static io.helidon.http.Http.Method.GET;
        +import static io.helidon.http.Http.Method.POST;
        +import static io.helidon.http.Http.Method.PUT;
        +
        +public class Main {
        +
        +    public static void main(String[] args) {
        +        LogConfig.configureRuntime();
        +        startServer(true);
        +    }
        +
        +    public static WebServer startServer(boolean ssl) {
        +        Keys privateKeyConfig = Keys.builder()
        +                .keystore(store -> store.passphrase("helidon")
        +                        .keystore(Resource.create("server.p12")))
        +                .build();
        +
        +        return WebServer.builder()
        +                .update(server -> {
        +                    server.host("localhost");
        +                    if (ssl) {
        +                        server.tls(tls -> tls
        +                                .privateKey(privateKeyConfig)
        +                                .privateKeyCertChain(privateKeyConfig));
        +                    }
        +                })
        +                .routing(r -> r
        +                        .get("/", (req, res) -> res.send("HTTP Version " + req.prologue().protocolVersion() + "\n"))
        +                        .route(Http1Route.route(GET, "/versionspecific", (req, res) -> res.send("HTTP/1.1 route\n")))
        +                        .route(Http2Route.route(GET, "/versionspecific", (req, res) -> res.send("HTTP/2.0 route\n")))
        +                        .route(Http1Route.route(GET, "/versionspecific1", (req, res) -> res.send("HTTP/1.1 route\n")))
        +                        .route(Http2Route.route(GET, "/versionspecific2", (req, res) -> res.send("HTTP/2.0 route\n")))
        +                        .route(Http.Method.predicate(GET, POST, PUT),
        +                                PathMatchers.create("/multi*"),
        +                                (req, res) -> res.send("HTTP/" + req.prologue().protocolVersion()
        +                                                               + " route " + req.prologue().method() + "\n")))
        +                .addRouting(WsRouting.builder()
        +                                    .endpoint("/ws-echo", new EchoWsListener())
        +                                    .build())
        +                .build()
        +                .start();
        +    }
        +}
        diff --git a/webserver/tests/upgrade/src/main/java/module-info.java b/webserver/tests/upgrade/src/main/java/module-info.java
        new file mode 100644
        index 00000000000..b19598ccffb
        --- /dev/null
        +++ b/webserver/tests/upgrade/src/main/java/module-info.java
        @@ -0,0 +1,30 @@
        +/*
        + * Copyright (c) 2022, 2023 Oracle and/or its affiliates.
        + *
        + * 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.
        + */
        +
        +/**
        + * Integration test for routing composition.
        + */
        +module helidon.tests.integration.webserver.upgrade {
        +
        +    exports io.helidon.webserver.tests.upgrade;
        +
        +    requires io.helidon.logging.common;
        +    requires io.helidon.http;
        +    requires io.helidon.webserver;
        +    requires io.helidon.common.pki;
        +    requires io.helidon.webserver.http2;
        +    requires io.helidon.webserver.websocket;
        +}
        \ No newline at end of file
        diff --git a/tests/integration/webserver/upgrade/src/main/resources/cert-config.ext b/webserver/tests/upgrade/src/main/resources/cert-config.ext
        similarity index 100%
        rename from tests/integration/webserver/upgrade/src/main/resources/cert-config.ext
        rename to webserver/tests/upgrade/src/main/resources/cert-config.ext
        diff --git a/tests/integration/webserver/upgrade/src/main/resources/cert-config.txt b/webserver/tests/upgrade/src/main/resources/cert-config.txt
        similarity index 100%
        rename from tests/integration/webserver/upgrade/src/main/resources/cert-config.txt
        rename to webserver/tests/upgrade/src/main/resources/cert-config.txt
        diff --git a/tests/integration/webserver/upgrade/src/main/resources/certificate_notes.md b/webserver/tests/upgrade/src/main/resources/certificate_notes.md
        similarity index 100%
        rename from tests/integration/webserver/upgrade/src/main/resources/certificate_notes.md
        rename to webserver/tests/upgrade/src/main/resources/certificate_notes.md
        diff --git a/webserver/tests/upgrade/src/main/resources/logging.properties b/webserver/tests/upgrade/src/main/resources/logging.properties
        new file mode 100644
        index 00000000000..2efd86596c9
        --- /dev/null
        +++ b/webserver/tests/upgrade/src/main/resources/logging.properties
        @@ -0,0 +1,23 @@
        +#
        +# Copyright (c) 2017, 2023 Oracle and/or its affiliates.
        +#
        +# 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.
        +#
        +
        +
        +#All attributes details
        +handlers=io.helidon.logging.jul.HelidonConsoleHandler
        +java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$s %3$s !thread!: %5$s%6$s%n
        +
        +#All log level details
        +.level=FINEST
        diff --git a/tests/integration/webserver/upgrade/src/main/resources/server.p12 b/webserver/tests/upgrade/src/main/resources/server.p12
        similarity index 100%
        rename from tests/integration/webserver/upgrade/src/main/resources/server.p12
        rename to webserver/tests/upgrade/src/main/resources/server.p12
        diff --git a/tests/integration/webserver/upgrade/src/test/java/io/helidon/integration/webserver/upgrade/test/CompressionTest.java b/webserver/tests/upgrade/src/test/java/io/helidon/webserver/tests/upgrade/test/CompressionTest.java
        similarity index 85%
        rename from tests/integration/webserver/upgrade/src/test/java/io/helidon/integration/webserver/upgrade/test/CompressionTest.java
        rename to webserver/tests/upgrade/src/test/java/io/helidon/webserver/tests/upgrade/test/CompressionTest.java
        index c3d5cae23e9..7163c64b1de 100644
        --- a/tests/integration/webserver/upgrade/src/test/java/io/helidon/integration/webserver/upgrade/test/CompressionTest.java
        +++ b/webserver/tests/upgrade/src/test/java/io/helidon/webserver/tests/upgrade/test/CompressionTest.java
        @@ -16,14 +16,14 @@
         
         package io.helidon.integration.webserver.upgrade.test;
         
        -import io.helidon.common.http.Http;
        -import io.helidon.common.http.Http.HeaderNames;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webclient.http1.Http1ClientRequest;
        -import io.helidon.nima.webclient.http1.Http1ClientResponse;
        -import io.helidon.nima.webserver.http.HttpRules;
        +import io.helidon.http.Http;
        +import io.helidon.http.Http.HeaderNames;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webclient.http1.Http1ClientRequest;
        +import io.helidon.webclient.http1.Http1ClientResponse;
        +import io.helidon.webserver.http.HttpRules;
         
         import org.junit.jupiter.api.Test;
         
        diff --git a/tests/integration/webserver/upgrade/src/test/java/io/helidon/integration/webserver/upgrade/test/UpgradeCodecsCompositionTest.java b/webserver/tests/upgrade/src/test/java/io/helidon/webserver/tests/upgrade/test/UpgradeCodecsCompositionTest.java
        similarity index 94%
        rename from tests/integration/webserver/upgrade/src/test/java/io/helidon/integration/webserver/upgrade/test/UpgradeCodecsCompositionTest.java
        rename to webserver/tests/upgrade/src/test/java/io/helidon/webserver/tests/upgrade/test/UpgradeCodecsCompositionTest.java
        index 4031c49f3b2..89e7e6121b3 100644
        --- a/tests/integration/webserver/upgrade/src/test/java/io/helidon/integration/webserver/upgrade/test/UpgradeCodecsCompositionTest.java
        +++ b/webserver/tests/upgrade/src/test/java/io/helidon/webserver/tests/upgrade/test/UpgradeCodecsCompositionTest.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.integration.webserver.upgrade.test;
        +package io.helidon.webserver.tests.upgrade.test;
         
         import java.io.IOException;
         import java.net.URI;
        @@ -38,14 +38,14 @@
         import javax.net.ssl.X509TrustManager;
         
         import io.helidon.common.configurable.Resource;
        -import io.helidon.common.http.Http;
        -import io.helidon.integration.webserver.upgrade.Main;
        +import io.helidon.http.Http;
        +import io.helidon.webserver.tests.upgrade.Main;
         import io.helidon.logging.common.LogConfig;
        -import io.helidon.nima.common.tls.Tls;
        -import io.helidon.nima.http2.webclient.Http2Client;
        -import io.helidon.nima.webclient.api.HttpClientResponse;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webserver.WebServer;
        +import io.helidon.common.tls.Tls;
        +import io.helidon.webclient.http2.Http2Client;
        +import io.helidon.webclient.api.HttpClientResponse;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webserver.WebServer;
         
         import org.hamcrest.Matchers;
         import org.junit.jupiter.api.AfterAll;
        @@ -54,8 +54,8 @@
         import org.junit.jupiter.params.ParameterizedTest;
         import org.junit.jupiter.params.provider.ValueSource;
         
        -import static io.helidon.common.http.Http.Method.GET;
        -import static io.helidon.common.http.Http.Method.HEAD;
        +import static io.helidon.http.Http.Method.GET;
        +import static io.helidon.http.Http.Method.HEAD;
         import static java.net.http.HttpClient.Version.HTTP_1_1;
         import static java.net.http.HttpClient.Version.HTTP_2;
         import static org.hamcrest.MatcherAssert.assertThat;
        @@ -269,7 +269,7 @@ private HttpResponse httpClient(Http.Method method,
                                                .build(), HttpResponse.BodyHandlers.ofString());
             }
         
        -    private HttpClientResponse doRequest(io.helidon.nima.webclient.api.HttpClient client,
        +    private HttpClientResponse doRequest(io.helidon.webclient.api.HttpClient client,
                                                  Http.Method method,
                                                  String url) {
                 return client.method(method)
        diff --git a/tests/integration/webserver/upgrade/src/test/resources/logging-test.properties b/webserver/tests/upgrade/src/test/resources/logging-test.properties
        similarity index 100%
        rename from tests/integration/webserver/upgrade/src/test/resources/logging-test.properties
        rename to webserver/tests/upgrade/src/test/resources/logging-test.properties
        diff --git a/webserver/tests/webserver/pom.xml b/webserver/tests/webserver/pom.xml
        new file mode 100644
        index 00000000000..d33e1ef6b9a
        --- /dev/null
        +++ b/webserver/tests/webserver/pom.xml
        @@ -0,0 +1,57 @@
        +
        +
        +
        +    4.0.0
        +    
        +        io.helidon.webserver.tests
        +        helidon-webserver-tests-project
        +        4.0.0-SNAPSHOT
        +    
        +
        +    helidon-weserver-tests-webserver
        +    Helidon WebServer Tests Legacy
        +    WebServer tests
        +
        +    
        +        
        +            io.helidon.webserver
        +            helidon-webserver
        +        
        +        
        +            io.helidon.webserver.testing.junit5
        +            helidon-webserver-testing-junit5
        +            test
        +        
        +        
        +            org.junit.jupiter
        +            junit-jupiter-api
        +            test
        +        
        +        
        +            org.junit.jupiter
        +            junit-jupiter-params
        +            test
        +        
        +        
        +            org.hamcrest
        +            hamcrest-all
        +            test
        +        
        +    
        +
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/BadRequestTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/BadRequestTest.java
        similarity index 89%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/BadRequestTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/BadRequestTest.java
        index 91febee3205..dc1091a34e6 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/BadRequestTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/BadRequestTest.java
        @@ -14,24 +14,24 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
         import java.util.List;
         
        -import io.helidon.common.http.ClientResponseHeaders;
        -import io.helidon.common.http.DirectHandler;
        -import io.helidon.common.http.Http;
        -import io.helidon.common.http.Http.HeaderNames;
        -import io.helidon.common.http.ServerResponseHeaders;
        +import io.helidon.http.ClientResponseHeaders;
        +import io.helidon.http.DirectHandler;
        +import io.helidon.http.Http;
        +import io.helidon.http.Http.HeaderNames;
        +import io.helidon.http.ServerResponseHeaders;
         import io.helidon.common.testing.http.junit5.SocketHttpClient;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.testing.junit5.webserver.SetUpServer;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webserver.WebServerConfig;
        -import io.helidon.nima.webserver.http.DirectHandlers;
        -import io.helidon.nima.webserver.http.HttpRules;
        -import io.helidon.nima.webserver.http1.Http1Route;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webserver.testing.junit5.SetUpServer;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webserver.WebServerConfig;
        +import io.helidon.webserver.http.DirectHandlers;
        +import io.helidon.webserver.http.HttpRules;
        +import io.helidon.webserver.http1.Http1Route;
         
         import org.junit.jupiter.api.Test;
         
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ConfiguredLimitsTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ConfiguredLimitsTest.java
        similarity index 82%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ConfiguredLimitsTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ConfiguredLimitsTest.java
        index 6f0eb11bc08..108e6184869 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ConfiguredLimitsTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ConfiguredLimitsTest.java
        @@ -14,25 +14,25 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        -
        -import io.helidon.common.http.Http;
        -import io.helidon.common.http.Http.HeaderName;
        -import io.helidon.common.http.Http.HeaderNames;
        -import io.helidon.common.http.ServerRequestHeaders;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.testing.junit5.webserver.SetUpServer;
        -import io.helidon.nima.webclient.api.HttpClientResponse;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webclient.http1.Http1ClientResponse;
        -import io.helidon.nima.webserver.WebServerConfig;
        -import io.helidon.nima.webserver.http.HttpRules;
        -import io.helidon.nima.webserver.http.ServerRequest;
        -import io.helidon.nima.webserver.http.ServerResponse;
        -import io.helidon.nima.webserver.http1.Http1Config;
        -import io.helidon.nima.webserver.http1.Http1ConnectionSelector;
        -import io.helidon.nima.webserver.spi.ServerConnectionSelector;
        +package io.helidon.webserver.tests;
        +
        +import io.helidon.http.Http;
        +import io.helidon.http.Http.HeaderName;
        +import io.helidon.http.Http.HeaderNames;
        +import io.helidon.http.ServerRequestHeaders;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webserver.testing.junit5.SetUpServer;
        +import io.helidon.webclient.api.HttpClientResponse;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webclient.http1.Http1ClientResponse;
        +import io.helidon.webserver.WebServerConfig;
        +import io.helidon.webserver.http.HttpRules;
        +import io.helidon.webserver.http.ServerRequest;
        +import io.helidon.webserver.http.ServerResponse;
        +import io.helidon.webserver.http1.Http1Config;
        +import io.helidon.webserver.http1.Http1ConnectionSelector;
        +import io.helidon.webserver.spi.ServerConnectionSelector;
         
         import org.junit.jupiter.api.Test;
         
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ContentEncodingContextTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ContentEncodingContextTest.java
        similarity index 80%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ContentEncodingContextTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ContentEncodingContextTest.java
        index 6235ab27c61..04aaab681f7 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ContentEncodingContextTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ContentEncodingContextTest.java
        @@ -14,23 +14,23 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
         import java.util.NoSuchElementException;
         
        -import io.helidon.common.http.Headers;
        -import io.helidon.common.http.Http;
        -import io.helidon.nima.http.encoding.ContentDecoder;
        -import io.helidon.nima.http.encoding.ContentEncoder;
        -import io.helidon.nima.http.encoding.ContentEncodingContext;
        -import io.helidon.nima.http.encoding.ContentEncodingContextConfig;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.testing.junit5.webserver.SetUpServer;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webclient.http1.Http1ClientResponse;
        -import io.helidon.nima.webserver.WebServerConfig;
        -import io.helidon.nima.webserver.http.HttpRules;
        +import io.helidon.http.Headers;
        +import io.helidon.http.Http;
        +import io.helidon.http.encoding.ContentDecoder;
        +import io.helidon.http.encoding.ContentEncoder;
        +import io.helidon.http.encoding.ContentEncodingContext;
        +import io.helidon.http.encoding.ContentEncodingContextConfig;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webserver.testing.junit5.SetUpServer;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webclient.http1.Http1ClientResponse;
        +import io.helidon.webserver.WebServerConfig;
        +import io.helidon.webserver.http.HttpRules;
         
         import org.junit.jupiter.api.Test;
         
        @@ -56,13 +56,13 @@ static void server(WebServerConfig.Builder server) {
         
             @SetUpRoute
             static void routing(HttpRules rules) {
        -        rules.get("/hello", (req, res) -> res.send("hello nima"));
        +        rules.get("/hello", (req, res) -> res.send("hello webserver"));
             }
         
             @Test
             void testCustomizeContentEncodingContext() {
                 try (Http1ClientResponse response = client.method(Http.Method.GET).uri("/hello").request()) {
        -            assertThat(response.entity().as(String.class), equalTo("hello nima"));
        +            assertThat(response.entity().as(String.class), equalTo("hello webserver"));
                     assertThat(encodingContext.NO_ACCEPT_ENCODING_COUNT, greaterThan(0));
                 }
             }
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ContentEncodingDisabledAbstract.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ContentEncodingDisabledAbstract.java
        similarity index 82%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ContentEncodingDisabledAbstract.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ContentEncodingDisabledAbstract.java
        index 8fe6ee4a863..e051d6f03bf 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ContentEncodingDisabledAbstract.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ContentEncodingDisabledAbstract.java
        @@ -14,20 +14,20 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
         import java.util.NoSuchElementException;
         
        -import io.helidon.common.http.Headers;
        -import io.helidon.nima.http.encoding.ContentDecoder;
        -import io.helidon.nima.http.encoding.ContentEncoder;
        -import io.helidon.nima.http.encoding.ContentEncodingContext;
        -import io.helidon.nima.http.encoding.ContentEncodingContextConfig;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webserver.http.HttpRules;
        -import io.helidon.nima.webserver.http.ServerRequest;
        -import io.helidon.nima.webserver.http.ServerResponse;
        +import io.helidon.http.Headers;
        +import io.helidon.http.encoding.ContentDecoder;
        +import io.helidon.http.encoding.ContentEncoder;
        +import io.helidon.http.encoding.ContentEncodingContext;
        +import io.helidon.http.encoding.ContentEncodingContextConfig;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webserver.http.HttpRules;
        +import io.helidon.webserver.http.ServerRequest;
        +import io.helidon.webserver.http.ServerResponse;
         
         /**
          * Common code for tests to verify server response when
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ContentEncodingDisabledNoValidationTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ContentEncodingDisabledNoValidationTest.java
        similarity index 82%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ContentEncodingDisabledNoValidationTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ContentEncodingDisabledNoValidationTest.java
        index 541bd1c565f..3163a6fd368 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ContentEncodingDisabledNoValidationTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ContentEncodingDisabledNoValidationTest.java
        @@ -13,16 +13,16 @@
          * See the License for the specific language governing permissions and
          * limitations under the License.
          */
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
        -import io.helidon.common.http.Http;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpServer;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webclient.http1.Http1ClientResponse;
        -import io.helidon.nima.webserver.WebServerConfig;
        -import io.helidon.nima.webserver.http1.Http1ConnectionSelector;
        -import io.helidon.nima.webserver.spi.ServerConnectionSelector;
        +import io.helidon.http.Http;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpServer;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webclient.http1.Http1ClientResponse;
        +import io.helidon.webserver.WebServerConfig;
        +import io.helidon.webserver.http1.Http1ConnectionSelector;
        +import io.helidon.webserver.spi.ServerConnectionSelector;
         
         import org.junit.jupiter.api.Test;
         
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ContentEncodingDisabledTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ContentEncodingDisabledTest.java
        similarity index 80%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ContentEncodingDisabledTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ContentEncodingDisabledTest.java
        index 95274cf0664..b7a4259d6f4 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ContentEncodingDisabledTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ContentEncodingDisabledTest.java
        @@ -13,17 +13,17 @@
          * See the License for the specific language governing permissions and
          * limitations under the License.
          */
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
        -import io.helidon.common.http.Http;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpServer;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webclient.http1.Http1ClientResponse;
        -import io.helidon.nima.webserver.WebServerConfig;
        -import io.helidon.nima.webserver.http1.Http1Config;
        -import io.helidon.nima.webserver.http1.Http1ConnectionSelector;
        -import io.helidon.nima.webserver.spi.ServerConnectionSelector;
        +import io.helidon.http.Http;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpServer;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webclient.http1.Http1ClientResponse;
        +import io.helidon.webserver.WebServerConfig;
        +import io.helidon.webserver.http1.Http1Config;
        +import io.helidon.webserver.http1.Http1ConnectionSelector;
        +import io.helidon.webserver.spi.ServerConnectionSelector;
         
         import org.junit.jupiter.api.Test;
         
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/Continue100ImmediatelyTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/Continue100ImmediatelyTest.java
        similarity index 95%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/Continue100ImmediatelyTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/Continue100ImmediatelyTest.java
        index e7bf61ba598..434eb0ab3a8 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/Continue100ImmediatelyTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/Continue100ImmediatelyTest.java
        @@ -13,7 +13,7 @@
          * See the License for the specific language governing permissions and
          * limitations under the License.
          */
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
         import java.io.IOException;
         import java.time.Duration;
        @@ -24,19 +24,19 @@
         import java.util.concurrent.ConcurrentHashMap;
         import java.util.concurrent.TimeUnit;
         
        -import io.helidon.common.http.Http;
        -import io.helidon.common.http.PathMatchers;
        +import io.helidon.http.Http;
        +import io.helidon.http.PathMatchers;
         import io.helidon.common.testing.http.junit5.SocketHttpClient;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.testing.junit5.webserver.SetUpServer;
        -import io.helidon.nima.webserver.WebServer;
        -import io.helidon.nima.webserver.WebServerConfig;
        -import io.helidon.nima.webserver.http.Handler;
        -import io.helidon.nima.webserver.http.HttpRouting;
        -import io.helidon.nima.webserver.http1.Http1Config;
        -import io.helidon.nima.webserver.http1.Http1ConnectionSelector;
        -import io.helidon.nima.webserver.spi.ServerConnectionSelector;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webserver.testing.junit5.SetUpServer;
        +import io.helidon.webserver.WebServer;
        +import io.helidon.webserver.WebServerConfig;
        +import io.helidon.webserver.http.Handler;
        +import io.helidon.webserver.http.HttpRouting;
        +import io.helidon.webserver.http1.Http1Config;
        +import io.helidon.webserver.http1.Http1ConnectionSelector;
        +import io.helidon.webserver.spi.ServerConnectionSelector;
         
         import org.junit.jupiter.api.Test;
         
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/Continue100Test.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/Continue100Test.java
        similarity index 97%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/Continue100Test.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/Continue100Test.java
        index 805dc32645c..6c18f444395 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/Continue100Test.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/Continue100Test.java
        @@ -13,7 +13,7 @@
          * See the License for the specific language governing permissions and
          * limitations under the License.
          */
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
         import java.io.ByteArrayInputStream;
         import java.io.IOException;
        @@ -26,14 +26,14 @@
         import java.util.concurrent.ConcurrentHashMap;
         import java.util.concurrent.TimeUnit;
         
        -import io.helidon.common.http.Http;
        -import io.helidon.common.http.PathMatchers;
        +import io.helidon.http.Http;
        +import io.helidon.http.PathMatchers;
         import io.helidon.common.testing.http.junit5.SocketHttpClient;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.webserver.WebServer;
        -import io.helidon.nima.webserver.http.Handler;
        -import io.helidon.nima.webserver.http.HttpRouting;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webserver.WebServer;
        +import io.helidon.webserver.http.Handler;
        +import io.helidon.webserver.http.HttpRouting;
         
         import org.junit.jupiter.api.Test;
         
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/DisableValidateHeadersTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/DisableValidateHeadersTest.java
        similarity index 82%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/DisableValidateHeadersTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/DisableValidateHeadersTest.java
        index 1b91a29c129..0b127b80e1f 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/DisableValidateHeadersTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/DisableValidateHeadersTest.java
        @@ -14,28 +14,28 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
         import java.util.stream.Stream;
         
        -import io.helidon.common.http.Http;
        -import io.helidon.common.http.Http.Header;
        -import io.helidon.common.http.Http.HeaderName;
        -import io.helidon.common.http.ServerRequestHeaders;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.testing.junit5.webserver.SetUpServer;
        -import io.helidon.nima.webclient.api.HttpClientResponse;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webclient.http1.Http1ClientRequest;
        -import io.helidon.nima.webclient.http1.Http1ClientResponse;
        -import io.helidon.nima.webserver.WebServerConfig;
        -import io.helidon.nima.webserver.http.HttpRules;
        -import io.helidon.nima.webserver.http.ServerRequest;
        -import io.helidon.nima.webserver.http.ServerResponse;
        -import io.helidon.nima.webserver.http1.Http1Config;
        -import io.helidon.nima.webserver.http1.Http1ConnectionSelector;
        -import io.helidon.nima.webserver.spi.ServerConnectionSelector;
        +import io.helidon.http.Http;
        +import io.helidon.http.Http.Header;
        +import io.helidon.http.Http.HeaderName;
        +import io.helidon.http.ServerRequestHeaders;
        +import io.helidon.webclient.api.HttpClientResponse;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webclient.http1.Http1ClientRequest;
        +import io.helidon.webclient.http1.Http1ClientResponse;
        +import io.helidon.webserver.WebServerConfig;
        +import io.helidon.webserver.http.HttpRules;
        +import io.helidon.webserver.http.ServerRequest;
        +import io.helidon.webserver.http.ServerResponse;
        +import io.helidon.webserver.http1.Http1Config;
        +import io.helidon.webserver.http1.Http1ConnectionSelector;
        +import io.helidon.webserver.spi.ServerConnectionSelector;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webserver.testing.junit5.SetUpServer;
         
         import org.junit.jupiter.api.Test;
         import org.junit.jupiter.params.ParameterizedTest;
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ErrorHandlingTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ErrorHandlingTest.java
        similarity index 86%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ErrorHandlingTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ErrorHandlingTest.java
        index 5dfb6c6231d..61e3668655f 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ErrorHandlingTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ErrorHandlingTest.java
        @@ -14,22 +14,22 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        -
        -import io.helidon.common.http.Http;
        -import io.helidon.nima.testing.junit5.webserver.DirectClient;
        -import io.helidon.nima.testing.junit5.webserver.RoutingTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webclient.http1.Http1ClientResponse;
        -import io.helidon.nima.webserver.http.ErrorHandler;
        -import io.helidon.nima.webserver.http.Filter;
        -import io.helidon.nima.webserver.http.FilterChain;
        -import io.helidon.nima.webserver.http.HttpRouting;
        -import io.helidon.nima.webserver.http.RoutingRequest;
        -import io.helidon.nima.webserver.http.RoutingResponse;
        -import io.helidon.nima.webserver.http.ServerRequest;
        -import io.helidon.nima.webserver.http.ServerResponse;
        +package io.helidon.webserver.tests;
        +
        +import io.helidon.http.Http;
        +import io.helidon.webserver.testing.junit5.DirectClient;
        +import io.helidon.webserver.testing.junit5.RoutingTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webclient.http1.Http1ClientResponse;
        +import io.helidon.webserver.http.ErrorHandler;
        +import io.helidon.webserver.http.Filter;
        +import io.helidon.webserver.http.FilterChain;
        +import io.helidon.webserver.http.HttpRouting;
        +import io.helidon.webserver.http.RoutingRequest;
        +import io.helidon.webserver.http.RoutingResponse;
        +import io.helidon.webserver.http.ServerRequest;
        +import io.helidon.webserver.http.ServerResponse;
         
         import org.junit.jupiter.api.Test;
         
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ErrorHandlingWithOutputStreamTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ErrorHandlingWithOutputStreamTest.java
        similarity index 92%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ErrorHandlingWithOutputStreamTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ErrorHandlingWithOutputStreamTest.java
        index c22a1ceb135..540c2a316b4 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ErrorHandlingWithOutputStreamTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ErrorHandlingWithOutputStreamTest.java
        @@ -14,21 +14,21 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
         import java.io.OutputStream;
         import java.nio.charset.StandardCharsets;
         
         import io.helidon.common.buffers.DataReader;
        -import io.helidon.common.http.Http;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webclient.http1.Http1ClientResponse;
        -import io.helidon.nima.webserver.http.ErrorHandler;
        -import io.helidon.nima.webserver.http.HttpRouting;
        -import io.helidon.nima.webserver.http.ServerRequest;
        -import io.helidon.nima.webserver.http.ServerResponse;
        +import io.helidon.http.Http;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webclient.http1.Http1ClientResponse;
        +import io.helidon.webserver.http.ErrorHandler;
        +import io.helidon.webserver.http.HttpRouting;
        +import io.helidon.webserver.http.ServerRequest;
        +import io.helidon.webserver.http.ServerResponse;
         
         import org.junit.jupiter.api.Test;
         
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ExceptionMessageTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ExceptionMessageTest.java
        similarity index 95%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ExceptionMessageTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ExceptionMessageTest.java
        index f4dd44aa322..baef93a8b45 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ExceptionMessageTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ExceptionMessageTest.java
        @@ -14,13 +14,13 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
         import java.util.Collections;
         
        -import io.helidon.common.http.Http;
        +import io.helidon.http.Http;
         import io.helidon.common.testing.http.junit5.SocketHttpClient;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        +import io.helidon.webserver.testing.junit5.ServerTest;
         import org.junit.jupiter.api.Test;
         
         import static org.hamcrest.CoreMatchers.containsString;
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/FollowRedirectTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/FollowRedirectTest.java
        similarity index 95%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/FollowRedirectTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/FollowRedirectTest.java
        index 9e16eac5bfc..1f4002f84ce 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/FollowRedirectTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/FollowRedirectTest.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
         import java.io.IOException;
         import java.io.InputStream;
        @@ -24,18 +24,18 @@
         import java.time.Duration;
         import java.util.concurrent.TimeUnit;
         
        -import io.helidon.common.http.Http;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.webclient.api.HttpClientResponse;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webclient.http1.Http1ClientResponse;
        -import io.helidon.nima.webserver.http.HttpRouting;
        +import io.helidon.http.Http;
        +import io.helidon.webclient.api.HttpClientResponse;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webclient.http1.Http1ClientResponse;
        +import io.helidon.webserver.http.HttpRouting;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
         
         import org.junit.jupiter.api.AfterEach;
         import org.junit.jupiter.api.Test;
         
        -import static io.helidon.common.http.Http.Status.INTERNAL_SERVER_ERROR_500;
        +import static io.helidon.http.Http.Status.INTERNAL_SERVER_ERROR_500;
         import static org.hamcrest.CoreMatchers.is;
         import static org.hamcrest.MatcherAssert.assertThat;
         import static org.junit.jupiter.api.Assertions.assertThrows;
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/FormParamsSupportTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/FormParamsSupportTest.java
        similarity index 87%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/FormParamsSupportTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/FormParamsSupportTest.java
        index bbb6e784c2f..9681442b773 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/FormParamsSupportTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/FormParamsSupportTest.java
        @@ -14,20 +14,20 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
         import java.util.HashMap;
         import java.util.List;
         import java.util.Map;
         
        -import io.helidon.common.http.Http;
        -import io.helidon.common.http.Http.HeaderNames;
        +import io.helidon.http.Http;
        +import io.helidon.http.Http.HeaderNames;
         import io.helidon.common.media.type.MediaTypes;
         import io.helidon.common.parameters.Parameters;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webserver.http.HttpRules;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webserver.http.HttpRules;
         
         import org.junit.jupiter.api.Test;
         
        diff --git a/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/GetTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/GetTest.java
        new file mode 100644
        index 00000000000..e957dd259a3
        --- /dev/null
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/GetTest.java
        @@ -0,0 +1,216 @@
        +/*
        + * Copyright (c) 2022, 2023 Oracle and/or its affiliates.
        + *
        + * Licensed under the Apache License, Version 2.0 (the "License");
        + * you may not use this file except in compliance with the License.
        + * You may obtain a copy of the License at
        + *
        + *     http://www.apache.org/licenses/LICENSE-2.0
        + *
        + * Unless required by applicable law or agreed to in writing, software
        + * distributed under the License is distributed on an "AS IS" BASIS,
        + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        + * See the License for the specific language governing permissions and
        + * limitations under the License.
        + */
        +
        +package io.helidon.webserver.tests;
        +
        +import java.io.IOException;
        +import java.io.OutputStream;
        +import java.io.UncheckedIOException;
        +import java.util.Optional;
        +import java.util.Random;
        +
        +import io.helidon.http.Http;
        +import io.helidon.http.Http.Header;
        +import io.helidon.http.Http.HeaderName;
        +import io.helidon.http.Http.Headers;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webclient.http1.Http1ClientResponse;
        +import io.helidon.webserver.http.HttpRouting;
        +import io.helidon.webserver.http.ServerRequest;
        +import io.helidon.webserver.http.ServerResponse;
        +
        +import org.junit.jupiter.api.Disabled;
        +import org.junit.jupiter.api.Test;
        +
        +import static io.helidon.http.Http.HeaderNames.CONTENT_LENGTH;
        +import static io.helidon.http.Http.Method.GET;
        +import static io.helidon.common.testing.http.junit5.HttpHeaderMatcher.hasHeader;
        +import static org.hamcrest.CoreMatchers.is;
        +import static org.hamcrest.MatcherAssert.assertThat;
        +
        +@ServerTest
        +class GetTest {
        +    private static final byte[] BYTES = new byte[256];
        +    private static final HeaderName REQUEST_HEADER_NAME = Http.HeaderNames.create("X-REquEst-HEADeR");
        +    private static final String REQUEST_HEADER_VALUE_STRING = "some nice value";
        +    private static final Header REQUEST_HEADER_VALUE = Headers.create(REQUEST_HEADER_NAME, REQUEST_HEADER_VALUE_STRING);
        +    private static final HeaderName RESPONSE_HEADER_NAME = Http.HeaderNames.create("X-REsponSE-HeADER");
        +    private static final String RESPONSE_HEADER_VALUE_STRING = "another nice value";
        +    private static final Http.Header RESPONSE_HEADER_VALUE = Headers.create(RESPONSE_HEADER_NAME,
        +                                                                            RESPONSE_HEADER_VALUE_STRING);
        +    public static final Header CONTENT_LENGTH_5 = Headers.create(CONTENT_LENGTH, "5");
        +
        +    static {
        +        Random random = new Random();
        +        random.nextBytes(BYTES);
        +    }
        +
        +    private final Http1Client client;
        +
        +    GetTest(Http1Client client) {
        +        this.client = client;
        +    }
        +
        +    @SetUpRoute
        +    static void routing(HttpRouting.Builder router) {
        +        router.route(GET, "/string", Routes::string)
        +                .route(GET, "/bytes", Routes::bytes)
        +                .route(GET, "/chunked", Routes::chunked)
        +                .route(GET, "/headers", Routes::headers)
        +                .route(GET, "/close", Routes::close)
        +                .route(GET, "/optional", Routes::optional);
        +    }
        +
        +    @Test
        +    void testStringRoute() {
        +        try (Http1ClientResponse response = client.get("/string")
        +                .request()) {
        +
        +            assertThat(response.status(), is(Http.Status.OK_200));
        +            String entity = response.entity().as(String.class);
        +            assertThat(entity, is("Hello"));
        +            io.helidon.http.Headers headers = response.headers();
        +            assertThat(headers, hasHeader(CONTENT_LENGTH_5));
        +            assertThat(headers, hasHeader(Http.Headers.CONNECTION_KEEP_ALIVE));
        +        }
        +    }
        +
        +    @Test
        +    void testByteRoute() {
        +        try (Http1ClientResponse response = client.get("/bytes")
        +                .request()) {
        +
        +            assertThat(response.status(), is(Http.Status.OK_200));
        +            byte[] entity = response.entity().as(byte[].class);
        +            assertThat(entity, is(BYTES));
        +            io.helidon.http.Headers headers = response.headers();
        +            assertThat(headers, hasHeader(Headers.create(CONTENT_LENGTH, String.valueOf(BYTES.length))));
        +            assertThat(headers, hasHeader(Http.Headers.CONNECTION_KEEP_ALIVE));
        +        }
        +    }
        +
        +    @Test
        +    @Disabled("Optimization kicks in")
        +    void testChunkedRoute() {
        +        try (Http1ClientResponse response = client.get("/chunked")
        +                .request()) {
        +
        +            assertThat(response.status(), is(Http.Status.OK_200));
        +            byte[] entity = response.entity().as(byte[].class);
        +            assertThat(entity, is(BYTES));
        +            io.helidon.http.Headers headers = response.headers();
        +            assertThat(headers, hasHeader(Http.Headers.TRANSFER_ENCODING_CHUNKED));
        +            assertThat(headers, hasHeader(Http.Headers.CONNECTION_KEEP_ALIVE));
        +        }
        +
        +    }
        +
        +    @Test
        +    void testHeadersRoute() {
        +        try (Http1ClientResponse response = client.get("/headers")
        +                .header(REQUEST_HEADER_VALUE)
        +                .request()) {
        +
        +            assertThat(response.status(), is(Http.Status.OK_200));
        +            String entity = response.entity().as(String.class);
        +            assertThat(entity, is("Hello"));
        +            io.helidon.http.Headers headers = response.headers();
        +
        +            assertThat("Should contain echoed request header", headers, hasHeader(REQUEST_HEADER_VALUE));
        +            assertThat("Should contain configured response header", headers, hasHeader(RESPONSE_HEADER_VALUE));
        +            assertThat(headers, hasHeader(CONTENT_LENGTH_5));
        +            assertThat(headers, hasHeader(Http.Headers.CONNECTION_KEEP_ALIVE));
        +        }
        +    }
        +
        +    @Test
        +    void testCloseRoute() {
        +        try (Http1ClientResponse response = client.get("/close")
        +                .request()) {
        +
        +            assertThat(response.status(), is(Http.Status.OK_200));
        +            String entity = response.entity().as(String.class);
        +            assertThat(entity, is("Hello"));
        +            io.helidon.http.Headers headers = response.headers();
        +            assertThat(headers, hasHeader(CONTENT_LENGTH_5));
        +            assertThat(headers, hasHeader(Http.Headers.CONNECTION_CLOSE));
        +        }
        +    }
        +
        +    @Test
        +    void testOptionalResponseWithValue() {
        +        try (Http1ClientResponse response = client.get("/optional")
        +                .request()) {
        +
        +            assertThat(response.status(), is(Http.Status.OK_200));
        +            String entity = response.entity().as(String.class);
        +            assertThat(entity, is("return value"));
        +        }
        +    }
        +
        +    @Test
        +    void testOptionalResponseEmpty() {
        +        try (Http1ClientResponse response = client.get("/optional")
        +                .queryParam("empty", "true")
        +                .request()) {
        +
        +            assertThat(response.status(), is(Http.Status.NOT_FOUND_404));
        +            assertThat(response.headers(), hasHeader(Headers.CONTENT_LENGTH_ZERO));
        +        }
        +    }
        +
        +    private static class Routes {
        +        public static void optional(ServerRequest req, ServerResponse res) {
        +            String empty = req.query().first("empty").orElse("false");
        +
        +            if ("false".equals(empty)) {
        +                res.send(Optional.of("return value"));
        +            } else {
        +                res.send(Optional.empty());
        +            }
        +        }
        +
        +        private static void close(ServerRequest req, ServerResponse res) {
        +            res.header(Http.Headers.CONNECTION_CLOSE);
        +            res.send("Hello");
        +        }
        +
        +        private static String string() {
        +            return "Hello";
        +        }
        +
        +        private static byte[] bytes() {
        +            return BYTES;
        +        }
        +
        +        private static void chunked(ServerRequest req, ServerResponse res) {
        +            try (OutputStream outputStream = res.outputStream()) {
        +                outputStream.write(BYTES);
        +            } catch (IOException e) {
        +                throw new UncheckedIOException(e);
        +            }
        +        }
        +
        +        private static void headers(ServerRequest req, ServerResponse res) {
        +            res.header(req.headers().get(REQUEST_HEADER_NAME));
        +            res.header(RESPONSE_HEADER_VALUE);
        +            res.send("Hello");
        +        }
        +    }
        +
        +}
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/HttpPipelineTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/HttpPipelineTest.java
        similarity index 91%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/HttpPipelineTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/HttpPipelineTest.java
        index 406574fea0d..15f34ebb198 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/HttpPipelineTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/HttpPipelineTest.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2020, 2022 Oracle and/or its affiliates.
        + * Copyright (c) 2020, 2023 Oracle and/or its affiliates.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        @@ -14,15 +14,15 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
         import java.util.concurrent.atomic.AtomicInteger;
         
        -import io.helidon.common.http.Http;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        +import io.helidon.http.Http;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
         import io.helidon.common.testing.http.junit5.SocketHttpClient;
        -import io.helidon.nima.webserver.http.HttpRules;
        +import io.helidon.webserver.http.HttpRules;
         
         import static org.hamcrest.CoreMatchers.containsString;
         import static org.hamcrest.CoreMatchers.notNullValue;
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/KeepAliveTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/KeepAliveTest.java
        similarity index 85%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/KeepAliveTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/KeepAliveTest.java
        index 9f79318edc4..196b9277f39 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/KeepAliveTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/KeepAliveTest.java
        @@ -14,26 +14,26 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
         import java.io.IOException;
         import java.io.InputStream;
         import java.nio.charset.StandardCharsets;
         
        -import io.helidon.common.http.Http;
        -import io.helidon.common.http.Http.Headers;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.webclient.api.HttpClientResponse;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webclient.http1.Http1ClientRequest;
        -import io.helidon.nima.webclient.http1.Http1ClientResponse;
        -import io.helidon.nima.webserver.http.HttpRouting;
        +import io.helidon.http.Http;
        +import io.helidon.http.Http.Headers;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webclient.api.HttpClientResponse;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webclient.http1.Http1ClientRequest;
        +import io.helidon.webclient.http1.Http1ClientResponse;
        +import io.helidon.webserver.http.HttpRouting;
         
         import org.junit.jupiter.api.RepeatedTest;
         
        -import static io.helidon.common.http.Http.Status.INTERNAL_SERVER_ERROR_500;
        -import static io.helidon.common.http.Http.Status.OK_200;
        +import static io.helidon.http.Http.Status.INTERNAL_SERVER_ERROR_500;
        +import static io.helidon.http.Http.Status.OK_200;
         import static io.helidon.common.testing.http.junit5.HttpHeaderMatcher.hasHeader;
         import static org.hamcrest.CoreMatchers.is;
         import static org.hamcrest.CoreMatchers.not;
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/MaxPayloadSizeTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/MaxPayloadSizeTest.java
        similarity index 91%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/MaxPayloadSizeTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/MaxPayloadSizeTest.java
        index c161288cdf6..e1af15408b0 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/MaxPayloadSizeTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/MaxPayloadSizeTest.java
        @@ -14,22 +14,22 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
         import java.io.IOException;
         import java.io.InputStream;
         import java.io.UncheckedIOException;
         import java.nio.charset.StandardCharsets;
         
        -import io.helidon.common.http.Http;
        -import io.helidon.common.http.Http.Headers;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.testing.junit5.webserver.SetUpServer;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webclient.http1.Http1ClientResponse;
        -import io.helidon.nima.webserver.WebServerConfig;
        -import io.helidon.nima.webserver.http.HttpRules;
        +import io.helidon.http.Http;
        +import io.helidon.http.Http.Headers;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webserver.testing.junit5.SetUpServer;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webclient.http1.Http1ClientResponse;
        +import io.helidon.webserver.WebServerConfig;
        +import io.helidon.webserver.http.HttpRules;
         
         import org.junit.jupiter.api.Test;
         
        diff --git a/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/MediaContextTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/MediaContextTest.java
        new file mode 100644
        index 00000000000..1c24db290f1
        --- /dev/null
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/MediaContextTest.java
        @@ -0,0 +1,119 @@
        +/*
        + * Copyright (c) 2022, 2023 Oracle and/or its affiliates.
        + *
        + * Licensed under the Apache License, Version 2.0 (the "License");
        + * you may not use this file except in compliance with the License.
        + * You may obtain a copy of the License at
        + *
        + *     http://www.apache.org/licenses/LICENSE-2.0
        + *
        + * Unless required by applicable law or agreed to in writing, software
        + * distributed under the License is distributed on an "AS IS" BASIS,
        + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        + * See the License for the specific language governing permissions and
        + * limitations under the License.
        + */
        +
        +package io.helidon.webserver.tests;
        +
        +import java.io.OutputStream;
        +
        +import io.helidon.common.GenericType;
        +import io.helidon.http.Headers;
        +import io.helidon.http.Http;
        +import io.helidon.http.WritableHeaders;
        +import io.helidon.http.media.EntityReader;
        +import io.helidon.http.media.EntityWriter;
        +import io.helidon.http.media.MediaContext;
        +import io.helidon.http.media.MediaContextConfig;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webserver.testing.junit5.SetUpServer;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webclient.http1.Http1ClientResponse;
        +import io.helidon.webserver.WebServerConfig;
        +import io.helidon.webserver.http.HttpRules;
        +
        +import org.junit.jupiter.api.Test;
        +
        +import static org.hamcrest.MatcherAssert.assertThat;
        +import static org.hamcrest.core.Is.is;
        +import static org.hamcrest.core.IsEqual.equalTo;
        +
        +@ServerTest
        +class MediaContextTest {
        +
        +    private final Http1Client client;
        +
        +    public MediaContextTest(Http1Client client) {
        +        this.client = client;
        +    }
        +
        +    @SetUpServer
        +    static void server(WebServerConfig.Builder server) {
        +        server.mediaContext(new CustomizedMediaContext());
        +    }
        +
        +    @SetUpRoute
        +    static void routing(HttpRules rules) {
        +        rules.get("/hello", (req, res) -> res.send("hello webserver"));
        +    }
        +
        +    @Test
        +    void testCustomizeMediaContext() {
        +
        +        try (Http1ClientResponse response = client.method(Http.Method.GET).uri("/hello").request()) {
        +            String responseEntityString = response.entity().as(String.class);
        +            assertThat(responseEntityString.length(), equalTo(5));
        +            assertThat(responseEntityString, is("hello"));
        +        }
        +    }
        +
        +    private static class CustomizedMediaContext implements MediaContext {
        +        private MediaContext delegated = MediaContext.create();
        +
        +        @Override
        +        public MediaContextConfig prototype() {
        +            return delegated.prototype();
        +        }
        +
        +        @Override
        +        public  EntityReader reader(GenericType type, Headers headers) {
        +            return delegated.reader(type, headers);
        +        }
        +
        +        @Override
        +        public  EntityWriter writer(GenericType type, Headers requestHeaders, WritableHeaders responseHeaders) {
        +            EntityWriter impl = delegated.writer(type, requestHeaders, responseHeaders);
        +
        +            EntityWriter realWriter = new EntityWriter() {
        +                @Override
        +                public void write(GenericType type, T object, OutputStream outputStream, Headers requestHeaders, WritableHeaders responseHeaders) {
        +                    if (object instanceof String) {
        +                        String maxLen5 = (String) ((String) object).substring(0, 5);
        +                        impl.write(type, (T) maxLen5, outputStream, requestHeaders, responseHeaders);
        +                    } else {
        +                        impl.write(type, object, outputStream, requestHeaders, responseHeaders);
        +                    }
        +                }
        +
        +                @Override
        +                public void write(GenericType type, T object, OutputStream outputStream, WritableHeaders headers) {
        +                    impl.write(type, object, outputStream, headers);
        +                }
        +            };
        +            return realWriter;
        +        }
        +
        +        @Override
        +        public  EntityReader reader(GenericType type, Headers requestHeaders, Headers responseHeaders) {
        +            return delegated.reader(type, requestHeaders, responseHeaders);
        +        }
        +
        +        @Override
        +        public  EntityWriter writer(GenericType type, WritableHeaders requestHeaders) {
        +            return delegated.writer(type, requestHeaders);
        +        }
        +    }
        +
        +}
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/MultiPortTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/MultiPortTest.java
        similarity index 94%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/MultiPortTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/MultiPortTest.java
        index 2a8a1fb590b..80a6c8ee403 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/MultiPortTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/MultiPortTest.java
        @@ -14,15 +14,15 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        -
        -import io.helidon.common.http.Http;
        -import io.helidon.nima.webclient.api.HttpClientResponse;
        -import io.helidon.nima.webclient.api.WebClient;
        -import io.helidon.nima.webserver.WebServer;
        -import io.helidon.nima.webserver.http.Handler;
        -import io.helidon.nima.webserver.http.ServerRequest;
        -import io.helidon.nima.webserver.http.ServerResponse;
        +package io.helidon.webserver.tests;
        +
        +import io.helidon.http.Http;
        +import io.helidon.webclient.api.HttpClientResponse;
        +import io.helidon.webclient.api.WebClient;
        +import io.helidon.webserver.WebServer;
        +import io.helidon.webserver.http.Handler;
        +import io.helidon.webserver.http.ServerRequest;
        +import io.helidon.webserver.http.ServerResponse;
         
         import org.hamcrest.Matcher;
         import org.junit.jupiter.api.AfterEach;
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/OutputStreamTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/OutputStreamTest.java
        similarity index 77%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/OutputStreamTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/OutputStreamTest.java
        index 7b598adf650..d94ba26a383 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/OutputStreamTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/OutputStreamTest.java
        @@ -14,24 +14,24 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
         import java.io.ByteArrayInputStream;
         import java.io.IOException;
         import java.io.InputStream;
         import java.nio.charset.StandardCharsets;
         
        -import io.helidon.common.http.Http;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webclient.http1.Http1ClientResponse;
        -import io.helidon.nima.webserver.http.HttpRouting;
        -import io.helidon.nima.webserver.http.ServerRequest;
        -import io.helidon.nima.webserver.http.ServerResponse;
        +import io.helidon.http.Http;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webclient.http1.Http1ClientResponse;
        +import io.helidon.webserver.http.HttpRouting;
        +import io.helidon.webserver.http.ServerRequest;
        +import io.helidon.webserver.http.ServerResponse;
         import org.junit.jupiter.api.Test;
         
        -import static io.helidon.common.http.Http.Method.GET;
        +import static io.helidon.http.Http.Method.GET;
         import static org.hamcrest.CoreMatchers.is;
         import static org.hamcrest.MatcherAssert.assertThat;
         
        diff --git a/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/PostTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/PostTest.java
        new file mode 100644
        index 00000000000..898c2a87dd6
        --- /dev/null
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/PostTest.java
        @@ -0,0 +1,200 @@
        +/*
        + * Copyright (c) 2022, 2023 Oracle and/or its affiliates.
        + *
        + * Licensed under the Apache License, Version 2.0 (the "License");
        + * you may not use this file except in compliance with the License.
        + * You may obtain a copy of the License at
        + *
        + *     http://www.apache.org/licenses/LICENSE-2.0
        + *
        + * Unless required by applicable law or agreed to in writing, software
        + * distributed under the License is distributed on an "AS IS" BASIS,
        + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        + * See the License for the specific language governing permissions and
        + * limitations under the License.
        + */
        +
        +package io.helidon.webserver.tests;
        +
        +import java.io.IOException;
        +import java.io.InputStream;
        +import java.io.OutputStream;
        +import java.io.UncheckedIOException;
        +import java.util.Random;
        +
        +import io.helidon.http.Http;
        +import io.helidon.http.Http.Header;
        +import io.helidon.http.Http.HeaderName;
        +import io.helidon.http.Http.HeaderNames;
        +import io.helidon.http.Http.Headers;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webclient.http1.Http1ClientResponse;
        +import io.helidon.webserver.http.Handler;
        +import io.helidon.webserver.http.HttpRouting;
        +import io.helidon.webserver.http.ServerRequest;
        +import io.helidon.webserver.http.ServerResponse;
        +
        +import org.junit.jupiter.api.Disabled;
        +import org.junit.jupiter.api.Test;
        +
        +import static io.helidon.http.Http.HeaderNames.CONTENT_LENGTH;
        +import static io.helidon.common.testing.http.junit5.HttpHeaderMatcher.hasHeader;
        +import static org.hamcrest.CoreMatchers.is;
        +import static org.hamcrest.MatcherAssert.assertThat;
        +import static org.junit.jupiter.api.Assertions.assertThrows;
        +
        +@ServerTest
        +class PostTest {
        +    private static final byte[] BYTES = new byte[256];
        +    private static final HeaderName REQUEST_HEADER_NAME = Http.HeaderNames.create("X-REquEst-HEADeR");
        +    private static final String REQUEST_HEADER_VALUE_STRING = "some nice value";
        +    private static final Header REQUEST_HEADER_VALUE = Headers.create(REQUEST_HEADER_NAME, REQUEST_HEADER_VALUE_STRING);
        +    private static final HeaderName RESPONSE_HEADER_NAME = HeaderNames.create("X-REsponSE-HeADER");
        +    private static final String RESPONSE_HEADER_VALUE_STRING = "another nice value";
        +    private static final Http.Header RESPONSE_HEADER_VALUE = Headers.create(RESPONSE_HEADER_NAME,
        +                                                                            RESPONSE_HEADER_VALUE_STRING);
        +
        +    static {
        +        Random random = new Random();
        +        random.nextBytes(BYTES);
        +    }
        +
        +    private final Http1Client client;
        +
        +    PostTest(Http1Client client) {
        +        this.client = client;
        +    }
        +
        +    @SetUpRoute
        +    static void routing(HttpRouting.Builder router) {
        +        router.route(Http.Method.POST, "/string", Handler.create(String.class, Routes::string))
        +                .route(Http.Method.POST, "/bytes", Handler.create(byte[].class, Routes::bytes))
        +                .route(Http.Method.POST, "/chunked", Routes::chunked)
        +                .route(Http.Method.POST, "/headers", Routes::headers)
        +                .route(Http.Method.POST, "/close", Routes::close);
        +    }
        +
        +    @Test
        +    void testStringRoute() {
        +        io.helidon.http.Headers headers;
        +        try (Http1ClientResponse response = client.method(Http.Method.POST)
        +                .uri("/string")
        +                .submit("Hello")) {
        +
        +            assertThat(response.status(), is(Http.Status.OK_200));
        +            String entity = response.entity().as(String.class);
        +            assertThat(entity, is("Hello"));
        +            headers = response.headers();
        +        }
        +        assertThat(headers, hasHeader(Headers.create(CONTENT_LENGTH, "5")));
        +        assertThat(headers, hasHeader(Headers.CONNECTION_KEEP_ALIVE));
        +    }
        +
        +    @Test
        +    void testByteRoute() {
        +        io.helidon.http.Headers headers;
        +        try (Http1ClientResponse response = client.method(Http.Method.POST)
        +                .uri("/bytes")
        +                .submit(BYTES)) {
        +
        +            assertThat(response.status(), is(Http.Status.OK_200));
        +            byte[] entity = response.entity().as(byte[].class);
        +            assertThat(entity, is(BYTES));
        +            headers = response.headers();
        +        }
        +        assertThat(headers, hasHeader(Headers.create(CONTENT_LENGTH, String.valueOf(BYTES.length))));
        +        assertThat(headers, hasHeader(Headers.CONNECTION_KEEP_ALIVE));
        +    }
        +
        +    @Test
        +    @Disabled("Optimization kicks in")
        +    void testChunkedRoute() {
        +        io.helidon.http.Headers headers;
        +        try (Http1ClientResponse response = client.method(Http.Method.POST)
        +                .uri("/chunked")
        +                .outputStream(outputStream -> {
        +                    outputStream.write(BYTES);
        +                    outputStream.close();
        +                })) {
        +
        +            assertThat(response.status(), is(Http.Status.OK_200));
        +            byte[] entity = response.entity().as(byte[].class);
        +            assertThat(entity, is(BYTES));
        +            headers = response.headers();
        +        }
        +        assertThat(headers, hasHeader(Http.Headers.TRANSFER_ENCODING_CHUNKED));
        +        assertThat(headers, hasHeader(Headers.CONNECTION_KEEP_ALIVE));
        +    }
        +
        +    @Test
        +    void testHeadersRoute() {
        +        io.helidon.http.Headers headers;
        +        try (Http1ClientResponse response = client.method(Http.Method.POST)
        +                .uri("/headers")
        +                .header(REQUEST_HEADER_VALUE)
        +                .submit("Hello")) {
        +
        +            assertThat(response.status(), is(Http.Status.OK_200));
        +            String entity = response.entity().as(String.class);
        +            assertThat(entity, is("Hello"));
        +            headers = response.headers();
        +        }
        +        assertThat(headers, hasHeader(Headers.create(CONTENT_LENGTH, "5")));
        +        assertThat(headers, hasHeader(Headers.CONNECTION_KEEP_ALIVE));
        +        assertThat(headers, hasHeader(REQUEST_HEADER_VALUE));
        +        assertThat(headers, hasHeader(RESPONSE_HEADER_VALUE));
        +    }
        +
        +    @Test
        +    void testCloseRoute() {
        +        io.helidon.http.Headers headers;
        +        try (Http1ClientResponse response = client.method(Http.Method.POST)
        +                .uri("/close")
        +                .submit("Hello")) {
        +
        +            assertThat(response.status(), is(Http.Status.NO_CONTENT_204));
        +            assertThrows(IllegalStateException.class, () -> response.entity().as(String.class));
        +            headers = response.headers();
        +        }
        +        assertThat(headers, hasHeader(Headers.CONNECTION_CLOSE));
        +    }
        +
        +    private static class Routes {
        +        public static void close(ServerRequest req, ServerResponse res) {
        +            res.header(Headers.CONNECTION_CLOSE);
        +            res.status(Http.Status.NO_CONTENT_204);
        +            res.send();
        +        }
        +
        +        private static String string(String request) {
        +            return request;
        +        }
        +
        +        private static byte[] bytes(byte[] bytes) {
        +            return bytes;
        +        }
        +
        +        private static void chunked(ServerRequest req, ServerResponse res) {
        +            byte[] buffer = new byte[512];
        +            try (InputStream inputStream = req.content().inputStream(); OutputStream outputStream = res.outputStream()) {
        +                int read;
        +                while ((read = inputStream.read(buffer)) > 0) {
        +                    outputStream.write(buffer, 0, read);
        +                }
        +            } catch (IOException e) {
        +                throw new UncheckedIOException(e);
        +            }
        +        }
        +
        +        private static void headers(ServerRequest req, ServerResponse res) {
        +            System.out.println("Headers");
        +            res.header(req.headers().get(REQUEST_HEADER_NAME));
        +            res.header(RESPONSE_HEADER_VALUE);
        +            String entity = req.content().as(String.class);
        +            res.send(entity);
        +        }
        +    }
        +
        +}
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ReasonPhraseTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ReasonPhraseTest.java
        similarity index 81%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ReasonPhraseTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ReasonPhraseTest.java
        index fdff25d44f2..aca5fbd4bd8 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ReasonPhraseTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ReasonPhraseTest.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2022 Oracle and/or its affiliates.
        + * Copyright (c) 2022, 2023 Oracle and/or its affiliates.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        @@ -14,14 +14,14 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
        -import io.helidon.common.http.Http;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webclient.http1.Http1ClientResponse;
        -import io.helidon.nima.webserver.http.HttpRules;
        +import io.helidon.http.Http;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webclient.http1.Http1ClientResponse;
        +import io.helidon.webserver.http.HttpRules;
         
         import org.junit.jupiter.api.Test;
         
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ReroutingAndNextingTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ReroutingAndNextingTest.java
        similarity index 81%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ReroutingAndNextingTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ReroutingAndNextingTest.java
        index 1e867ff5105..175464ffad2 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ReroutingAndNextingTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ReroutingAndNextingTest.java
        @@ -14,15 +14,15 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
        -import io.helidon.common.http.Http;
        -import io.helidon.common.http.Http.Header;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webclient.http1.Http1ClientResponse;
        -import io.helidon.nima.webserver.http.HttpRouting;
        +import io.helidon.http.Http;
        +import io.helidon.http.Http.Header;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webclient.http1.Http1ClientResponse;
        +import io.helidon.webserver.http.HttpRouting;
         
         import org.junit.jupiter.api.Test;
         
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ResponseOrderingTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ResponseOrderingTest.java
        similarity index 91%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ResponseOrderingTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ResponseOrderingTest.java
        index 1536c87410d..6bd8e92b9d7 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ResponseOrderingTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ResponseOrderingTest.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
         import java.io.IOException;
         import java.io.InputStream;
        @@ -23,11 +23,11 @@
         import java.util.ArrayList;
         import java.util.concurrent.ConcurrentLinkedQueue;
         
        -import io.helidon.common.http.Http;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webserver.http.HttpRules;
        +import io.helidon.http.Http;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webserver.http.HttpRules;
         
         import org.junit.jupiter.api.Test;
         
        diff --git a/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/RoutingTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/RoutingTest.java
        new file mode 100644
        index 00000000000..3988fb6a27e
        --- /dev/null
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/RoutingTest.java
        @@ -0,0 +1,70 @@
        +/*
        + * Copyright (c) 2022, 2023 Oracle and/or its affiliates.
        + *
        + * Licensed under the Apache License, Version 2.0 (the "License");
        + * you may not use this file except in compliance with the License.
        + * You may obtain a copy of the License at
        + *
        + *     http://www.apache.org/licenses/LICENSE-2.0
        + *
        + * Unless required by applicable law or agreed to in writing, software
        + * distributed under the License is distributed on an "AS IS" BASIS,
        + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        + * See the License for the specific language governing permissions and
        + * limitations under the License.
        + */
        +
        +package io.helidon.webserver.tests;
        +
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpServer;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webserver.WebServerConfig;
        +
        +@ServerTest
        +class RoutingTest extends RoutingTestBase {
        +
        +    RoutingTest(Http1Client client) {
        +        this.client = client;
        +    }
        +
        +    @SetUpServer
        +    static void setUp(WebServerConfig.Builder builder) {
        +        builder.routing(routing -> routing
        +                .get("/my path", (req, res) -> res.send("done"))
        +                .get("/českáCesta", (req, res) -> res.send("done"))
        +                // shortcut methods with path matchers
        +                .get("/wildcard_*", (req, res) -> res.send("wildcard_test1"))
        +                .post("/wildcard/*", (req, res) -> res.send("wildcard_test2"))
        +                // shortcut methods with path
        +                .get("/get", (req, res) -> res.send("get"))
        +                .post("/post", (req, res) -> res.send("post"))
        +                .put("/put", (req, res) -> res.send("put"))
        +                .delete("/delete", (req, res) -> res.send("delete"))
        +                .head("/head", (req, res) -> res.send("head"))
        +                .options("/options", (req, res) -> res.send("options"))
        +                .trace("/trace", (req, res) -> res.send("trace"))
        +                .patch("/patch", (req, res) -> res.send("patch"))
        +                .any("/any", (req, res) -> res.send("any"))
        +                // shortcut methods using multiple handlers
        +                .get("/get_multi", RoutingTestBase::multiHandler, (req, res) -> res.send("get_multi"))
        +                .post("/post_multi", RoutingTestBase::multiHandler, (req, res) -> res.send("post_multi"))
        +                .put("/put_multi", RoutingTestBase::multiHandler, (req, res) -> res.send("put_multi"))
        +                .delete("/delete_multi", RoutingTestBase::multiHandler, (req, res) -> res.send("delete_multi"))
        +                .head("/head_multi", RoutingTestBase::multiHandler, (req, res) -> res.send("head_multi"))
        +                .options("/options_multi",
        +                         RoutingTestBase::multiHandler,
        +                         (req, res) -> res.send("options_multi"))
        +                .trace("/trace_multi", RoutingTestBase::multiHandler, (req, res) -> res.send("trace_multi"))
        +                .patch("/patch_multi", RoutingTestBase::multiHandler, (req, res) -> res.send("patch_multi"))
        +                // shortcut methods with no path pattern
        +                .get((req, res) -> res.send("get_catchall"))
        +                .post((req, res) -> res.send("post_catchall"))
        +                .put((req, res) -> res.send("put_catchall"))
        +                .delete((req, res) -> res.send("delete_catchall"))
        +                .head((req, res) -> res.send("head_catchall"))
        +                .options((req, res) -> res.send("options_catchall"))
        +                .trace((req, res) -> res.send("trace_catchall"))
        +                .patch((req, res) -> res.send("patch_catchall")));
        +    }
        +}
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/RoutingTestBase.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/RoutingTestBase.java
        similarity index 95%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/RoutingTestBase.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/RoutingTestBase.java
        index 9171334ee55..c073fcc977a 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/RoutingTestBase.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/RoutingTestBase.java
        @@ -14,17 +14,17 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
         import java.util.function.Function;
         import java.util.stream.Stream;
         
        -import io.helidon.common.http.Http;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webclient.http1.Http1ClientRequest;
        -import io.helidon.nima.webclient.http1.Http1ClientResponse;
        -import io.helidon.nima.webserver.http.ServerRequest;
        -import io.helidon.nima.webserver.http.ServerResponse;
        +import io.helidon.http.Http;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webclient.http1.Http1ClientRequest;
        +import io.helidon.webclient.http1.Http1ClientResponse;
        +import io.helidon.webserver.http.ServerRequest;
        +import io.helidon.webserver.http.ServerResponse;
         
         import org.junit.jupiter.api.Test;
         import org.junit.jupiter.params.ParameterizedTest;
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/RulesTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/RulesTest.java
        similarity index 92%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/RulesTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/RulesTest.java
        index 0df12c645fa..f8a944bae9c 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/RulesTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/RulesTest.java
        @@ -14,12 +14,12 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webserver.http.HttpRules;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webserver.http.HttpRules;
         
         import static io.helidon.common.testing.http.junit5.HttpHeaderMatcher.hasHeader;
         
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ServerRestartTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ServerRestartTest.java
        similarity index 93%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ServerRestartTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ServerRestartTest.java
        index 036214b4626..54f9fd04fb4 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ServerRestartTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ServerRestartTest.java
        @@ -14,9 +14,9 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
        -import io.helidon.nima.webserver.WebServer;
        +import io.helidon.webserver.WebServer;
         
         import org.junit.jupiter.api.Test;
         
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/Status204Test.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/Status204Test.java
        similarity index 79%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/Status204Test.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/Status204Test.java
        index eccd873ea9e..efc80ce652c 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/Status204Test.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/Status204Test.java
        @@ -14,14 +14,14 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
        -import io.helidon.common.http.Http;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.webclient.api.HttpClientResponse;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webserver.http.HttpRules;
        +import io.helidon.http.Http;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webclient.api.HttpClientResponse;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webserver.http.HttpRules;
         
         import org.junit.jupiter.api.Test;
         
        @@ -30,7 +30,7 @@
         
         /**
          * Tests specific header expectation from 204 NO CONTENT status code together
        - * with {@link io.helidon.nima.webclient.http1.Http1Client}.
        + * with {@link io.helidon.webclient.http1.Http1Client}.
          */
         @ServerTest
         class Status204Test {
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/StatusCodeTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/StatusCodeTest.java
        similarity index 77%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/StatusCodeTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/StatusCodeTest.java
        index 4edaeeba963..6a89cd19083 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/StatusCodeTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/StatusCodeTest.java
        @@ -14,14 +14,14 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        -
        -import io.helidon.common.http.Http;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.webclient.api.HttpClientResponse;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webserver.http.HttpRules;
        +package io.helidon.webserver.tests;
        +
        +import io.helidon.http.Http;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webclient.api.HttpClientResponse;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webserver.http.HttpRules;
         import org.junit.jupiter.api.Test;
         
         import static org.hamcrest.CoreMatchers.is;
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ThreadNameTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ThreadNameTest.java
        similarity index 86%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ThreadNameTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ThreadNameTest.java
        index 55af24ab58a..85f35dcf49d 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ThreadNameTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ThreadNameTest.java
        @@ -14,12 +14,12 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webserver.http.HttpRules;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webserver.http.HttpRules;
         
         import org.junit.jupiter.api.Test;
         
        @@ -57,6 +57,6 @@ void testName() {
                 String serverSocket = parts[1];
                 String clientSocket = parts[2];
         
        -        assertThat(parts[3], is("[" + serverSocket + " " + clientSocket + "] Nima socket"));
        +        assertThat(parts[3], is("[" + serverSocket + " " + clientSocket + "] WebServer socket"));
             }
         }
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/TransferEncodingTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/TransferEncodingTest.java
        similarity index 93%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/TransferEncodingTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/TransferEncodingTest.java
        index 2a60ef41172..16a908a8f5d 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/TransferEncodingTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/TransferEncodingTest.java
        @@ -14,15 +14,15 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
        -import io.helidon.common.http.ClientResponseHeaders;
        -import io.helidon.common.http.Http;
        -import io.helidon.common.http.Http.Headers;
        +import io.helidon.http.ClientResponseHeaders;
        +import io.helidon.http.Http;
        +import io.helidon.http.Http.Headers;
         import io.helidon.common.testing.http.junit5.SocketHttpClient;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.webserver.http.HttpRules;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webserver.http.HttpRules;
         
         import org.junit.jupiter.api.Test;
         
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/UnsentResponseTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/UnsentResponseTest.java
        similarity index 78%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/UnsentResponseTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/UnsentResponseTest.java
        index f53705f1557..2ca1e8289e5 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/UnsentResponseTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/UnsentResponseTest.java
        @@ -14,17 +14,17 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
        -import io.helidon.common.http.Http;
        -import io.helidon.nima.testing.junit5.webserver.DirectClient;
        -import io.helidon.nima.testing.junit5.webserver.RoutingTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.webclient.http1.Http1ClientResponse;
        -import io.helidon.nima.webserver.http.Handler;
        -import io.helidon.nima.webserver.http.HttpRules;
        -import io.helidon.nima.webserver.http.ServerRequest;
        -import io.helidon.nima.webserver.http.ServerResponse;
        +import io.helidon.http.Http;
        +import io.helidon.webserver.testing.junit5.DirectClient;
        +import io.helidon.webserver.testing.junit5.RoutingTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webclient.http1.Http1ClientResponse;
        +import io.helidon.webserver.http.Handler;
        +import io.helidon.webserver.http.HttpRules;
        +import io.helidon.webserver.http.ServerRequest;
        +import io.helidon.webserver.http.ServerResponse;
         
         import org.junit.jupiter.api.Test;
         
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/UriEncodingTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/UriEncodingTest.java
        similarity index 87%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/UriEncodingTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/UriEncodingTest.java
        index d86b0bbc106..66f624cbacc 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/UriEncodingTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/UriEncodingTest.java
        @@ -14,14 +14,14 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
        -import io.helidon.common.http.ClientResponseHeaders;
        -import io.helidon.common.http.Http;
        +import io.helidon.http.ClientResponseHeaders;
        +import io.helidon.http.Http;
         import io.helidon.common.testing.http.junit5.SocketHttpClient;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.webserver.http.HttpRules;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webserver.http.HttpRules;
         
         import org.junit.jupiter.api.Test;
         
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/UriParamsServerTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/UriParamsServerTest.java
        similarity index 86%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/UriParamsServerTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/UriParamsServerTest.java
        index 4196ec8a9da..a7de6660004 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/UriParamsServerTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/UriParamsServerTest.java
        @@ -14,12 +14,12 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webserver.http.HttpRules;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webserver.http.HttpRules;
         
         import org.junit.jupiter.api.Test;
         
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ValidateRequestHeadersTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ValidateRequestHeadersTest.java
        similarity index 81%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ValidateRequestHeadersTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ValidateRequestHeadersTest.java
        index f6cc391c60d..42287d449e3 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ValidateRequestHeadersTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ValidateRequestHeadersTest.java
        @@ -14,28 +14,28 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
         import java.util.stream.Stream;
         
        -import io.helidon.common.http.Http;
        -import io.helidon.common.http.Http.Header;
        -import io.helidon.common.http.Http.HeaderName;
        -import io.helidon.common.http.ServerRequestHeaders;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.testing.junit5.webserver.SetUpServer;
        -import io.helidon.nima.webclient.api.HttpClientResponse;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webclient.http1.Http1ClientRequest;
        -import io.helidon.nima.webclient.http1.Http1ClientResponse;
        -import io.helidon.nima.webserver.WebServerConfig;
        -import io.helidon.nima.webserver.http.HttpRules;
        -import io.helidon.nima.webserver.http.ServerRequest;
        -import io.helidon.nima.webserver.http.ServerResponse;
        -import io.helidon.nima.webserver.http1.Http1Config;
        -import io.helidon.nima.webserver.http1.Http1ConnectionSelector;
        -import io.helidon.nima.webserver.spi.ServerConnectionSelector;
        +import io.helidon.http.Http;
        +import io.helidon.http.Http.Header;
        +import io.helidon.http.Http.HeaderName;
        +import io.helidon.http.ServerRequestHeaders;
        +import io.helidon.webclient.api.HttpClientResponse;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webclient.http1.Http1ClientRequest;
        +import io.helidon.webclient.http1.Http1ClientResponse;
        +import io.helidon.webserver.WebServerConfig;
        +import io.helidon.webserver.http.HttpRules;
        +import io.helidon.webserver.http.ServerRequest;
        +import io.helidon.webserver.http.ServerResponse;
        +import io.helidon.webserver.http1.Http1Config;
        +import io.helidon.webserver.http1.Http1ConnectionSelector;
        +import io.helidon.webserver.spi.ServerConnectionSelector;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webserver.testing.junit5.SetUpServer;
         
         import org.junit.jupiter.api.Test;
         import org.junit.jupiter.params.ParameterizedTest;
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ValidateResponseHeadersTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ValidateResponseHeadersTest.java
        similarity index 86%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ValidateResponseHeadersTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ValidateResponseHeadersTest.java
        index 1dfa31ba481..88b2de9a9eb 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/ValidateResponseHeadersTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/ValidateResponseHeadersTest.java
        @@ -14,31 +14,31 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
         import java.io.IOException;
         import java.io.OutputStream;
         import java.io.UncheckedIOException;
         import java.util.stream.Stream;
         
        -import io.helidon.common.http.Http;
        -import io.helidon.common.http.Http.Header;
        -import io.helidon.common.http.Http.HeaderName;
        -import io.helidon.common.http.ServerRequestHeaders;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.testing.junit5.webserver.SetUpServer;
        -import io.helidon.nima.webclient.api.HttpClientResponse;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webclient.http1.Http1ClientRequest;
        -import io.helidon.nima.webclient.http1.Http1ClientResponse;
        -import io.helidon.nima.webserver.WebServerConfig;
        -import io.helidon.nima.webserver.http.HttpRules;
        -import io.helidon.nima.webserver.http.ServerRequest;
        -import io.helidon.nima.webserver.http.ServerResponse;
        -import io.helidon.nima.webserver.http1.Http1Config;
        -import io.helidon.nima.webserver.http1.Http1ConnectionSelector;
        -import io.helidon.nima.webserver.spi.ServerConnectionSelector;
        +import io.helidon.http.Http;
        +import io.helidon.http.Http.Header;
        +import io.helidon.http.Http.HeaderName;
        +import io.helidon.http.ServerRequestHeaders;
        +import io.helidon.webclient.api.HttpClientResponse;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webclient.http1.Http1ClientRequest;
        +import io.helidon.webclient.http1.Http1ClientResponse;
        +import io.helidon.webserver.WebServerConfig;
        +import io.helidon.webserver.http.HttpRules;
        +import io.helidon.webserver.http.ServerRequest;
        +import io.helidon.webserver.http.ServerResponse;
        +import io.helidon.webserver.http1.Http1Config;
        +import io.helidon.webserver.http1.Http1ConnectionSelector;
        +import io.helidon.webserver.spi.ServerConnectionSelector;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webserver.testing.junit5.SetUpServer;
         
         import org.junit.jupiter.api.Test;
         import org.junit.jupiter.params.ParameterizedTest;
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/WebServerStopIdleTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/WebServerStopIdleTest.java
        similarity index 90%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/WebServerStopIdleTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/WebServerStopIdleTest.java
        index 17d8faba09c..2c0cf8df8dc 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/WebServerStopIdleTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/WebServerStopIdleTest.java
        @@ -14,11 +14,11 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
        -import io.helidon.common.http.Http;
        -import io.helidon.nima.webclient.http1.Http1Client;
        -import io.helidon.nima.webserver.WebServer;
        +import io.helidon.http.Http;
        +import io.helidon.webclient.http1.Http1Client;
        +import io.helidon.webserver.WebServer;
         import org.junit.jupiter.api.Test;
         
         import static org.hamcrest.CoreMatchers.is;
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/WebServerStopOnlyTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/WebServerStopOnlyTest.java
        similarity index 93%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/WebServerStopOnlyTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/WebServerStopOnlyTest.java
        index aa616960a68..a15a485d87b 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/WebServerStopOnlyTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/WebServerStopOnlyTest.java
        @@ -14,9 +14,9 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
        -import io.helidon.nima.webserver.WebServer;
        +import io.helidon.webserver.WebServer;
         import org.junit.jupiter.api.Test;
         
         import static org.hamcrest.CoreMatchers.is;
        diff --git a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/XssServerTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/XssServerTest.java
        similarity index 90%
        rename from nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/XssServerTest.java
        rename to webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/XssServerTest.java
        index 09c4f4cbcbe..fe7500affbf 100644
        --- a/nima/tests/integration/webserver/webserver/src/test/java/io/helidon/nima/tests/integration/server/XssServerTest.java
        +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/XssServerTest.java
        @@ -14,16 +14,16 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.server;
        +package io.helidon.webserver.tests;
         
         import java.util.List;
         
        -import io.helidon.common.http.HtmlEncoder;
        -import io.helidon.common.http.Http;
        +import io.helidon.http.HtmlEncoder;
        +import io.helidon.http.Http;
         import io.helidon.common.testing.http.junit5.SocketHttpClient;
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.webserver.http.HttpRules;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webserver.http.HttpRules;
         
         import org.junit.jupiter.api.Test;
         
        diff --git a/webserver/tests/webserver/src/test/resources/logging-test.properties b/webserver/tests/webserver/src/test/resources/logging-test.properties
        new file mode 100644
        index 00000000000..55c9412e34c
        --- /dev/null
        +++ b/webserver/tests/webserver/src/test/resources/logging-test.properties
        @@ -0,0 +1,26 @@
        +#
        +# Copyright (c) 2022, 2023 Oracle and/or its affiliates.
        +#
        +# 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.
        +#
        +handlers=java.util.logging.ConsoleHandler
        +java.util.logging.ConsoleHandler.level=FINEST
        +java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
        +java.util.logging.SimpleFormatter.format=%1$tH:%1$tM:%1$tS %4$s %3$s %5$s%6$s%n
        +# Global logging level. Can be overridden by specific loggers
        +.level=INFO
        +io.helidon.webserver.level=INFO
        +io.helidon.webserver.http.Http1Connection.level=INFO
        +io.helidon.webserver.http.HttpRouting.level=INFO
        +io.helidon.common.testing.http.junit5.level=INFO
        +
        diff --git a/webserver/tests/websocket/pom.xml b/webserver/tests/websocket/pom.xml
        new file mode 100644
        index 00000000000..05e183a8539
        --- /dev/null
        +++ b/webserver/tests/websocket/pom.xml
        @@ -0,0 +1,52 @@
        +
        +
        +
        +    4.0.0
        +    
        +        io.helidon.webserver.tests
        +        helidon-webserver-tests-project
        +        4.0.0-SNAPSHOT
        +    
        +
        +    helidon-webserver-tests-websocket
        +    Helidon WebServer Tests WebSocket
        +    WebServer WebSocket tests
        +
        +    
        +        
        +            io.helidon.webserver
        +            helidon-webserver-websocket
        +        
        +        
        +            io.helidon.webserver.testing.junit5
        +            helidon-webserver-testing-junit5
        +            test
        +        
        +        
        +            org.junit.jupiter
        +            junit-jupiter-api
        +            test
        +        
        +        
        +            org.hamcrest
        +            hamcrest-all
        +            test
        +        
        +    
        +
        diff --git a/nima/tests/integration/websocket/server/src/main/java/io/helidon/nima/tests/integration/websocket/webserver/EchoService.java b/webserver/tests/websocket/src/main/java/io/helidon/webserver/tests/websocket/EchoService.java
        similarity index 84%
        rename from nima/tests/integration/websocket/server/src/main/java/io/helidon/nima/tests/integration/websocket/webserver/EchoService.java
        rename to webserver/tests/websocket/src/main/java/io/helidon/webserver/tests/websocket/EchoService.java
        index e5c17bd4be0..b2b9a4b44cf 100644
        --- a/nima/tests/integration/websocket/server/src/main/java/io/helidon/nima/tests/integration/websocket/webserver/EchoService.java
        +++ b/webserver/tests/websocket/src/main/java/io/helidon/webserver/tests/websocket/EchoService.java
        @@ -14,19 +14,19 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.websocket.webserver;
        +package io.helidon.webserver.tests.websocket;
         
         import java.util.List;
         import java.util.Optional;
         import java.util.concurrent.atomic.AtomicReference;
         
        -import io.helidon.common.http.Headers;
        -import io.helidon.common.http.HttpPrologue;
        -import io.helidon.common.http.WritableHeaders;
        -import io.helidon.nima.websocket.WsListener;
        -import io.helidon.nima.websocket.WsSession;
        -import io.helidon.nima.websocket.WsUpgradeException;
        -import io.helidon.nima.websocket.webserver.WsUpgrader;
        +import io.helidon.http.Headers;
        +import io.helidon.http.HttpPrologue;
        +import io.helidon.http.WritableHeaders;
        +import io.helidon.websocket.WsListener;
        +import io.helidon.websocket.WsSession;
        +import io.helidon.websocket.WsUpgradeException;
        +import io.helidon.webserver.websocket.WsUpgrader;
         
         class EchoService implements WsListener {
             private final AtomicReference closed = new AtomicReference<>();
        @@ -67,8 +67,8 @@ public Optional onHttpUpgrade(HttpPrologue prologue, Headers headers) t
                 }
                 if (headers.contains(WsUpgrader.EXTENSIONS)) {
                     List extensions = headers.get(WsUpgrader.EXTENSIONS).allValues(true);
        -            if (extensions.contains("nima")) {
        -                upgradeHeaders.set(WsUpgrader.EXTENSIONS, "nima");
        +            if (extensions.contains("webserver")) {
        +                upgradeHeaders.set(WsUpgrader.EXTENSIONS, "webserver");
                     } else {
                         throw new WsUpgradeException("Unable to negotiate WS extensions");
                     }
        diff --git a/nima/tests/integration/websocket/server/src/main/java/io/helidon/nima/tests/integration/websocket/webserver/WsAction.java b/webserver/tests/websocket/src/main/java/io/helidon/webserver/tests/websocket/WsAction.java
        similarity index 96%
        rename from nima/tests/integration/websocket/server/src/main/java/io/helidon/nima/tests/integration/websocket/webserver/WsAction.java
        rename to webserver/tests/websocket/src/main/java/io/helidon/webserver/tests/websocket/WsAction.java
        index fb0807d76a2..5b667819826 100644
        --- a/nima/tests/integration/websocket/server/src/main/java/io/helidon/nima/tests/integration/websocket/webserver/WsAction.java
        +++ b/webserver/tests/websocket/src/main/java/io/helidon/webserver/tests/websocket/WsAction.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2022 Oracle and/or its affiliates.
        + * Copyright (c) 2022, 2023 Oracle and/or its affiliates.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.websocket.webserver;
        +package io.helidon.webserver.tests.websocket;
         
         import java.util.Random;
         import java.util.StringTokenizer;
        diff --git a/nima/tests/integration/websocket/server/src/main/java/io/helidon/nima/tests/integration/websocket/webserver/WsConversation.java b/webserver/tests/websocket/src/main/java/io/helidon/webserver/tests/websocket/WsConversation.java
        similarity index 95%
        rename from nima/tests/integration/websocket/server/src/main/java/io/helidon/nima/tests/integration/websocket/webserver/WsConversation.java
        rename to webserver/tests/websocket/src/main/java/io/helidon/webserver/tests/websocket/WsConversation.java
        index 1c678d3ccb5..ca26d4186f9 100644
        --- a/nima/tests/integration/websocket/server/src/main/java/io/helidon/nima/tests/integration/websocket/webserver/WsConversation.java
        +++ b/webserver/tests/websocket/src/main/java/io/helidon/webserver/tests/websocket/WsConversation.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2022 Oracle and/or its affiliates.
        + * Copyright (c) 2022, 2023 Oracle and/or its affiliates.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.websocket.webserver;
        +package io.helidon.webserver.tests.websocket;
         
         import java.util.ArrayList;
         import java.util.Collection;
        diff --git a/nima/tests/integration/websocket/server/src/main/java/io/helidon/nima/tests/integration/websocket/webserver/WsConversationClient.java b/webserver/tests/websocket/src/main/java/io/helidon/webserver/tests/websocket/WsConversationClient.java
        similarity index 92%
        rename from nima/tests/integration/websocket/server/src/main/java/io/helidon/nima/tests/integration/websocket/webserver/WsConversationClient.java
        rename to webserver/tests/websocket/src/main/java/io/helidon/webserver/tests/websocket/WsConversationClient.java
        index 0dd09ee1127..ee8be9d9da3 100644
        --- a/nima/tests/integration/websocket/server/src/main/java/io/helidon/nima/tests/integration/websocket/webserver/WsConversationClient.java
        +++ b/webserver/tests/websocket/src/main/java/io/helidon/webserver/tests/websocket/WsConversationClient.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.websocket.webserver;
        +package io.helidon.webserver.tests.websocket;
         
         import java.net.http.WebSocket;
         import java.nio.ByteBuffer;
        @@ -27,9 +27,9 @@
         import java.util.logging.Level;
         import java.util.logging.Logger;
         
        -import static io.helidon.nima.tests.integration.websocket.webserver.WsAction.Operation.RCV;
        -import static io.helidon.nima.tests.integration.websocket.webserver.WsAction.OperationType.BINARY;
        -import static io.helidon.nima.tests.integration.websocket.webserver.WsAction.OperationType.TEXT;
        +import static io.helidon.webserver.tests.websocket.WsAction.Operation.RCV;
        +import static io.helidon.webserver.tests.websocket.WsAction.OperationType.BINARY;
        +import static io.helidon.webserver.tests.websocket.WsAction.OperationType.TEXT;
         import static java.nio.charset.StandardCharsets.UTF_8;
         
         ;
        diff --git a/nima/tests/integration/websocket/server/src/main/java/io/helidon/nima/tests/integration/websocket/webserver/WsConversationService.java b/webserver/tests/websocket/src/main/java/io/helidon/webserver/tests/websocket/WsConversationService.java
        similarity index 86%
        rename from nima/tests/integration/websocket/server/src/main/java/io/helidon/nima/tests/integration/websocket/webserver/WsConversationService.java
        rename to webserver/tests/websocket/src/main/java/io/helidon/webserver/tests/websocket/WsConversationService.java
        index bbf3f68f4f9..39094027de4 100644
        --- a/nima/tests/integration/websocket/server/src/main/java/io/helidon/nima/tests/integration/websocket/webserver/WsConversationService.java
        +++ b/webserver/tests/websocket/src/main/java/io/helidon/webserver/tests/websocket/WsConversationService.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.websocket.webserver;
        +package io.helidon.webserver.tests.websocket;
         
         import java.util.Iterator;
         import java.util.Objects;
        @@ -26,12 +26,9 @@
         import java.util.logging.Logger;
         
         import io.helidon.common.buffers.BufferData;
        -import io.helidon.nima.websocket.WsListener;
        -import io.helidon.nima.websocket.WsSession;
        +import io.helidon.websocket.WsListener;
        +import io.helidon.websocket.WsSession;
         
        -import static io.helidon.nima.tests.integration.websocket.webserver.WsAction.Operation.RCV;
        -import static io.helidon.nima.tests.integration.websocket.webserver.WsAction.OperationType.BINARY;
        -import static io.helidon.nima.tests.integration.websocket.webserver.WsAction.OperationType.TEXT;
         import static java.nio.charset.StandardCharsets.UTF_8;
         
         /**
        @@ -86,13 +83,13 @@ public void onClose(WsSession session, int status, String reason) {
         
             @Override
             public void onMessage(WsSession session, String text, boolean last) {
        -        received.add(new WsAction(RCV, TEXT, text));
        +        received.add(new WsAction(WsAction.Operation.RCV, WsAction.OperationType.TEXT, text));
             }
         
             @Override
             public void onMessage(WsSession session, BufferData buffer, boolean last) {
                 int n = buffer.available();
        -        received.add(new WsAction(RCV, BINARY, buffer.readString(n, UTF_8)));
        +        received.add(new WsAction(WsAction.Operation.RCV, WsAction.OperationType.BINARY, buffer.readString(n, UTF_8)));
             }
         
             @Override
        diff --git a/webserver/tests/websocket/src/main/resources/logging.properties b/webserver/tests/websocket/src/main/resources/logging.properties
        new file mode 100644
        index 00000000000..d09df1098a3
        --- /dev/null
        +++ b/webserver/tests/websocket/src/main/resources/logging.properties
        @@ -0,0 +1,20 @@
        +#
        +# Copyright (c) 2022, 2023 Oracle and/or its affiliates.
        +#
        +# 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.
        +#
        +handlers=java.util.logging.ConsoleHandler
        +java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS.%1$tL %5$s%6$s%n
        +# Global logging level. Can be overridden by specific loggers
        +.level=INFO
        +io.helidon.webserver.level=INFO
        diff --git a/nima/tests/integration/websocket/server/src/test/java/io/helidon/nima/tests/integration/websocket/webserver/WebSocketOriginTest.java b/webserver/tests/websocket/src/test/java/io/helidon/webserver/tests/websocket/WebSocketOriginTest.java
        similarity index 82%
        rename from nima/tests/integration/websocket/server/src/test/java/io/helidon/nima/tests/integration/websocket/webserver/WebSocketOriginTest.java
        rename to webserver/tests/websocket/src/test/java/io/helidon/webserver/tests/websocket/WebSocketOriginTest.java
        index f95d6dfbe5b..31ffcf24fee 100644
        --- a/nima/tests/integration/websocket/server/src/test/java/io/helidon/nima/tests/integration/websocket/webserver/WebSocketOriginTest.java
        +++ b/webserver/tests/websocket/src/test/java/io/helidon/webserver/tests/websocket/WebSocketOriginTest.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.websocket.webserver;
        +package io.helidon.webserver.tests.websocket;
         
         import java.net.URI;
         import java.net.http.HttpClient;
        @@ -28,19 +28,19 @@
         import java.util.concurrent.TimeUnit;
         import java.util.concurrent.TimeoutException;
         
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.testing.junit5.webserver.SetUpServer;
        -import io.helidon.nima.webserver.Router;
        -import io.helidon.nima.webserver.WebServerConfig;
        -import io.helidon.nima.webserver.http1.Http1Config;
        -import io.helidon.nima.webserver.http1.Http1ConnectionSelector;
        -import io.helidon.nima.websocket.WsCloseCodes;
        -import io.helidon.nima.websocket.WsListener;
        -import io.helidon.nima.websocket.WsSession;
        -import io.helidon.nima.websocket.webserver.WsConfig;
        -import io.helidon.nima.websocket.webserver.WsRouting;
        -import io.helidon.nima.websocket.webserver.WsUpgrader;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webserver.testing.junit5.SetUpServer;
        +import io.helidon.webserver.Router;
        +import io.helidon.webserver.WebServerConfig;
        +import io.helidon.webserver.http1.Http1Config;
        +import io.helidon.webserver.http1.Http1ConnectionSelector;
        +import io.helidon.webserver.websocket.WsConfig;
        +import io.helidon.websocket.WsCloseCodes;
        +import io.helidon.websocket.WsListener;
        +import io.helidon.websocket.WsSession;
        +import io.helidon.webserver.websocket.WsRouting;
        +import io.helidon.webserver.websocket.WsUpgrader;
         
         import org.junit.jupiter.api.Test;
         
        @@ -65,7 +65,7 @@ static void updateServer(WebServerConfig.Builder builder) {
                 builder.addConnectionSelector(Http1ConnectionSelector.builder()
                                                       .config(Http1Config.create())
                                                       .addUpgrader(WsUpgrader.create(WsConfig.builder()
        -                                                                                     .addOrigin("NimaTest")
        +                                                                                     .addOrigin("WebServerTest")
                                                                                              .build()))
                                                       .build());
             }
        @@ -82,7 +82,7 @@ void testSingle() throws ExecutionException, InterruptedException, TimeoutExcept
                 CompletableFuture wsCompleted = new CompletableFuture<>();
         
                 java.net.http.WebSocket webSocket = client.newWebSocketBuilder()
        -                .header("Origin", "NimaTest")
        +                .header("Origin", "WebServerTest")
                         .buildAsync(URI.create("ws://localhost:" + port + "/single"),
                                     new java.net.http.WebSocket.Listener() {
                                         @Override
        diff --git a/nima/tests/integration/websocket/server/src/test/java/io/helidon/nima/tests/integration/websocket/webserver/WebSocketTest.java b/webserver/tests/websocket/src/test/java/io/helidon/webserver/tests/websocket/WebSocketTest.java
        similarity index 92%
        rename from nima/tests/integration/websocket/server/src/test/java/io/helidon/nima/tests/integration/websocket/webserver/WebSocketTest.java
        rename to webserver/tests/websocket/src/test/java/io/helidon/webserver/tests/websocket/WebSocketTest.java
        index ea7b7f5a6be..bd6d964ce6a 100644
        --- a/nima/tests/integration/websocket/server/src/test/java/io/helidon/nima/tests/integration/websocket/webserver/WebSocketTest.java
        +++ b/webserver/tests/websocket/src/test/java/io/helidon/webserver/tests/websocket/WebSocketTest.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.websocket.webserver;
        +package io.helidon.webserver.tests.websocket;
         
         import java.net.URI;
         import java.net.http.HttpClient;
        @@ -27,12 +27,12 @@
         import java.util.concurrent.TimeUnit;
         import java.util.concurrent.TimeoutException;
         
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.webserver.Router;
        -import io.helidon.nima.webserver.WebServer;
        -import io.helidon.nima.websocket.WsCloseCodes;
        -import io.helidon.nima.websocket.webserver.WsRouting;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webserver.Router;
        +import io.helidon.webserver.WebServer;
        +import io.helidon.websocket.WsCloseCodes;
        +import io.helidon.webserver.websocket.WsRouting;
         
         import org.junit.jupiter.api.AfterEach;
         import org.junit.jupiter.api.BeforeEach;
        @@ -82,7 +82,7 @@ void testOnce() throws Exception {
         
                 java.net.http.WebSocket ws = client.newWebSocketBuilder()
                         .subprotocols("chat", "mute")
        -                // .header(EXTENSIONS.defaultCase(), "nima") rejected by client
        +                // .header(EXTENSIONS.defaultCase(), "webserver") rejected by client
                         .buildAsync(URI.create("ws://localhost:" + port + "/echo"), listener)
                         .get(5, TimeUnit.SECONDS);
                 assertThat(ws.getSubprotocol(), is("chat"));    // negotiated
        diff --git a/nima/tests/integration/websocket/server/src/test/java/io/helidon/nima/tests/integration/websocket/webserver/WsConversationTest.java b/webserver/tests/websocket/src/test/java/io/helidon/webserver/tests/websocket/WsConversationTest.java
        similarity index 82%
        rename from nima/tests/integration/websocket/server/src/test/java/io/helidon/nima/tests/integration/websocket/webserver/WsConversationTest.java
        rename to webserver/tests/websocket/src/test/java/io/helidon/webserver/tests/websocket/WsConversationTest.java
        index ef866ec43dd..f56eb633fb1 100644
        --- a/nima/tests/integration/websocket/server/src/test/java/io/helidon/nima/tests/integration/websocket/webserver/WsConversationTest.java
        +++ b/webserver/tests/websocket/src/test/java/io/helidon/webserver/tests/websocket/WsConversationTest.java
        @@ -14,19 +14,18 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.tests.integration.websocket.webserver;
        +package io.helidon.webserver.tests.websocket;
         
         import java.net.URI;
         import java.net.http.HttpClient;
         import java.time.Duration;
         import java.util.concurrent.TimeUnit;
         
        -import io.helidon.nima.testing.junit5.webserver.ServerTest;
        -import io.helidon.nima.testing.junit5.webserver.SetUpRoute;
        -import io.helidon.nima.tests.integration.websocket.webserver.WsConversationClient.WsConversationListener;
        -import io.helidon.nima.webserver.Router;
        -import io.helidon.nima.webserver.WebServer;
        -import io.helidon.nima.websocket.webserver.WsRouting;
        +import io.helidon.webserver.testing.junit5.ServerTest;
        +import io.helidon.webserver.testing.junit5.SetUpRoute;
        +import io.helidon.webserver.Router;
        +import io.helidon.webserver.WebServer;
        +import io.helidon.webserver.websocket.WsRouting;
         
         import org.junit.jupiter.api.MethodOrderer;
         import org.junit.jupiter.api.Test;
        @@ -71,7 +70,7 @@ void testConversation1000() throws Exception {
         
             private void testConversation(WsConversation conversation) throws Exception {
                 service.conversation(conversation);
        -        WsConversationListener listener = new WsConversationListener();
        +        WsConversationClient.WsConversationListener listener = new WsConversationClient.WsConversationListener();
                 java.net.http.WebSocket socket = client.newWebSocketBuilder()
                         .buildAsync(URI.create("ws://localhost:" + port + "/conversation"), listener)
                         .get(WAIT_SECONDS, TimeUnit.SECONDS);
        diff --git a/webserver/tracing/pom.xml b/webserver/tracing/pom.xml
        new file mode 100644
        index 00000000000..69c77111fb6
        --- /dev/null
        +++ b/webserver/tracing/pom.xml
        @@ -0,0 +1,87 @@
        +
        +
        +
        +    4.0.0
        +    
        +        io.helidon.webserver
        +        helidon-webserver-project
        +        4.0.0-SNAPSHOT
        +    
        +
        +    helidon-webserver-tracing
        +    Helidon WebServer Tracing
        +    WebServer Tracing support
        +
        +    
        +        
        +            io.helidon.webserver
        +            helidon-webserver
        +        
        +        
        +            io.helidon.config
        +            helidon-config
        +        
        +        
        +            io.helidon.tracing
        +            helidon-tracing
        +        
        +        
        +            io.helidon.tracing
        +            helidon-tracing-config
        +        
        +        
        +            io.helidon.common.features
        +            helidon-common-features-api
        +            true
        +        
        +        
        +            io.helidon.webserver.testing.junit5
        +            helidon-webserver-testing-junit5
        +            test
        +        
        +        
        +            org.junit.jupiter
        +            junit-jupiter-api
        +            test
        +        
        +        
        +            org.hamcrest
        +            hamcrest-all
        +            test
        +        
        +    
        +
        +    
        +        
        +            
        +                org.apache.maven.plugins
        +                maven-compiler-plugin
        +                
        +                    
        +                        
        +                            io.helidon.common.features
        +                            helidon-common-features-processor
        +                            ${helidon.version}
        +                        
        +                    
        +                
        +            
        +        
        +    
        +
        diff --git a/nima/webserver/tracing/src/main/java/io/helidon/nima/webserver/tracing/PathTracingConfig.java b/webserver/tracing/src/main/java/io/helidon/webserver/tracing/PathTracingConfig.java
        similarity index 93%
        rename from nima/webserver/tracing/src/main/java/io/helidon/nima/webserver/tracing/PathTracingConfig.java
        rename to webserver/tracing/src/main/java/io/helidon/webserver/tracing/PathTracingConfig.java
        index a47dd4574dc..a8da0f92c6f 100644
        --- a/nima/webserver/tracing/src/main/java/io/helidon/nima/webserver/tracing/PathTracingConfig.java
        +++ b/webserver/tracing/src/main/java/io/helidon/webserver/tracing/PathTracingConfig.java
        @@ -13,17 +13,17 @@
          * See the License for the specific language governing permissions and
          * limitations under the License.
          */
        -package io.helidon.nima.webserver.tracing;
        +package io.helidon.webserver.tracing;
         
         import java.util.Collection;
         import java.util.LinkedList;
         import java.util.List;
         
        -import io.helidon.common.http.Http;
        -import io.helidon.common.http.PathMatcher;
        -import io.helidon.common.http.PathMatchers;
         import io.helidon.common.uri.UriPath;
         import io.helidon.config.Config;
        +import io.helidon.http.Http;
        +import io.helidon.http.PathMatcher;
        +import io.helidon.http.PathMatchers;
         import io.helidon.tracing.config.TracingConfig;
         
         /**
        @@ -66,7 +66,7 @@ static Builder builder() {
             TracingConfig tracedConfig();
         
             /**
        -     * Fluent API builder for {@link io.helidon.nima.webserver.tracing.PathTracingConfig}.
        +     * Fluent API builder for {@link PathTracingConfig}.
              */
             final class Builder implements io.helidon.common.Builder {
                 private final List methods = new LinkedList<>();
        @@ -125,7 +125,7 @@ public Builder config(Config config) {
                 /**
                  * Path to register the traced configuration on.
                  *
        -         * @param path path as understood by {@link io.helidon.nima.webserver.http.HttpRouting.Builder} of web server
        +         * @param path path as understood by {@link io.helidon.webserver.http.HttpRouting.Builder} of web server
                  * @return updated builder instance
                  */
                 public Builder path(String path) {
        diff --git a/nima/webserver/tracing/src/main/java/io/helidon/nima/webserver/tracing/TracingFeature.java b/webserver/tracing/src/main/java/io/helidon/webserver/tracing/TracingFeature.java
        similarity index 93%
        rename from nima/webserver/tracing/src/main/java/io/helidon/nima/webserver/tracing/TracingFeature.java
        rename to webserver/tracing/src/main/java/io/helidon/webserver/tracing/TracingFeature.java
        index 248a5a12013..01e58714059 100644
        --- a/nima/webserver/tracing/src/main/java/io/helidon/nima/webserver/tracing/TracingFeature.java
        +++ b/webserver/tracing/src/main/java/io/helidon/webserver/tracing/TracingFeature.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.webserver.tracing;
        +package io.helidon.webserver.tracing;
         
         import java.util.LinkedList;
         import java.util.List;
        @@ -24,17 +24,10 @@
         import io.helidon.common.Weighted;
         import io.helidon.common.context.Context;
         import io.helidon.common.context.Contexts;
        -import io.helidon.common.http.Http;
        -import io.helidon.common.http.HttpPrologue;
         import io.helidon.common.uri.UriInfo;
         import io.helidon.config.Config;
        -import io.helidon.nima.webserver.http.Filter;
        -import io.helidon.nima.webserver.http.FilterChain;
        -import io.helidon.nima.webserver.http.HttpFeature;
        -import io.helidon.nima.webserver.http.HttpRouting;
        -import io.helidon.nima.webserver.http.RoutingRequest;
        -import io.helidon.nima.webserver.http.RoutingResponse;
        -import io.helidon.nima.webserver.http.ServerRequest;
        +import io.helidon.http.Http;
        +import io.helidon.http.HttpPrologue;
         import io.helidon.tracing.HeaderProvider;
         import io.helidon.tracing.Scope;
         import io.helidon.tracing.Span;
        @@ -43,11 +36,18 @@
         import io.helidon.tracing.Tracer;
         import io.helidon.tracing.config.SpanTracingConfig;
         import io.helidon.tracing.config.TracingConfig;
        +import io.helidon.webserver.http.Filter;
        +import io.helidon.webserver.http.FilterChain;
        +import io.helidon.webserver.http.HttpFeature;
        +import io.helidon.webserver.http.HttpRouting;
        +import io.helidon.webserver.http.RoutingRequest;
        +import io.helidon.webserver.http.RoutingResponse;
        +import io.helidon.webserver.http.ServerRequest;
         
         /**
          * Tracing configuration for webserver.
          * Tracing configuration has two components - an overall (application wide) {@link io.helidon.tracing.config.TracingConfig}
        - * and a path specific {@link io.helidon.nima.webserver.tracing.PathTracingConfig}.
        + * and a path specific {@link PathTracingConfig}.
          */
         public class TracingFeature implements HttpFeature, Weighted {
             private static final double WEIGHT = 900;
        @@ -75,7 +75,7 @@ private TracingFeature(Builder builder) {
              * @param tracer tracer to use for tracing spans created by this feature
              * @return tracing configuration to register with
              *         {@link
        -     *         io.helidon.nima.webserver.http.HttpRouting.Builder#register(java.util.function.Supplier[])}
        +     *         io.helidon.webserver.http.HttpRouting.Builder#register(java.util.function.Supplier[])}
              */
             public static TracingFeature create(Tracer tracer) {
                 return create(tracer, TracingConfig.ENABLED);
        @@ -274,7 +274,7 @@ public void filter(FilterChain chain, RoutingRequest req, RoutingResponse res) {
                     /*
                     Extract inbound span context, this will act as a parent of the new webserver span
                      */
        -            Optional inboundSpanContext = tracer.extract(new NimaHeaderProvider(req));
        +            Optional inboundSpanContext = tracer.extract(new HeaderProviderImpl(req));
         
                     /*
                     Find configuration of the web server span (can customize name, disable etc.)
        @@ -308,7 +308,7 @@ Find configuration of the web server span (can customize name, disable etc.)
                     context.register(TracingConfig.class, span.context());
         
                     try (Scope ignored = span.activate()) {
        -                span.tag(Tag.COMPONENT.create("helidon-nima-webserver"));
        +                span.tag(Tag.COMPONENT.create("helidon-webserver"));
                         span.tag(Tag.HTTP_METHOD.create(prologue.method().text()));
                         UriInfo uriInfo = req.requestedUri();
                         span.tag(Tag.HTTP_URL.create(uriInfo.scheme() + "://" + uriInfo.authority() + uriInfo.path().path()));
        @@ -357,10 +357,10 @@ private TracingConfig configureTracingConfig(RoutingRequest req, Context context
                 }
             }
         
        -    private static class NimaHeaderProvider implements HeaderProvider {
        +    private static class HeaderProviderImpl implements HeaderProvider {
                 private final ServerRequest request;
         
        -        private NimaHeaderProvider(ServerRequest request) {
        +        private HeaderProviderImpl(ServerRequest request) {
                     this.request = request;
                 }
         
        diff --git a/webserver/tracing/src/main/java/io/helidon/webserver/tracing/package-info.java b/webserver/tracing/src/main/java/io/helidon/webserver/tracing/package-info.java
        new file mode 100644
        index 00000000000..9045e5b3c5d
        --- /dev/null
        +++ b/webserver/tracing/src/main/java/io/helidon/webserver/tracing/package-info.java
        @@ -0,0 +1,20 @@
        +/*
        + * Copyright (c) 2022, 2023 Oracle and/or its affiliates.
        + *
        + * 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.
        + */
        +
        +/**
        + * Helidon WebServer Tracing Support.
        + */
        +package io.helidon.webserver.tracing;
        diff --git a/webserver/tracing/src/main/java/module-info.java b/webserver/tracing/src/main/java/module-info.java
        new file mode 100644
        index 00000000000..3368b8a41a1
        --- /dev/null
        +++ b/webserver/tracing/src/main/java/module-info.java
        @@ -0,0 +1,37 @@
        +/*
        + * Copyright (c) 2022, 2023 Oracle and/or its affiliates.
        + *
        + * 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.
        + */
        +
        +import io.helidon.common.features.api.Feature;
        +import io.helidon.common.features.api.HelidonFlavor;
        +
        +/**
        + * Helidon WebServer Tracing Support.
        + */
        +@Feature(value = "Tracing",
        +        description = "WebServer Tracing support",
        +        in = HelidonFlavor.SE
        +)
        +module io.helidon.webserver.tracing {
        +    requires static io.helidon.common.features.api;
        +
        +    requires io.helidon.http;
        +    requires io.helidon.webserver;
        +    requires io.helidon.tracing;
        +    requires io.helidon.tracing.config;
        +
        +
        +    exports io.helidon.webserver.tracing;
        +}
        \ No newline at end of file
        diff --git a/webserver/webserver/etc/spotbugs/exclude.xml b/webserver/webserver/etc/spotbugs/exclude.xml
        new file mode 100644
        index 00000000000..ae56a6bc850
        --- /dev/null
        +++ b/webserver/webserver/etc/spotbugs/exclude.xml
        @@ -0,0 +1,39 @@
        +
        +
        +
        +
        +
        +    
        +        
        +        
        +        
        +    
        +
        +    
        +        
        +        
        +        
        +        
        +    
        +
        diff --git a/webserver/webserver/pom.xml b/webserver/webserver/pom.xml
        new file mode 100644
        index 00000000000..5ffda0f0439
        --- /dev/null
        +++ b/webserver/webserver/pom.xml
        @@ -0,0 +1,223 @@
        +
        +
        +
        +    4.0.0
        +    
        +        io.helidon.webserver
        +        helidon-webserver-project
        +        4.0.0-SNAPSHOT
        +    
        +
        +    helidon-webserver
        +    Helidon WebServer
        +
        +    
        +        etc/spotbugs/exclude.xml
        +    
        +
        +    
        +        
        +            io.helidon.http
        +            helidon-http
        +        
        +        
        +            io.helidon.common
        +            helidon-common-socket
        +        
        +        
        +            io.helidon.common
        +            helidon-common-context
        +        
        +        
        +            io.helidon.common
        +            helidon-common-key-util
        +        
        +        
        +            io.helidon.common
        +            helidon-common-security
        +        
        +        
        +            io.helidon.common
        +            helidon-common-task
        +        
        +        
        +            io.helidon.common
        +            helidon-common-tls
        +        
        +        
        +            io.helidon.http.media
        +            helidon-http-media
        +        
        +        
        +            io.helidon.http.encoding
        +            helidon-http-encoding
        +        
        +        
        +            
        +            io.helidon.inject.configdriven
        +            helidon-inject-configdriven-api
        +        
        +        
        +            io.helidon.common.features
        +            helidon-common-features
        +        
        +        
        +            
        +            io.helidon.inject.configdriven
        +            helidon-inject-configdriven-runtime
        +            true
        +        
        +        
        +            io.helidon.inject
        +            helidon-inject-api
        +        
        +        
        +            io.helidon.inject
        +            helidon-inject-runtime
        +            true
        +        
        +        
        +            io.helidon.inject.configdriven
        +            helidon-inject-configdriven-processor
        +            true 
        +        
        +        
        +            jakarta.inject
        +            jakarta.inject-api
        +            true
        +        
        +        
        +            io.helidon.config
        +            helidon-config-metadata
        +            true
        +        
        +        
        +            io.helidon.config
        +            helidon-config-yaml
        +            test
        +        
        +        
        +        
        +            helidon-http-encoding-gzip
        +            io.helidon.http.encoding
        +            test
        +        
        +        
        +        
        +            helidon-http-media-jsonp
        +            io.helidon.http.media
        +            test
        +        
        +        
        +            jakarta.json
        +            jakarta.json-api
        +            test
        +        
        +        
        +            org.junit.jupiter
        +            junit-jupiter-api
        +            test
        +        
        +        
        +            junit-jupiter-params
        +            org.junit.jupiter
        +            test
        +        
        +        
        +            mockito-core
        +            org.mockito
        +            test
        +        
        +        
        +            org.hamcrest
        +            hamcrest-all
        +            test
        +        
        +        
        +            helidon-common-testing-junit5
        +            io.helidon.common.testing
        +            test
        +        
        +        
        +            io.helidon.inject
        +            helidon-inject-testing
        +            test
        +        
        +    
        +
        +    
        +        
        +            
        +                org.apache.maven.plugins
        +                maven-compiler-plugin
        +                
        +                    
        +                        
        +                            io.helidon.common.features
        +                            helidon-common-features-processor
        +                            ${helidon.version}
        +                        
        +                        
        +                            io.helidon.config
        +                            helidon-config-metadata-processor
        +                            ${helidon.version}
        +                        
        +                        
        +                            io.helidon.builder
        +                            helidon-builder-processor
        +                            ${helidon.version}
        +                        
        +                        
        +                            io.helidon.inject.configdriven
        +                            helidon-inject-configdriven-processor
        +                            ${helidon.version}
        +                        
        +                        
        +                            io.helidon.common.processor
        +                            helidon-common-processor-helidon-copyright
        +                            ${helidon.version}
        +                        
        +                    
        +                
        +                
        +                    
        +                        io.helidon.builder
        +                        helidon-builder-processor
        +                        ${helidon.version}
        +                    
        +                    
        +                        io.helidon.config
        +                        helidon-config-metadata-processor
        +                        ${helidon.version}
        +                    
        +                    
        +                        io.helidon.inject.configdriven
        +                        helidon-inject-configdriven-processor
        +                        ${helidon.version}
        +                    
        +                    
        +                        io.helidon.common.processor
        +                        helidon-common-processor-helidon-copyright
        +                        ${helidon.version}
        +                    
        +                
        +            
        +        
        +    
        +
        diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/CloseConnectionException.java b/webserver/webserver/src/main/java/io/helidon/webserver/CloseConnectionException.java
        similarity index 92%
        rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/CloseConnectionException.java
        rename to webserver/webserver/src/main/java/io/helidon/webserver/CloseConnectionException.java
        index 68d123b7257..6cc4aeb2c48 100644
        --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/CloseConnectionException.java
        +++ b/webserver/webserver/src/main/java/io/helidon/webserver/CloseConnectionException.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2022 Oracle and/or its affiliates.
        + * Copyright (c) 2022, 2023 Oracle and/or its affiliates.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.webserver;
        +package io.helidon.webserver;
         
         /**
          * Close the connection.
        diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/ConnectionConfigBlueprint.java b/webserver/webserver/src/main/java/io/helidon/webserver/ConnectionConfigBlueprint.java
        similarity index 98%
        rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/ConnectionConfigBlueprint.java
        rename to webserver/webserver/src/main/java/io/helidon/webserver/ConnectionConfigBlueprint.java
        index 7a6722297f9..401c90aa2ad 100644
        --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/ConnectionConfigBlueprint.java
        +++ b/webserver/webserver/src/main/java/io/helidon/webserver/ConnectionConfigBlueprint.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.webserver;
        +package io.helidon.webserver;
         
         import java.net.SocketOption;
         import java.time.Duration;
        diff --git a/webserver/webserver/src/main/java/io/helidon/webserver/ConnectionContext.java b/webserver/webserver/src/main/java/io/helidon/webserver/ConnectionContext.java
        new file mode 100644
        index 00000000000..bbca8281788
        --- /dev/null
        +++ b/webserver/webserver/src/main/java/io/helidon/webserver/ConnectionContext.java
        @@ -0,0 +1,63 @@
        +/*
        + * Copyright (c) 2022, 2023 Oracle and/or its affiliates.
        + *
        + * Licensed under the Apache License, Version 2.0 (the "License");
        + * you may not use this file except in compliance with the License.
        + * You may obtain a copy of the License at
        + *
        + *     http://www.apache.org/licenses/LICENSE-2.0
        + *
        + * Unless required by applicable law or agreed to in writing, software
        + * distributed under the License is distributed on an "AS IS" BASIS,
        + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        + * See the License for the specific language governing permissions and
        + * limitations under the License.
        + */
        +
        +package io.helidon.webserver;
        +
        +import java.util.concurrent.ExecutorService;
        +
        +import io.helidon.common.buffers.DataReader;
        +import io.helidon.common.buffers.DataWriter;
        +import io.helidon.common.socket.SocketContext;
        +
        +/**
        + * Server connection context.
        + */
        +public interface ConnectionContext extends SocketContext {
        +    /**
        +     * Context of the listener. Configuration specific to a single listener.
        +     *
        +     * @return listener specific context
        +     */
        +    ListenerContext listenerContext();
        +
        +    /**
        +     * Executor service to submit asynchronous tasks.
        +     *
        +     * @return executor service
        +     */
        +    ExecutorService executor();
        +
        +    /**
        +     * Data writer to write response bytes.
        +     *
        +     * @return data writer
        +     */
        +    DataWriter dataWriter();
        +
        +    /**
        +     * Data reader to read request bytes.
        +     *
        +     * @return data reader
        +     */
        +    DataReader dataReader();
        +
        +    /**
        +     * Router that may contain routings of different types (HTTP, WebSocket, grpc).
        +     *
        +     * @return rouer
        +     */
        +    Router router();
        +}
        diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/ConnectionHandler.java b/webserver/webserver/src/main/java/io/helidon/webserver/ConnectionHandler.java
        similarity index 96%
        rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/ConnectionHandler.java
        rename to webserver/webserver/src/main/java/io/helidon/webserver/ConnectionHandler.java
        index c5063d8cad4..ac8d121830a 100644
        --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/ConnectionHandler.java
        +++ b/webserver/webserver/src/main/java/io/helidon/webserver/ConnectionHandler.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.webserver;
        +package io.helidon.webserver;
         
         import java.io.UncheckedIOException;
         import java.util.Iterator;
        @@ -26,14 +26,14 @@
         import io.helidon.common.buffers.BufferData;
         import io.helidon.common.buffers.DataReader;
         import io.helidon.common.buffers.DataWriter;
        -import io.helidon.common.http.HttpException;
        -import io.helidon.common.http.RequestException;
         import io.helidon.common.socket.HelidonSocket;
         import io.helidon.common.socket.PeerInfo;
         import io.helidon.common.socket.SocketWriter;
         import io.helidon.common.task.InterruptableTask;
        -import io.helidon.nima.webserver.spi.ServerConnection;
        -import io.helidon.nima.webserver.spi.ServerConnectionSelector;
        +import io.helidon.http.HttpException;
        +import io.helidon.http.RequestException;
        +import io.helidon.webserver.spi.ServerConnection;
        +import io.helidon.webserver.spi.ServerConnectionSelector;
         
         import static java.lang.System.Logger.Level.DEBUG;
         import static java.lang.System.Logger.Level.TRACE;
        @@ -87,7 +87,7 @@ public boolean canInterrupt() {
             @Override
             public final void run() {
                 String socketsId = socket.socketId() + " " + socket.childSocketId();
        -        Thread.currentThread().setName("[" + socketsId + "] Nima socket");
        +        Thread.currentThread().setName("[" + socketsId + "] WebServer socket");
                 if (LOGGER.isLoggable(DEBUG)) {
                     socket.log(LOGGER,
                                DEBUG,
        diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/ConnectionProviders.java b/webserver/webserver/src/main/java/io/helidon/webserver/ConnectionProviders.java
        similarity index 96%
        rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/ConnectionProviders.java
        rename to webserver/webserver/src/main/java/io/helidon/webserver/ConnectionProviders.java
        index 165c89bca4b..d7b151cc402 100644
        --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/ConnectionProviders.java
        +++ b/webserver/webserver/src/main/java/io/helidon/webserver/ConnectionProviders.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.webserver;
        +package io.helidon.webserver;
         
         import java.util.ArrayList;
         import java.util.HashMap;
        @@ -23,7 +23,7 @@
         import java.util.Map;
         import java.util.Set;
         
        -import io.helidon.nima.webserver.spi.ServerConnectionSelector;
        +import io.helidon.webserver.spi.ServerConnectionSelector;
         
         /**
          * Connection provider candidates.
        diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/IdleTimeoutHandler.java b/webserver/webserver/src/main/java/io/helidon/webserver/IdleTimeoutHandler.java
        similarity index 96%
        rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/IdleTimeoutHandler.java
        rename to webserver/webserver/src/main/java/io/helidon/webserver/IdleTimeoutHandler.java
        index 74f0f1511f5..e9c559aa08e 100644
        --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/IdleTimeoutHandler.java
        +++ b/webserver/webserver/src/main/java/io/helidon/webserver/IdleTimeoutHandler.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.webserver;
        +package io.helidon.webserver;
         
         import java.time.Duration;
         import java.util.List;
        @@ -22,7 +22,7 @@
         import java.util.TimerTask;
         import java.util.function.Supplier;
         
        -import io.helidon.nima.webserver.spi.ServerConnection;
        +import io.helidon.webserver.spi.ServerConnection;
         
         class IdleTimeoutHandler extends TimerTask {
             private final Timer timer;
        diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/KeyPerformanceIndicatorContextFactory.java b/webserver/webserver/src/main/java/io/helidon/webserver/KeyPerformanceIndicatorContextFactory.java
        similarity index 97%
        rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/KeyPerformanceIndicatorContextFactory.java
        rename to webserver/webserver/src/main/java/io/helidon/webserver/KeyPerformanceIndicatorContextFactory.java
        index 5093af83fa1..a90e53680b5 100644
        --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/KeyPerformanceIndicatorContextFactory.java
        +++ b/webserver/webserver/src/main/java/io/helidon/webserver/KeyPerformanceIndicatorContextFactory.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2021, 2022 Oracle and/or its affiliates.
        + * Copyright (c) 2021, 2023 Oracle and/or its affiliates.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        @@ -13,7 +13,7 @@
          * See the License for the specific language governing permissions and
          * limitations under the License.
          */
        -package io.helidon.nima.webserver;
        +package io.helidon.webserver;
         
         class KeyPerformanceIndicatorContextFactory {
         
        diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/KeyPerformanceIndicatorSupport.java b/webserver/webserver/src/main/java/io/helidon/webserver/KeyPerformanceIndicatorSupport.java
        similarity index 94%
        rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/KeyPerformanceIndicatorSupport.java
        rename to webserver/webserver/src/main/java/io/helidon/webserver/KeyPerformanceIndicatorSupport.java
        index c03b24fc7cf..311a8b7da77 100644
        --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/KeyPerformanceIndicatorSupport.java
        +++ b/webserver/webserver/src/main/java/io/helidon/webserver/KeyPerformanceIndicatorSupport.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2021, 2022 Oracle and/or its affiliates.
        + * Copyright (c) 2021, 2023 Oracle and/or its affiliates.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        @@ -13,9 +13,9 @@
          * See the License for the specific language governing permissions and
          * limitations under the License.
          */
        -package io.helidon.nima.webserver;
        +package io.helidon.webserver;
         
        -import io.helidon.nima.webserver.http.Handler;
        +import io.helidon.webserver.http.Handler;
         
         /**
          * Definitions and factory methods for key performance indicator {@link KeyPerformanceIndicatorSupport.Context} and {@link KeyPerformanceIndicatorSupport.Metrics}.
        @@ -112,7 +112,7 @@ static Context create() {
                 }
         
                 /**
        -         * A {@link io.helidon.nima.webserver.http.Handler} which registers a KPI deferrable request context in the request's context.
        +         * A {@link io.helidon.webserver.http.Handler} which registers a KPI deferrable request context in the request's context.
                  */
                 Handler CONTEXT_SETTING_HANDLER = (req, res) -> {
                     req.context().register(KeyPerformanceIndicatorContextFactory.deferrableRequestContext());
        diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/ListenerConfigBlueprint.java b/webserver/webserver/src/main/java/io/helidon/webserver/ListenerConfigBlueprint.java
        similarity index 92%
        rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/ListenerConfigBlueprint.java
        rename to webserver/webserver/src/main/java/io/helidon/webserver/ListenerConfigBlueprint.java
        index 613e2924edf..2915f7c2bca 100644
        --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/ListenerConfigBlueprint.java
        +++ b/webserver/webserver/src/main/java/io/helidon/webserver/ListenerConfigBlueprint.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.webserver;
        +package io.helidon.webserver;
         
         import java.io.IOException;
         import java.io.UncheckedIOException;
        @@ -31,18 +31,18 @@
         import io.helidon.builder.api.Prototype;
         import io.helidon.common.config.Config;
         import io.helidon.common.context.Context;
        -import io.helidon.common.http.RequestedUriDiscoveryContext;
         import io.helidon.common.socket.SocketOptions;
        +import io.helidon.common.tls.Tls;
         import io.helidon.config.metadata.Configured;
         import io.helidon.config.metadata.ConfiguredOption;
        -import io.helidon.nima.common.tls.Tls;
        -import io.helidon.nima.http.encoding.ContentEncodingContext;
        -import io.helidon.nima.http.media.MediaContext;
        -import io.helidon.nima.webserver.http.DirectHandlers;
        -import io.helidon.nima.webserver.http.HttpRouting;
        -import io.helidon.nima.webserver.spi.ProtocolConfig;
        -import io.helidon.nima.webserver.spi.ProtocolConfigProvider;
        -import io.helidon.nima.webserver.spi.ServerConnectionSelector;
        +import io.helidon.http.RequestedUriDiscoveryContext;
        +import io.helidon.http.encoding.ContentEncodingContext;
        +import io.helidon.http.media.MediaContext;
        +import io.helidon.webserver.http.DirectHandlers;
        +import io.helidon.webserver.http.HttpRouting;
        +import io.helidon.webserver.spi.ProtocolConfig;
        +import io.helidon.webserver.spi.ProtocolConfigProvider;
        +import io.helidon.webserver.spi.ServerConnectionSelector;
         
         /**
          * Configuration of a server listener (server socket).
        @@ -72,7 +72,7 @@ interface ListenerConfigBlueprint {
             List protocols();
         
             /**
        -     * Http routing. This will always be added to the resulting {@link io.helidon.nima.webserver.Router}, if defined,
        +     * Http routing. This will always be added to the resulting {@link io.helidon.webserver.Router}, if defined,
              *  overriding any HTTP routing already present.
              * If a custom listener has routing defined, it will be used, otherwise routing defined on web server will be used.
              *
        @@ -132,8 +132,8 @@ interface ListenerConfigBlueprint {
         
             /**
              * Maximal number of bytes an entity may have.
        -     * If {@link io.helidon.common.http.Http.HeaderNames#CONTENT_LENGTH} is used, this is checked immediately,
        -     * if {@link io.helidon.common.http.Http.Headers#TRANSFER_ENCODING_CHUNKED} is used, we will fail when the
        +     * If {@link io.helidon.http.Http.HeaderNames#CONTENT_LENGTH} is used, this is checked immediately,
        +     * if {@link io.helidon.http.Http.Headers#TRANSFER_ENCODING_CHUNKED} is used, we will fail when the
              * number of bytes read would exceed the max payload size.
              * Defaults to unlimited ({@code -1}).
              *
        @@ -193,7 +193,7 @@ interface ListenerConfigBlueprint {
             Optional tls();
         
             /**
        -     * Configure the listener specific {@link io.helidon.nima.http.encoding.ContentEncodingContext}.
        +     * Configure the listener specific {@link io.helidon.http.encoding.ContentEncodingContext}.
              * This method discards all previously registered ContentEncodingContext.
              * If no content encoding context is registered, content encoding context of the webserver would be used.
              *
        @@ -203,7 +203,7 @@ interface ListenerConfigBlueprint {
             Optional contentEncoding();
         
             /**
        -     * Configure the listener specific {@link io.helidon.nima.http.media.MediaContext}.
        +     * Configure the listener specific {@link io.helidon.http.media.MediaContext}.
              * This method discards all previously registered MediaContext.
              * If no media context is registered, media context of the webserver would be used.
              *
        diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/ListenerContext.java b/webserver/webserver/src/main/java/io/helidon/webserver/ListenerContext.java
        similarity index 90%
        rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/ListenerContext.java
        rename to webserver/webserver/src/main/java/io/helidon/webserver/ListenerContext.java
        index 1bdb44c0697..22f43d646a9 100644
        --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/ListenerContext.java
        +++ b/webserver/webserver/src/main/java/io/helidon/webserver/ListenerContext.java
        @@ -14,14 +14,14 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.webserver;
        +package io.helidon.webserver;
         
         import java.util.concurrent.ExecutorService;
         
         import io.helidon.common.context.Context;
        -import io.helidon.nima.http.encoding.ContentEncodingContext;
        -import io.helidon.nima.http.media.MediaContext;
        -import io.helidon.nima.webserver.http.DirectHandlers;
        +import io.helidon.http.encoding.ContentEncodingContext;
        +import io.helidon.http.media.MediaContext;
        +import io.helidon.webserver.http.DirectHandlers;
         
         /**
          * Listener context.
        diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/LoomServer.java b/webserver/webserver/src/main/java/io/helidon/webserver/LoomServer.java
        similarity index 96%
        rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/LoomServer.java
        rename to webserver/webserver/src/main/java/io/helidon/webserver/LoomServer.java
        index d2a55ccb3fa..438c25ac318 100644
        --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/LoomServer.java
        +++ b/webserver/webserver/src/main/java/io/helidon/webserver/LoomServer.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.webserver;
        +package io.helidon.webserver;
         
         import java.lang.management.ManagementFactory;
         import java.util.ArrayList;
        @@ -45,15 +45,15 @@
         import io.helidon.common.context.Context;
         import io.helidon.common.features.HelidonFeatures;
         import io.helidon.common.features.api.HelidonFlavor;
        +import io.helidon.common.tls.Tls;
        +import io.helidon.http.encoding.ContentEncodingContext;
        +import io.helidon.http.media.MediaContext;
         import io.helidon.inject.api.ServiceProvider;
         import io.helidon.inject.api.Startable;
         import io.helidon.inject.configdriven.api.ConfigDriven;
        -import io.helidon.nima.common.tls.Tls;
        -import io.helidon.nima.http.encoding.ContentEncodingContext;
        -import io.helidon.nima.http.media.MediaContext;
        -import io.helidon.nima.webserver.http.DirectHandlers;
        -import io.helidon.nima.webserver.http.HttpFeature;
        -import io.helidon.nima.webserver.http.HttpRouting;
        +import io.helidon.webserver.http.DirectHandlers;
        +import io.helidon.webserver.http.HttpFeature;
        +import io.helidon.webserver.http.HttpRouting;
         
         import jakarta.annotation.PreDestroy;
         import jakarta.inject.Inject;
        @@ -274,7 +274,7 @@ private void stopIt() {
         
                 running.set(false);
         
        -        LOGGER.log(System.Logger.Level.INFO, "Níma server stopped all channels.");
        +        LOGGER.log(System.Logger.Level.INFO, "Helidon WebServer stopped all channels.");
                 deregisterShutdownHook();
             }
         
        @@ -284,7 +284,7 @@ private void startIt() {
                 SerializationConfig.configureRuntime();
                 boolean result = parallel("start", ServerListener::start);
                 if (!result) {
        -            LOGGER.log(System.Logger.Level.ERROR, "Níma server failed to start, shutting down");
        +            LOGGER.log(System.Logger.Level.ERROR, "Helidon WebServer failed to start, shutting down");
                     parallel("stop", ServerListener::stop);
                     if (startFutures != null) {
                         startFutures.forEach(future -> future.future().cancel(true));
        @@ -319,7 +319,7 @@ private void registerShutdownHook() {
                     running.set(false);
         
                     LOGGER.log(System.Logger.Level.INFO, "Shutdown finished");
        -        }, "nima-shutdown-hook");
        +        }, "webserver-shutdown-hook");
         
                 Runtime.getRuntime().addShutdownHook(shutdownHook);
                 // we also need to keep the logging system active until the shutdown hook completes
        diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/NoopSemaphore.java b/webserver/webserver/src/main/java/io/helidon/webserver/NoopSemaphore.java
        similarity index 98%
        rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/NoopSemaphore.java
        rename to webserver/webserver/src/main/java/io/helidon/webserver/NoopSemaphore.java
        index a5762ff3069..a20c8790089 100644
        --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/NoopSemaphore.java
        +++ b/webserver/webserver/src/main/java/io/helidon/webserver/NoopSemaphore.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.webserver;
        +package io.helidon.webserver;
         
         import java.util.Collection;
         import java.util.Set;
        diff --git a/webserver/webserver/src/main/java/io/helidon/webserver/ProtocolConfigs.java b/webserver/webserver/src/main/java/io/helidon/webserver/ProtocolConfigs.java
        new file mode 100644
        index 00000000000..4b5c73c1d85
        --- /dev/null
        +++ b/webserver/webserver/src/main/java/io/helidon/webserver/ProtocolConfigs.java
        @@ -0,0 +1,67 @@
        +/*
        + * Copyright (c) 2023 Oracle and/or its affiliates.
        + *
        + * Licensed under the Apache License, Version 2.0 (the "License");
        + * you may not use this file except in compliance with the License.
        + * You may obtain a copy of the License at
        + *
        + *     http://www.apache.org/licenses/LICENSE-2.0
        + *
        + * Unless required by applicable law or agreed to in writing, software
        + * distributed under the License is distributed on an "AS IS" BASIS,
        + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        + * See the License for the specific language governing permissions and
        + * limitations under the License.
        + */
        +
        +package io.helidon.webserver;
        +
        +import java.util.List;
        +import java.util.Objects;
        +
        +import io.helidon.webserver.spi.ProtocolConfig;
        +
        +/**
        + * Protocol configuration to obtain explicitly configured details for the current socket.
        + */
        +public class ProtocolConfigs {
        +    private final List protocolConfigs;
        +
        +    private ProtocolConfigs(List protocolConfigs) {
        +        this.protocolConfigs = List.copyOf(protocolConfigs);
        +    }
        +
        +    /**
        +     * Create new protocol configuration handler.
        +     *
        +     * @param protocolConfigs all available protocol configurations.
        +     * @return protocol configuration handler
        +     */
        +    public static ProtocolConfigs create(List protocolConfigs) {
        +        Objects.requireNonNull(protocolConfigs);
        +        return new ProtocolConfigs(protocolConfigs);
        +    }
        +
        +    /**
        +     * Get a protocol configuration if defined.
        +     *
        +     * @param protocolType type of the protocol, to distinguish between protocols
        +     *                     (two protocols may use the same configuration class)
        +     * @param protocolConfigType type of the expected configuration (same protocol type may use different configuration
        +     *                           class)
        +
        +     * @return protocol configuration(s) to use, if empty, this protocol should not be used
        +     * @param  type of the expected protocol configuration
        +     */
        +    public  List config(String protocolType,
        +                                                     Class protocolConfigType) {
        +        Objects.requireNonNull(protocolType);
        +        Objects.requireNonNull(protocolConfigType);
        +
        +        return protocolConfigs.stream()
        +                .filter(it -> protocolType.equals(it.type()))
        +                .filter(it -> protocolConfigType.isAssignableFrom(it.getClass()))
        +                .map(protocolConfigType::cast)
        +                .toList();
        +    }
        +}
        diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/Route.java b/webserver/webserver/src/main/java/io/helidon/webserver/Route.java
        similarity index 87%
        rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/Route.java
        rename to webserver/webserver/src/main/java/io/helidon/webserver/Route.java
        index b089db90ad3..14a259e1a06 100644
        --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/Route.java
        +++ b/webserver/webserver/src/main/java/io/helidon/webserver/Route.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2022 Oracle and/or its affiliates.
        + * Copyright (c) 2022, 2023 Oracle and/or its affiliates.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.webserver;
        +package io.helidon.webserver;
         
         /**
          * A route.
        diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/Router.java b/webserver/webserver/src/main/java/io/helidon/webserver/Router.java
        similarity index 94%
        rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/Router.java
        rename to webserver/webserver/src/main/java/io/helidon/webserver/Router.java
        index 358298d2f05..f12f607aa60 100644
        --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/Router.java
        +++ b/webserver/webserver/src/main/java/io/helidon/webserver/Router.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.webserver;
        +package io.helidon.webserver;
         
         import java.util.List;
         import java.util.function.Supplier;
        @@ -76,7 +76,7 @@ interface Builder extends RouterBuilder, io.helidon.common.Builder type of the builder
              */
        @@ -84,7 +84,7 @@ interface RouterBuilder> {
                 /**
                  * Add a new routing to this router.
                  *
        -         * @param routing routing to add, such as {@code io.helidon.nima.webserver.http.HttpRouting}
        +         * @param routing routing to add, such as {@code io.helidon.webserver.http.HttpRouting}
                  * @return updated builder
                  */
                 B addRouting(Routing routing);
        @@ -92,7 +92,7 @@ interface RouterBuilder> {
                 /**
                  * Add a new routing to this router.
                  *
        -         * @param routing routing to add, such as {@code io.helidon.nima.webserver.http.HttpRouting}
        +         * @param routing routing to add, such as {@code io.helidon.webserver.http.HttpRouting}
                  * @return updated builder
                  */
                 default B addRouting(Supplier routing) {
        diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/RouterImpl.java b/webserver/webserver/src/main/java/io/helidon/webserver/RouterImpl.java
        similarity index 98%
        rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/RouterImpl.java
        rename to webserver/webserver/src/main/java/io/helidon/webserver/RouterImpl.java
        index ebee8a08907..cf51f8d0936 100644
        --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/RouterImpl.java
        +++ b/webserver/webserver/src/main/java/io/helidon/webserver/RouterImpl.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.webserver;
        +package io.helidon.webserver;
         
         import java.util.IdentityHashMap;
         import java.util.List;
        diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/Routing.java b/webserver/webserver/src/main/java/io/helidon/webserver/Routing.java
        similarity index 88%
        rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/Routing.java
        rename to webserver/webserver/src/main/java/io/helidon/webserver/Routing.java
        index d4c84842921..855ec116e81 100644
        --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/Routing.java
        +++ b/webserver/webserver/src/main/java/io/helidon/webserver/Routing.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2022 Oracle and/or its affiliates.
        + * Copyright (c) 2022, 2023 Oracle and/or its affiliates.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.webserver;
        +package io.helidon.webserver;
         
         /**
          * Routing abstraction.
        diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/ServerLifecycle.java b/webserver/webserver/src/main/java/io/helidon/webserver/ServerLifecycle.java
        similarity index 90%
        rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/ServerLifecycle.java
        rename to webserver/webserver/src/main/java/io/helidon/webserver/ServerLifecycle.java
        index 347c495fd78..02cf70145ae 100644
        --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/ServerLifecycle.java
        +++ b/webserver/webserver/src/main/java/io/helidon/webserver/ServerLifecycle.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2022 Oracle and/or its affiliates.
        + * Copyright (c) 2022, 2023 Oracle and/or its affiliates.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.webserver;
        +package io.helidon.webserver;
         
         /**
          * Basic server lifecycle operations.
        diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/ServerListener.java b/webserver/webserver/src/main/java/io/helidon/webserver/ServerListener.java
        similarity index 96%
        rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/ServerListener.java
        rename to webserver/webserver/src/main/java/io/helidon/webserver/ServerListener.java
        index 8ea5c5dead1..73741be77fa 100644
        --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/ServerListener.java
        +++ b/webserver/webserver/src/main/java/io/helidon/webserver/ServerListener.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.webserver;
        +package io.helidon.webserver;
         
         import java.io.IOException;
         import java.io.UncheckedIOException;
        @@ -52,15 +52,15 @@
         import io.helidon.common.socket.SocketOptions;
         import io.helidon.common.socket.TlsSocket;
         import io.helidon.common.task.HelidonTaskExecutor;
        -import io.helidon.nima.common.tls.Tls;
        -import io.helidon.nima.http.encoding.ContentEncodingContext;
        -import io.helidon.nima.http.media.MediaContext;
        -import io.helidon.nima.webserver.http.DirectHandlers;
        -import io.helidon.nima.webserver.http.HttpRouting;
        -import io.helidon.nima.webserver.spi.ProtocolConfig;
        -import io.helidon.nima.webserver.spi.ServerConnection;
        -import io.helidon.nima.webserver.spi.ServerConnectionSelector;
        -import io.helidon.nima.webserver.spi.ServerConnectionSelectorProvider;
        +import io.helidon.common.tls.Tls;
        +import io.helidon.http.encoding.ContentEncodingContext;
        +import io.helidon.http.media.MediaContext;
        +import io.helidon.webserver.http.DirectHandlers;
        +import io.helidon.webserver.http.HttpRouting;
        +import io.helidon.webserver.spi.ProtocolConfig;
        +import io.helidon.webserver.spi.ServerConnection;
        +import io.helidon.webserver.spi.ServerConnectionSelector;
        +import io.helidon.webserver.spi.ServerConnectionSelectorProvider;
         
         import static java.lang.System.Logger.Level.DEBUG;
         import static java.lang.System.Logger.Level.ERROR;
        diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/ThreadPerTaskExecutor.java b/webserver/webserver/src/main/java/io/helidon/webserver/ThreadPerTaskExecutor.java
        similarity index 99%
        rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/ThreadPerTaskExecutor.java
        rename to webserver/webserver/src/main/java/io/helidon/webserver/ThreadPerTaskExecutor.java
        index 6cec35ab8c9..f8c6c0902b0 100644
        --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/ThreadPerTaskExecutor.java
        +++ b/webserver/webserver/src/main/java/io/helidon/webserver/ThreadPerTaskExecutor.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.webserver;
        +package io.helidon.webserver;
         
         import java.util.Map;
         import java.util.Objects;
        diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/WebServer.java b/webserver/webserver/src/main/java/io/helidon/webserver/WebServer.java
        similarity index 97%
        rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/WebServer.java
        rename to webserver/webserver/src/main/java/io/helidon/webserver/WebServer.java
        index 8a80017b68a..3d397dcdc3b 100644
        --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/WebServer.java
        +++ b/webserver/webserver/src/main/java/io/helidon/webserver/WebServer.java
        @@ -14,14 +14,14 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.webserver;
        +package io.helidon.webserver;
         
         import java.util.function.Consumer;
         
         import io.helidon.builder.api.RuntimeType;
         import io.helidon.common.context.Context;
        +import io.helidon.common.tls.Tls;
         import io.helidon.inject.api.Contract;
        -import io.helidon.nima.common.tls.Tls;
         
         /**
          * Server that opens server sockets and handles requests through routing.
        @@ -70,7 +70,7 @@ static WebServerConfig.Builder builder() {
             /**
              * Starts the server. Has no effect if server is running.
              * The start will fail on a server that is shut down, or that failed to start.
        -     * In such cases, create a new instance of Web Server.
        +     * In such cases, create a new instance of WebServer.
              *
              * @return a started server
              * @throws IllegalStateException when startup fails, in such a case all channels are shut down
        diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/WebServerConfigBlueprint.java b/webserver/webserver/src/main/java/io/helidon/webserver/WebServerConfigBlueprint.java
        similarity index 91%
        rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/WebServerConfigBlueprint.java
        rename to webserver/webserver/src/main/java/io/helidon/webserver/WebServerConfigBlueprint.java
        index 7a100a4602b..3aa72153e2d 100644
        --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/WebServerConfigBlueprint.java
        +++ b/webserver/webserver/src/main/java/io/helidon/webserver/WebServerConfigBlueprint.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.webserver;
        +package io.helidon.webserver;
         
         import java.util.Map;
         import java.util.Optional;
        @@ -28,7 +28,7 @@
         
         /**
          * WebServer configuration bean.
        - * See {@link io.helidon.nima.webserver.WebServer#create(java.util.function.Consumer)}.
        + * See {@link WebServer#create(java.util.function.Consumer)}.
          */
         @Prototype.Blueprint(decorator = WebServerConfigBlueprint.ServerConfigDecorator.class)
         @Configured(root = true, prefix = "server")
        @@ -46,7 +46,7 @@ interface WebServerConfigBlueprint extends ListenerConfigBlueprint, Prototype.Fa
         
             /**
              * Socket configurations.
        -     * Note that socket named {@value io.helidon.nima.webserver.WebServer#DEFAULT_SOCKET_NAME} cannot be used,
        +     * Note that socket named {@value WebServer#DEFAULT_SOCKET_NAME} cannot be used,
              * configure the values on the server directly.
              *
              * @return map of listener configurations, except for the default one
        diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/DefaultServerSecurity.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/DefaultServerSecurity.java
        similarity index 85%
        rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/DefaultServerSecurity.java
        rename to webserver/webserver/src/main/java/io/helidon/webserver/http/DefaultServerSecurity.java
        index 6f9ce94c881..bcc3d6ff560 100644
        --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/DefaultServerSecurity.java
        +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/DefaultServerSecurity.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2022 Oracle and/or its affiliates.
        + * Copyright (c) 2022, 2023 Oracle and/or its affiliates.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        @@ -14,14 +14,14 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.webserver.http;
        +package io.helidon.webserver.http;
         
         import java.util.Arrays;
         
        -import io.helidon.common.http.ForbiddenException;
        -import io.helidon.common.http.Http;
        -import io.helidon.common.http.HttpException;
        -import io.helidon.common.http.UnauthorizedException;
        +import io.helidon.http.ForbiddenException;
        +import io.helidon.http.Http;
        +import io.helidon.http.HttpException;
        +import io.helidon.http.UnauthorizedException;
         
         import static java.lang.System.Logger.Level.DEBUG;
         
        diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/DirectHandlers.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/DirectHandlers.java
        similarity index 94%
        rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/DirectHandlers.java
        rename to webserver/webserver/src/main/java/io/helidon/webserver/http/DirectHandlers.java
        index 0611d5fcbaa..6dec28abcb8 100644
        --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/DirectHandlers.java
        +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/DirectHandlers.java
        @@ -14,16 +14,16 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.webserver.http;
        +package io.helidon.webserver.http;
         
         import java.util.EnumMap;
         import java.util.Map;
         
        -import io.helidon.common.http.DirectHandler;
        -import io.helidon.common.http.DirectHandler.EventType;
        -import io.helidon.common.http.Http;
        -import io.helidon.common.http.RequestException;
        -import io.helidon.nima.webserver.CloseConnectionException;
        +import io.helidon.http.DirectHandler;
        +import io.helidon.http.DirectHandler.EventType;
        +import io.helidon.http.Http;
        +import io.helidon.http.RequestException;
        +import io.helidon.webserver.CloseConnectionException;
         
         import static java.lang.System.Logger.Level.WARNING;
         
        diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/DirectTransportRequest.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/DirectTransportRequest.java
        similarity index 87%
        rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/DirectTransportRequest.java
        rename to webserver/webserver/src/main/java/io/helidon/webserver/http/DirectTransportRequest.java
        index 554a67d9f9a..115efe91432 100644
        --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/DirectTransportRequest.java
        +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/DirectTransportRequest.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2022 Oracle and/or its affiliates.
        + * Copyright (c) 2022, 2023 Oracle and/or its affiliates.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        @@ -14,16 +14,16 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.webserver.http;
        +package io.helidon.webserver.http;
         
        -import io.helidon.common.http.DirectHandler;
        -import io.helidon.common.http.Headers;
        -import io.helidon.common.http.HttpPrologue;
        -import io.helidon.common.http.ServerRequestHeaders;
        -import io.helidon.common.http.WritableHeaders;
        +import io.helidon.http.DirectHandler;
        +import io.helidon.http.Headers;
        +import io.helidon.http.HttpPrologue;
        +import io.helidon.http.ServerRequestHeaders;
        +import io.helidon.http.WritableHeaders;
         
         /**
        - * Simple request to use with {@link io.helidon.common.http.RequestException}.
        + * Simple request to use with {@link io.helidon.http.RequestException}.
          */
         public class DirectTransportRequest implements DirectHandler.TransportRequest {
             private final String version;
        diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/ErrorHandler.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/ErrorHandler.java
        similarity index 80%
        rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/ErrorHandler.java
        rename to webserver/webserver/src/main/java/io/helidon/webserver/http/ErrorHandler.java
        index f33f0ac4946..6bda16dbb17 100644
        --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/ErrorHandler.java
        +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/ErrorHandler.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2022 Oracle and/or its affiliates.
        + * Copyright (c) 2022, 2023 Oracle and/or its affiliates.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        @@ -14,14 +14,14 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.webserver.http;
        +package io.helidon.webserver.http;
         
         /**
          * The routing error handler.
        - * Can be mapped to the error cause in {@link io.helidon.nima.webserver.http.HttpRouting}.
        + * Can be mapped to the error cause in {@link HttpRouting}.
          *
          * @param  type of throwable handled by this handler
        - * @see io.helidon.nima.webserver.http.HttpRouting.Builder#error(Class, ErrorHandler)
        + * @see io.helidon.webserver.http.HttpRouting.Builder#error(Class, ErrorHandler)
          */
         @FunctionalInterface
         public interface ErrorHandler {
        diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/ErrorHandlers.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/ErrorHandlers.java
        similarity index 95%
        rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/ErrorHandlers.java
        rename to webserver/webserver/src/main/java/io/helidon/webserver/http/ErrorHandlers.java
        index da0d8e25a28..2e412435991 100644
        --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/ErrorHandlers.java
        +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/ErrorHandlers.java
        @@ -14,7 +14,7 @@
          * limitations under the License.
          */
         
        -package io.helidon.nima.webserver.http;
        +package io.helidon.webserver.http;
         
         import java.io.UncheckedIOException;
         import java.net.SocketException;
        @@ -23,14 +23,14 @@
         import java.util.Optional;
         import java.util.concurrent.Callable;
         
        -import io.helidon.common.http.BadRequestException;
        -import io.helidon.common.http.DirectHandler;
        -import io.helidon.common.http.Http;
        -import io.helidon.common.http.HttpException;
        -import io.helidon.common.http.InternalServerException;
        -import io.helidon.common.http.RequestException;
        -import io.helidon.nima.webserver.CloseConnectionException;
        -import io.helidon.nima.webserver.ConnectionContext;
        +import io.helidon.http.BadRequestException;
        +import io.helidon.http.DirectHandler;
        +import io.helidon.http.Http;
        +import io.helidon.http.HttpException;
        +import io.helidon.http.InternalServerException;
        +import io.helidon.http.RequestException;
        +import io.helidon.webserver.CloseConnectionException;
        +import io.helidon.webserver.ConnectionContext;
         
         /**
          * Http routing Error handlers.
        diff --git a/webserver/webserver/src/main/java/io/helidon/webserver/http/Filter.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/Filter.java
        new file mode 100644
        index 00000000000..d347ae3ff59
        --- /dev/null
        +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/Filter.java
        @@ -0,0 +1,45 @@
        +/*
        + * Copyright (c) 2022, 2023 Oracle and/or its affiliates.
        + *
        + * Licensed under the Apache License, Version 2.0 (the "License");
        + * you may not use this file except in compliance with the License.
        + * You may obtain a copy of the License at
        + *
        + *     http://www.apache.org/licenses/LICENSE-2.0
        + *
        + * Unless required by applicable law or agreed to in writing, software
        + * distributed under the License is distributed on an "AS IS" BASIS,
        + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        + * See the License for the specific language governing permissions and
        + * limitations under the License.
        + */
        +
        +package io.helidon.webserver.http;
        +
        +import io.helidon.webserver.ServerLifecycle;
        +
        +/**
        + * HTTP filter.
        + */
        +public interface Filter extends ServerLifecycle {
        +    /**
        +     * Handle a request.
        +     * If request processing should be terminated, do not call {@link FilterChain#proceed()}.
        +     * If request processing should continue with next filter,
        +     * call {@link FilterChain#proceed()}.
        +     * {@link FilterChain#proceed()} may throw an exception. The following exceptions
        +     * mean the connection will close (and the request cannot finish):
        +     * 
          + *
        • {@link io.helidon.webserver.CloseConnectionException}
        • + *
        • {@link java.io.UncheckedIOException}
        • + *
        + * Filters may throw {@link io.helidon.http.HttpException} (or its subclasses), all filters before the current + * filter will not receive such an exception - it will be processed before the method + * {@link FilterChain#proceed()} returns. + * + * @param chain to proceed with further filters (or routing if this is the last filter) + * @param req routing request + * @param res routing response + */ + void filter(FilterChain chain, RoutingRequest req, RoutingResponse res); +} diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/FilterChain.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/FilterChain.java similarity index 89% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/FilterChain.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http/FilterChain.java index cd460356962..261139c5b00 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/FilterChain.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/FilterChain.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http; +package io.helidon.webserver.http; /** * Filter chain contains all subsequent filters that are configured, as well as the final route. diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/Filters.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/Filters.java similarity index 92% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/Filters.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http/Filters.java index 0dbdd88fcdf..032c65ec16b 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/Filters.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/Filters.java @@ -14,19 +14,19 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http; +package io.helidon.webserver.http; import java.util.Iterator; import java.util.List; import java.util.concurrent.Callable; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpException; -import io.helidon.common.http.RoutedPath; import io.helidon.common.parameters.Parameters; import io.helidon.common.uri.UriPath; -import io.helidon.nima.webserver.ConnectionContext; -import io.helidon.nima.webserver.ServerLifecycle; +import io.helidon.http.Http; +import io.helidon.http.HttpException; +import io.helidon.http.RoutedPath; +import io.helidon.webserver.ConnectionContext; +import io.helidon.webserver.ServerLifecycle; /** * Handler of HTTP filters. @@ -121,8 +121,8 @@ public void proceed() { errorHandlers.runWithErrorHandling(ctx, request, response, routingExecutor); if (!response.isSent()) { // intentionally not using InternalServerException, as we do not have a cause - throw new HttpException("Routing finished but response was not sent. Níma does not support asynchronous" - + " responses. Please block until a response can be sent.", + throw new HttpException("Routing finished but response was not sent. Helidon WebServer does not support " + + "asynchronous responses. Please block until a response can be sent.", Http.Status.INTERNAL_SERVER_ERROR_500); } } diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/GeneratedHandler.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/GeneratedHandler.java similarity index 86% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/GeneratedHandler.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http/GeneratedHandler.java index 39c85def981..432ae3fe87b 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/GeneratedHandler.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/GeneratedHandler.java @@ -14,17 +14,17 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http; +package io.helidon.webserver.http; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import io.helidon.inject.api.Contract; /** * This class is only used by generated code. * * @deprecated please do not use directly, designed for generated code - * @see io.helidon.nima.webserver.http1.Http1Route - * @see io.helidon.nima.webserver.http.Handler + * @see io.helidon.webserver.http1.Http1Route + * @see Handler */ @Deprecated(since = "4.0.0") @Contract diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/Handler.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/Handler.java similarity index 94% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/Handler.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http/Handler.java index 1f50ecd1255..95a09023d42 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/Handler.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/Handler.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http; +package io.helidon.webserver.http; import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; -import io.helidon.nima.webserver.ServerLifecycle; +import io.helidon.webserver.ServerLifecycle; /** * Handle a server request and server response. @@ -29,7 +29,7 @@ */ public interface Handler extends ServerLifecycle { /** - * Create a handler that only runs code and returns {@link io.helidon.common.http.Http.Status#OK_200}. + * Create a handler that only runs code and returns {@link io.helidon.http.Http.Status#OK_200}. * * @param handler runnable to run * @return handler @@ -42,7 +42,7 @@ static Handler create(Runnable handler) { } /** - * Create a handler that consumes a {@link ServerRequest} and returns {@link io.helidon.common.http.Http.Status#OK_200}. + * Create a handler that consumes a {@link ServerRequest} and returns {@link io.helidon.http.Http.Status#OK_200}. * * @param handler consumer of request * @return handler @@ -96,7 +96,7 @@ static Handler create(Class type, Function handler) { } /** - * Create a handler that consumes typed request entity and sends {@link io.helidon.common.http.Http.Status#OK_200}. + * Create a handler that consumes typed request entity and sends {@link io.helidon.http.Http.Status#OK_200}. * * @param type type of request entity * @param handler consumer of request entity diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpFeature.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/HttpFeature.java similarity index 82% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpFeature.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http/HttpFeature.java index e5beab85a9c..b4d1da85c91 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpFeature.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/HttpFeature.java @@ -14,20 +14,20 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http; +package io.helidon.webserver.http; import java.util.function.Supplier; import io.helidon.inject.api.Contract; -import io.helidon.nima.webserver.ServerLifecycle; -import io.helidon.nima.webserver.WebServer; +import io.helidon.webserver.ServerLifecycle; +import io.helidon.webserver.WebServer; /** - * Can be registered with {@link io.helidon.nima.webserver.http.HttpRouting.Builder#addFeature(java.util.function.Supplier)}. + * Can be registered with {@link HttpRouting.Builder#addFeature(java.util.function.Supplier)}. * Encapsulates a set of endpoints, services and/or filters. *

        - * Feature is similar to {@link io.helidon.nima.webserver.http.HttpService} but gives more freedom in setup. - * Main difference is that a feature can add {@link io.helidon.nima.webserver.http.Filter Filters} and it cannot be + * Feature is similar to {@link HttpService} but gives more freedom in setup. + * Main difference is that a feature can add {@link Filter Filters} and it cannot be * registered on a path (that is left to the discretion of the feature developer). *

        * Features are not registered immediately - each feature can define a {@link io.helidon.common.Weight} or implement diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpRequest.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/HttpRequest.java similarity index 84% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpRequest.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http/HttpRequest.java index eed3b4607a0..4c1f85fdfc3 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpRequest.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/HttpRequest.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http; +package io.helidon.webserver.http; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.ServerRequestHeaders; import io.helidon.common.socket.PeerInfo; import io.helidon.common.uri.UriInfo; import io.helidon.common.uri.UriPath; import io.helidon.common.uri.UriQuery; +import io.helidon.http.Http; +import io.helidon.http.HttpPrologue; +import io.helidon.http.ServerRequestHeaders; /** * HTTP Request. @@ -72,7 +72,7 @@ public interface HttpRequest { PeerInfo localPeer(); /** - * The content of the {@link io.helidon.common.http.Http.HeaderNames#HOST} header + * The content of the {@link io.helidon.http.Http.HeaderNames#HOST} header * or {@code authority} pseudo header (HTTP/2). * * @return authority of this request @@ -100,8 +100,8 @@ public interface HttpRequest { /** * URI as requested by the originating client (to the best of our ability to compute it). - * By default, the URI is from the {@link io.helidon.common.http.Http.HeaderNames#HOST} header on the current request. - * If requested URI discovery is enabled by configuration, additional headers (such as {@link io.helidon.common.http.Http.HeaderNames#FORWARDED}) + * By default, the URI is from the {@link io.helidon.http.Http.HeaderNames#HOST} header on the current request. + * If requested URI discovery is enabled by configuration, additional headers (such as {@link io.helidon.http.Http.HeaderNames#FORWARDED}) * may be used to derive the originally-requested URI. * * @return uri info that can be used for redirects diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpRoute.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/HttpRoute.java similarity index 88% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpRoute.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http/HttpRoute.java index 1ec8e1e28b9..8137adaeeee 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpRoute.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/HttpRoute.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,16 +14,16 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http; +package io.helidon.webserver.http; import java.util.Objects; import java.util.function.Predicate; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.PathMatcher; -import io.helidon.common.http.PathMatchers; -import io.helidon.nima.webserver.Route; +import io.helidon.http.Http; +import io.helidon.http.HttpPrologue; +import io.helidon.http.PathMatcher; +import io.helidon.http.PathMatchers; +import io.helidon.webserver.Route; /** * A basic HTTP route (should be usable by ANY HTTP protocol version). @@ -43,7 +43,7 @@ static HttpRouteImpl.Builder builder() { * * @param prologue prologue of the request * @return result of the validation - * @see io.helidon.common.http.PathMatchers.MatchResult#notAccepted() + * @see io.helidon.http.PathMatchers.MatchResult#notAccepted() */ PathMatchers.MatchResult accepts(HttpPrologue prologue); @@ -55,7 +55,7 @@ static HttpRouteImpl.Builder builder() { Handler handler(); /** - * Fluent API builder for {@link io.helidon.nima.webserver.http.HttpRoute}. + * Fluent API builder for {@link HttpRoute}. */ class Builder implements io.helidon.common.Builder { private Predicate methodPredicate = Http.Method.predicate(); diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpRouteBase.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/HttpRouteBase.java similarity index 84% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpRouteBase.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http/HttpRouteBase.java index d4ab0d4f116..412c4b68cd5 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpRouteBase.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/HttpRouteBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http; +package io.helidon.webserver.http; import java.util.List; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.PathMatchers; +import io.helidon.http.HttpPrologue; +import io.helidon.http.PathMatchers; abstract class HttpRouteBase implements HttpRoute { PathMatchers.PrefixMatchResult acceptsPrefix(HttpPrologue prologue) { diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpRouteImpl.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/HttpRouteImpl.java similarity index 86% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpRouteImpl.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http/HttpRouteImpl.java index aa7a02885ab..1f9343f6026 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpRouteImpl.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/HttpRouteImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http; +package io.helidon.webserver.http; import java.util.function.Predicate; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.PathMatcher; -import io.helidon.common.http.PathMatchers; +import io.helidon.http.Http; +import io.helidon.http.HttpPrologue; +import io.helidon.http.PathMatcher; +import io.helidon.http.PathMatchers; class HttpRouteImpl extends HttpRouteBase implements HttpRoute { private final Handler handler; diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpRouteWrap.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/HttpRouteWrap.java similarity index 87% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpRouteWrap.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http/HttpRouteWrap.java index 6c28a315c83..837f4494618 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpRouteWrap.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/HttpRouteWrap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http; +package io.helidon.webserver.http; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.PathMatchers; +import io.helidon.http.HttpPrologue; +import io.helidon.http.PathMatchers; class HttpRouteWrap extends HttpRouteBase { private final HttpRoute route; diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpRouting.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/HttpRouting.java similarity index 96% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpRouting.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http/HttpRouting.java index e26f4bbb83f..c8fc6e3aa54 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpRouting.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/HttpRouting.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http; +package io.helidon.webserver.http; import java.util.ArrayList; import java.util.IdentityHashMap; @@ -28,16 +28,16 @@ import io.helidon.builder.api.Prototype; import io.helidon.common.Weights; -import io.helidon.common.http.DirectHandler; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpException; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.NotFoundException; -import io.helidon.common.http.PathMatcher; -import io.helidon.common.http.RequestException; -import io.helidon.nima.webserver.ConnectionContext; -import io.helidon.nima.webserver.Routing; -import io.helidon.nima.webserver.ServerLifecycle; +import io.helidon.http.DirectHandler; +import io.helidon.http.Http; +import io.helidon.http.HttpException; +import io.helidon.http.HttpPrologue; +import io.helidon.http.NotFoundException; +import io.helidon.http.PathMatcher; +import io.helidon.http.RequestException; +import io.helidon.webserver.ConnectionContext; +import io.helidon.webserver.Routing; +import io.helidon.webserver.ServerLifecycle; /** * HTTP routing. @@ -63,7 +63,7 @@ private HttpRouting(RealBuilder builder) { } /** - * Creates new instance of {@link io.helidon.nima.webserver.http.HttpRouting.Builder router builder}. + * Creates new instance of {@link HttpRouting.Builder router builder}. * * @return a new instance */ @@ -85,7 +85,7 @@ public static HttpRouting create() { } /** - * Empty routing (all requests will return {@link io.helidon.common.http.Http.Status#NOT_FOUND_404}. + * Empty routing (all requests will return {@link io.helidon.http.Http.Status#NOT_FOUND_404}. * * @return empty routing */ @@ -138,7 +138,7 @@ private enum RoutingResult { } /** - * Fluent API builder for {@link io.helidon.nima.webserver.http.HttpRouting}. + * Fluent API builder for {@link HttpRouting}. */ public interface Builder extends HttpRules, io.helidon.common.Builder { @Override @@ -391,8 +391,8 @@ default Builder route(Http.Method method, String pathPattern, Supplier handle * * @param maxReRouteCount maximum number of allowed reroutes * @return updated builder - * @see io.helidon.nima.webserver.http.ServerResponse#reroute(String) - * @see io.helidon.nima.webserver.http.ServerResponse#reroute(String, io.helidon.common.uri.UriQuery) + * @see ServerResponse#reroute(String) + * @see ServerResponse#reroute(String, io.helidon.common.uri.UriQuery) */ Builder maxReRouteCount(int maxReRouteCount); diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpRoutingFeature.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/HttpRoutingFeature.java similarity index 97% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpRoutingFeature.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http/HttpRoutingFeature.java index 5dbf441349d..a0c6d9a6728 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpRoutingFeature.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/HttpRoutingFeature.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http; +package io.helidon.webserver.http; import java.util.ArrayList; import java.util.List; diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpRules.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/HttpRules.java similarity index 96% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpRules.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http/HttpRules.java index e2aeb7972f7..16994f71924 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpRules.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/HttpRules.java @@ -14,20 +14,20 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http; +package io.helidon.webserver.http; import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Predicate; import java.util.function.Supplier; -import io.helidon.common.http.Http; -import io.helidon.common.http.PathMatcher; -import io.helidon.common.http.PathMatchers; +import io.helidon.http.Http; +import io.helidon.http.PathMatcher; +import io.helidon.http.PathMatchers; /** * HTTP Routing rules, used by both {@link HttpRouting.Builder} - * and by {@link HttpService#routing(io.helidon.nima.webserver.http.HttpRules)}. + * and by {@link HttpService#routing(HttpRules)}. */ public interface HttpRules { /** @@ -81,7 +81,7 @@ default HttpRules route(Http.Method method, String pathPattern, Handler handler) * Add a route. * * @param method HTTP method to handle - * @param pathMatcher URI path matcher, see {@link io.helidon.common.http.PathMatchers#create(String)} + * @param pathMatcher URI path matcher, see {@link io.helidon.http.PathMatchers#create(String)} * @param handler handler to process HTTP request * @return updated rules */ @@ -92,8 +92,8 @@ default HttpRules route(Http.Method method, PathMatcher pathMatcher, Handler han /** * Add a route. * - * @param methodPredicate HTTP method predicate, see {@link Http.Method#predicate(io.helidon.common.http.Http.Method...)} - * @param pathMatcher URI path matcher, see {@link io.helidon.common.http.PathMatchers#create(String)} + * @param methodPredicate HTTP method predicate, see {@link Http.Method#predicate(io.helidon.http.Http.Method...)} + * @param pathMatcher URI path matcher, see {@link io.helidon.http.PathMatchers#create(String)} * @param handler handler to process HTTP request * @return updated rules */ diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpSecurity.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/HttpSecurity.java similarity index 82% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpSecurity.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http/HttpSecurity.java index 7cc22fe35ee..4b5a6c1c555 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpSecurity.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/HttpSecurity.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http; +package io.helidon.webserver.http; -import io.helidon.common.http.ForbiddenException; -import io.helidon.common.http.UnauthorizedException; +import io.helidon.http.ForbiddenException; +import io.helidon.http.UnauthorizedException; /** * WebServer security. @@ -41,14 +41,14 @@ static HttpSecurity create() { * @param requiredHint whether authentication is expected * @return whether you should continue with other tasks in this request, if {@code false} is returned, the response * was already sent, and you should immediately return without modifying it - * @throws io.helidon.common.http.UnauthorizedException when authentication was expected but could not be resolved + * @throws io.helidon.http.UnauthorizedException when authentication was expected but could not be resolved */ boolean authenticate(ServerRequest request, ServerResponse response, boolean requiredHint) throws UnauthorizedException; /** * Authorize the current request according to security configuration. * When there is no security implementation present and there are no roles defined, this is a no-op; if roles are defined - * this method throws {@link io.helidon.common.http.ForbiddenException} by default. + * this method throws {@link io.helidon.http.ForbiddenException} by default. * * @param request server request to read data for authorization * @param response server response @@ -56,7 +56,7 @@ static HttpSecurity create() { * to support roles) * @return whether you should continue with other tasks in this request, if {@code false} is returned, the response * was already sent, and you should immediately return without modifying it - * @throws io.helidon.common.http.ForbiddenException when authorization failed and this request cannot proceed + * @throws io.helidon.http.ForbiddenException when authorization failed and this request cannot proceed */ boolean authorize(ServerRequest request, ServerResponse response, String... roleHint) throws ForbiddenException; } diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpService.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/HttpService.java similarity index 89% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpService.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http/HttpService.java index cd973e9fec3..312894f7223 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/HttpService.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/HttpService.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http; +package io.helidon.webserver.http; import java.util.function.Supplier; -import io.helidon.nima.webserver.ServerLifecycle; +import io.helidon.webserver.ServerLifecycle; /** * Encapsulates a set of {@link HttpRouting routing} rules and related logic. diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/RouteCrawler.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/RouteCrawler.java similarity index 95% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/RouteCrawler.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http/RouteCrawler.java index 91691d55a7a..3dc1c00873e 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/RouteCrawler.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/RouteCrawler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,19 +14,19 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http; +package io.helidon.webserver.http; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.PathMatchers; -import io.helidon.common.http.RoutedPath; import io.helidon.common.parameters.Parameters; import io.helidon.common.uri.UriPath; -import io.helidon.nima.webserver.ConnectionContext; +import io.helidon.http.HttpPrologue; +import io.helidon.http.PathMatchers; +import io.helidon.http.RoutedPath; +import io.helidon.webserver.ConnectionContext; class RouteCrawler { private final ConnectionContext ctx; diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/RoutingRequest.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/RoutingRequest.java similarity index 85% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/RoutingRequest.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http/RoutingRequest.java index 109a5ad86d3..eb1d6e9da7b 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/RoutingRequest.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/RoutingRequest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http; +package io.helidon.webserver.http; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.RoutedPath; +import io.helidon.http.HttpPrologue; +import io.helidon.http.RoutedPath; /** * Routing request. diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/RoutingResponse.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/RoutingResponse.java similarity index 93% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/RoutingResponse.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http/RoutingResponse.java index 42df13c2c2d..ee8995d7b6f 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/RoutingResponse.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/RoutingResponse.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http; +package io.helidon.webserver.http; -import io.helidon.common.http.HttpPrologue; +import io.helidon.http.HttpPrologue; /** * Routing response of a server. diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/SecureHandler.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/SecureHandler.java similarity index 98% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/SecureHandler.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http/SecureHandler.java index 8fd9096305a..1f812ae54fd 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/SecureHandler.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/SecureHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http; +package io.helidon.webserver.http; import java.util.Optional; diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/ServerRequest.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/ServerRequest.java similarity index 83% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/ServerRequest.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http/ServerRequest.java index 4fd3ba909ff..8e2773a0387 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/ServerRequest.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/ServerRequest.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http; +package io.helidon.webserver.http; import io.helidon.common.context.Context; -import io.helidon.common.http.RoutedPath; -import io.helidon.nima.http.media.ReadableEntity; -import io.helidon.nima.webserver.ListenerContext; +import io.helidon.http.RoutedPath; +import io.helidon.http.media.ReadableEntity; +import io.helidon.webserver.ListenerContext; /** * HTTP server request. @@ -70,7 +70,7 @@ public interface ServerRequest extends HttpRequest { /** * Context of this web server request, to set and get information. - * The context is not registered as the current context! You can use a dedicated module ({@code helidon-nima-webserver-context}) + * The context is not registered as the current context! You can use a dedicated module ({@code helidon-webserver-context}) * to add a filter that would execute all requests within a context. * * @return request context @@ -78,7 +78,7 @@ public interface ServerRequest extends HttpRequest { Context context(); /** - * Listener context. This gives access to low level tools of Helidon Níma WebServer, please use with care. + * Listener context. This gives access to low level tools of Helidon WebServer, please use with care. * * @return listener context */ @@ -88,12 +88,12 @@ public interface ServerRequest extends HttpRequest { * HTTP security associated with this listener, configured on routing. * * @return security - * @see io.helidon.nima.webserver.http.HttpRouting.Builder#security(HttpSecurity) + * @see io.helidon.webserver.http.HttpRouting.Builder#security(HttpSecurity) */ HttpSecurity security(); /** - * Whether we have already sent the {@link io.helidon.common.http.Http.Status#CONTINUE_100} when expect continue is + * Whether we have already sent the {@link io.helidon.http.Http.Status#CONTINUE_100} when expect continue is * present. This method returns {@code true} for cases where expect continue is not set. * This method returns {@code false} for requests without entity. * diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/ServerRequestEntity.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/ServerRequestEntity.java similarity index 93% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/ServerRequestEntity.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http/ServerRequestEntity.java index d442d7978ed..446e24b705c 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/ServerRequestEntity.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/ServerRequestEntity.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http; +package io.helidon.webserver.http; import java.io.InputStream; import java.util.function.Consumer; @@ -22,11 +22,11 @@ import io.helidon.common.GenericType; import io.helidon.common.buffers.BufferData; -import io.helidon.common.http.ServerRequestHeaders; -import io.helidon.nima.http.encoding.ContentDecoder; -import io.helidon.nima.http.media.MediaContext; -import io.helidon.nima.http.media.ReadableEntity; -import io.helidon.nima.http.media.ReadableEntityBase; +import io.helidon.http.ServerRequestHeaders; +import io.helidon.http.encoding.ContentDecoder; +import io.helidon.http.media.MediaContext; +import io.helidon.http.media.ReadableEntity; +import io.helidon.http.media.ReadableEntityBase; /** * Server request entity. diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/ServerResponse.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/ServerResponse.java similarity index 87% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/ServerResponse.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http/ServerResponse.java index 8a36c9ec2d2..08b916e50fc 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/ServerResponse.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/ServerResponse.java @@ -14,18 +14,18 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http; +package io.helidon.webserver.http; import java.io.OutputStream; import java.util.Optional; import io.helidon.common.GenericType; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderName; -import io.helidon.common.http.NotFoundException; -import io.helidon.common.http.ServerResponseHeaders; import io.helidon.common.uri.UriQuery; -import io.helidon.nima.webserver.http.spi.Sink; +import io.helidon.http.Http; +import io.helidon.http.Http.HeaderName; +import io.helidon.http.NotFoundException; +import io.helidon.http.ServerResponseHeaders; +import io.helidon.webserver.http.spi.Sink; /** * Http server response. @@ -58,8 +58,8 @@ default ServerResponse status(int status) { /** * Set a header. If the values are constant, please use - * {@link io.helidon.common.http.Http.Headers#create(io.helidon.common.http.Http.HeaderName, String...)} and store the header - * in a constant field and call {@link #header(io.helidon.common.http.Http.Header)}. + * {@link io.helidon.http.Http.Headers#create(io.helidon.http.Http.HeaderName, String...)} and store the header + * in a constant field and call {@link #header(io.helidon.http.Http.Header)}. * * @param name header name * @param values value(s) of the header @@ -72,7 +72,7 @@ default ServerResponse header(HeaderName name, String... values) { /** * Not optimized method for setting a header. * Use for unknown headers, where {@link HeaderName} cannot be cached. - * Use {@link #header(io.helidon.common.http.Http.Header)} or {@link #header(HeaderName, String...)} + * Use {@link #header(io.helidon.http.Http.Header)} or {@link #header(HeaderName, String...)} * otherwise. * * @param name name of the header @@ -105,14 +105,14 @@ default ServerResponse header(String name, String... values) { void send(byte[] bytes); /** - * Send an entity, a {@link io.helidon.nima.http.media.MediaContext} will be used to serialize the entity. + * Send an entity, a {@link io.helidon.http.media.MediaContext} will be used to serialize the entity. * * @param entity entity object */ void send(Object entity); /** - * Send an entity if present, throw {@link io.helidon.common.http.NotFoundException} if empty. + * Send an entity if present, throw {@link io.helidon.http.NotFoundException} if empty. * * @param entity entity as an optional */ diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/ServerResponseBase.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/ServerResponseBase.java similarity index 94% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/ServerResponseBase.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http/ServerResponseBase.java index 03117f1ec83..230e05abf48 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/ServerResponseBase.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/ServerResponseBase.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http; +package io.helidon.webserver.http; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -25,16 +25,16 @@ import io.helidon.common.GenericType; import io.helidon.common.buffers.BufferData; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpException; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.ServerRequestHeaders; import io.helidon.common.uri.UriPath; import io.helidon.common.uri.UriQuery; -import io.helidon.nima.http.encoding.ContentEncoder; -import io.helidon.nima.http.encoding.ContentEncodingContext; -import io.helidon.nima.http.media.MediaContext; -import io.helidon.nima.webserver.ConnectionContext; +import io.helidon.http.Http; +import io.helidon.http.HttpException; +import io.helidon.http.HttpPrologue; +import io.helidon.http.ServerRequestHeaders; +import io.helidon.http.encoding.ContentEncoder; +import io.helidon.http.encoding.ContentEncodingContext; +import io.helidon.http.media.MediaContext; +import io.helidon.webserver.ConnectionContext; /** * Base class for common server response tasks that can be shared across HTTP versions. diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/ServiceRoute.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/ServiceRoute.java similarity index 89% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/ServiceRoute.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http/ServiceRoute.java index 22a807bdf8c..a1f8b6a31ba 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/ServiceRoute.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/ServiceRoute.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,16 +14,16 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http; +package io.helidon.webserver.http; import java.util.List; import java.util.function.Predicate; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.PathMatcher; -import io.helidon.common.http.PathMatchers; -import io.helidon.nima.webserver.ConnectionContext; +import io.helidon.http.Http; +import io.helidon.http.HttpPrologue; +import io.helidon.http.PathMatcher; +import io.helidon.http.PathMatchers; +import io.helidon.webserver.ConnectionContext; class ServiceRoute extends HttpRouteBase implements HttpRoute { private final HttpService theService; diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/ServiceRules.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/ServiceRules.java similarity index 93% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/ServiceRules.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http/ServiceRules.java index 16d1f111ab6..afa454efdc9 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/ServiceRules.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/ServiceRules.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,16 +14,16 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http; +package io.helidon.webserver.http; import java.util.LinkedList; import java.util.List; import java.util.function.Predicate; import java.util.function.Supplier; -import io.helidon.common.http.Http; -import io.helidon.common.http.PathMatcher; -import io.helidon.common.http.PathMatchers; +import io.helidon.http.Http; +import io.helidon.http.PathMatcher; +import io.helidon.http.PathMatchers; class ServiceRules implements HttpRules { private static final Predicate ALWAYS_PREDICATE = new TruePredicate(); diff --git a/webserver/webserver/src/main/java/io/helidon/webserver/http/package-info.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/package-info.java new file mode 100644 index 00000000000..ac09b46b7ac --- /dev/null +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebServer HTTP specific APIs. + */ +package io.helidon.webserver.http; diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/spi/Sink.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/spi/Sink.java similarity index 95% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/spi/Sink.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http/spi/Sink.java index f23ca9b0161..43d1ca5c1aa 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/spi/Sink.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/spi/Sink.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http.spi; +package io.helidon.webserver.http.spi; /** * A generic sink interface to emit arbitrary events. diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/spi/SinkProvider.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/spi/SinkProvider.java similarity index 91% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/spi/SinkProvider.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http/spi/SinkProvider.java index 8b8ee7b9542..bae84c1f343 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http/spi/SinkProvider.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/spi/SinkProvider.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http.spi; +package io.helidon.webserver.http.spi; import java.util.function.BiConsumer; import io.helidon.common.GenericType; import io.helidon.common.media.type.MediaType; -import io.helidon.nima.webserver.http.ServerRequest; -import io.helidon.nima.webserver.http.ServerResponse; +import io.helidon.webserver.http.ServerRequest; +import io.helidon.webserver.http.ServerResponse; /** * {@link java.util.ServiceLoader} provider interface for {@link Sink} providers. diff --git a/webserver/webserver/src/main/java/io/helidon/webserver/http/spi/package-info.java b/webserver/webserver/src/main/java/io/helidon/webserver/http/spi/package-info.java new file mode 100644 index 00000000000..24a4b5a0f73 --- /dev/null +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http/spi/package-info.java @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebServer HTTP SPI. + * + * @see io.helidon.webserver.http.spi.SinkProvider + */ +package io.helidon.webserver.http.spi; diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/EntityStyle.java b/webserver/webserver/src/main/java/io/helidon/webserver/http1/EntityStyle.java similarity index 90% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/EntityStyle.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http1/EntityStyle.java index 065d193093b..99966fcb44e 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/EntityStyle.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http1/EntityStyle.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http1; +package io.helidon.webserver.http1; /** * Style of entity. diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1BuilderDecorator.java b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1BuilderDecorator.java similarity index 95% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1BuilderDecorator.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1BuilderDecorator.java index 686792913f1..cb3cc8ee5fd 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1BuilderDecorator.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1BuilderDecorator.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http1; +package io.helidon.webserver.http1; import io.helidon.builder.api.Prototype; -import io.helidon.common.http.RequestedUriDiscoveryContext; +import io.helidon.http.RequestedUriDiscoveryContext; class Http1BuilderDecorator implements Prototype.BuilderDecorator> { @Override diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ConfigBlueprint.java b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ConfigBlueprint.java similarity index 92% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ConfigBlueprint.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ConfigBlueprint.java index c7270aac065..6763d78ed44 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ConfigBlueprint.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ConfigBlueprint.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http1; +package io.helidon.webserver.http1; import java.util.List; import io.helidon.builder.api.Prototype; -import io.helidon.common.http.RequestedUriDiscoveryContext; import io.helidon.config.metadata.Configured; import io.helidon.config.metadata.ConfiguredOption; -import io.helidon.nima.webserver.spi.ProtocolConfig; +import io.helidon.http.RequestedUriDiscoveryContext; +import io.helidon.webserver.spi.ProtocolConfig; /** * HTTP/1.1 server configuration. @@ -94,7 +94,7 @@ interface Http1ConfigBlueprint extends ProtocolConfig { /** * Logging of received packets. Uses trace and debug levels on logger of - * {@link io.helidon.nima.webserver.http1.Http1LoggingConnectionListener} with suffix of {@code .recv`}. + * {@link Http1LoggingConnectionListener} with suffix of {@code .recv`}. * * @return {@code true} if logging should be enabled for received packets, {@code false} if no logging should be done */ @@ -103,7 +103,7 @@ interface Http1ConfigBlueprint extends ProtocolConfig { /** * Logging of sent packets. Uses trace and debug levels on logger of - * {@link io.helidon.nima.webserver.http1.Http1LoggingConnectionListener} with suffix of {@code .send`}. + * {@link Http1LoggingConnectionListener} with suffix of {@code .send`}. * * @return {@code true} if logging should be enabled for sent packets, {@code false} if no logging should be done */ diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1Connection.java b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1Connection.java similarity index 95% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1Connection.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1Connection.java index e4c3e74addc..a8bd9255e99 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1Connection.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1Connection.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http1; +package io.helidon.webserver.http1; import java.io.UncheckedIOException; import java.nio.charset.StandardCharsets; @@ -27,27 +27,27 @@ import io.helidon.common.buffers.BufferData; import io.helidon.common.buffers.DataReader; import io.helidon.common.buffers.DataWriter; -import io.helidon.common.http.BadRequestException; -import io.helidon.common.http.DirectHandler; -import io.helidon.common.http.DirectHandler.EventType; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.Headers; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.InternalServerException; -import io.helidon.common.http.RequestException; -import io.helidon.common.http.ServerRequestHeaders; -import io.helidon.common.http.ServerResponseHeaders; -import io.helidon.common.http.WritableHeaders; import io.helidon.common.mapper.MapperException; import io.helidon.common.task.InterruptableTask; -import io.helidon.nima.http.encoding.ContentDecoder; -import io.helidon.nima.http.encoding.ContentEncodingContext; -import io.helidon.nima.webserver.CloseConnectionException; -import io.helidon.nima.webserver.ConnectionContext; -import io.helidon.nima.webserver.http.DirectTransportRequest; -import io.helidon.nima.webserver.http.HttpRouting; -import io.helidon.nima.webserver.http1.spi.Http1Upgrader; -import io.helidon.nima.webserver.spi.ServerConnection; +import io.helidon.http.BadRequestException; +import io.helidon.http.DirectHandler; +import io.helidon.http.DirectHandler.EventType; +import io.helidon.http.Http; +import io.helidon.http.Http.Headers; +import io.helidon.http.HttpPrologue; +import io.helidon.http.InternalServerException; +import io.helidon.http.RequestException; +import io.helidon.http.ServerRequestHeaders; +import io.helidon.http.ServerResponseHeaders; +import io.helidon.http.WritableHeaders; +import io.helidon.http.encoding.ContentDecoder; +import io.helidon.http.encoding.ContentEncodingContext; +import io.helidon.webserver.CloseConnectionException; +import io.helidon.webserver.ConnectionContext; +import io.helidon.webserver.http.DirectTransportRequest; +import io.helidon.webserver.http.HttpRouting; +import io.helidon.webserver.http1.spi.Http1Upgrader; +import io.helidon.webserver.spi.ServerConnection; import static java.lang.System.Logger.Level.TRACE; import static java.lang.System.Logger.Level.WARNING; diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ConnectionListener.java b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ConnectionListener.java similarity index 86% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ConnectionListener.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ConnectionListener.java index 847dc61bf84..a6081ebc4ac 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ConnectionListener.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ConnectionListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http1; +package io.helidon.webserver.http1; import java.util.List; import io.helidon.common.buffers.DataListener; -import io.helidon.common.http.Headers; -import io.helidon.common.http.HttpPrologue; -import io.helidon.nima.webserver.ConnectionContext; +import io.helidon.http.Headers; +import io.helidon.http.HttpPrologue; +import io.helidon.webserver.ConnectionContext; /** * Connection listener for HTTP/1.1. diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ConnectionListenerUtil.java b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ConnectionListenerUtil.java similarity index 98% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ConnectionListenerUtil.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ConnectionListenerUtil.java index ae30cb40a2c..54ad04e666f 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ConnectionListenerUtil.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ConnectionListenerUtil.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http1; +package io.helidon.webserver.http1; import java.util.LinkedList; import java.util.List; diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ConnectionProvider.java b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ConnectionProvider.java similarity index 80% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ConnectionProvider.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ConnectionProvider.java index 4037a17fd94..b14f57112e4 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ConnectionProvider.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ConnectionProvider.java @@ -14,22 +14,22 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http1; +package io.helidon.webserver.http1; import java.util.LinkedHashMap; import java.util.List; import java.util.ServiceLoader; import io.helidon.common.HelidonServiceLoader; -import io.helidon.nima.webserver.ProtocolConfigs; -import io.helidon.nima.webserver.http1.spi.Http1UpgradeProvider; -import io.helidon.nima.webserver.http1.spi.Http1Upgrader; -import io.helidon.nima.webserver.spi.ProtocolConfig; -import io.helidon.nima.webserver.spi.ServerConnectionSelector; -import io.helidon.nima.webserver.spi.ServerConnectionSelectorProvider; +import io.helidon.webserver.ProtocolConfigs; +import io.helidon.webserver.http1.spi.Http1UpgradeProvider; +import io.helidon.webserver.http1.spi.Http1Upgrader; +import io.helidon.webserver.spi.ProtocolConfig; +import io.helidon.webserver.spi.ServerConnectionSelector; +import io.helidon.webserver.spi.ServerConnectionSelectorProvider; /** - * {@link io.helidon.nima.webserver.spi.ServerConnectionSelectorProvider} implementation for HTTP/1.1 server connection provider. + * {@link io.helidon.webserver.spi.ServerConnectionSelectorProvider} implementation for HTTP/1.1 server connection provider. */ public class Http1ConnectionProvider implements ServerConnectionSelectorProvider { @@ -40,7 +40,7 @@ public class Http1ConnectionProvider implements ServerConnectionSelectorProvider /** * Create a new instance with default configuration. - * To customize instance programmatically, use {@link io.helidon.nima.webserver.http1.Http1ConnectionSelector} + * To customize instance programmatically, use {@link Http1ConnectionSelector} * instead. * * @deprecated to be used solely by {@link java.util.ServiceLoader} diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ConnectionSelector.java b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ConnectionSelector.java similarity index 93% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ConnectionSelector.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ConnectionSelector.java index 48606874ebe..17e3af28821 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ConnectionSelector.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ConnectionSelector.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http1; +package io.helidon.webserver.http1; import java.util.Map; import java.util.Set; @@ -23,10 +23,10 @@ import io.helidon.builder.api.RuntimeType; import io.helidon.common.buffers.BufferData; import io.helidon.common.buffers.Bytes; -import io.helidon.nima.webserver.ConnectionContext; -import io.helidon.nima.webserver.http1.spi.Http1Upgrader; -import io.helidon.nima.webserver.spi.ServerConnection; -import io.helidon.nima.webserver.spi.ServerConnectionSelector; +import io.helidon.webserver.ConnectionContext; +import io.helidon.webserver.http1.spi.Http1Upgrader; +import io.helidon.webserver.spi.ServerConnection; +import io.helidon.webserver.spi.ServerConnectionSelector; /** * HTTP/1.1 server connection selector. diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ConnectionSelectorConfigBlueprint.java b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ConnectionSelectorConfigBlueprint.java similarity index 90% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ConnectionSelectorConfigBlueprint.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ConnectionSelectorConfigBlueprint.java index c46ae6982a8..edd3a6f2dea 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ConnectionSelectorConfigBlueprint.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ConnectionSelectorConfigBlueprint.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http1; +package io.helidon.webserver.http1; import java.util.Map; import io.helidon.builder.api.Prototype; -import io.helidon.nima.webserver.http1.spi.Http1Upgrader; +import io.helidon.webserver.http1.spi.Http1Upgrader; /** - * Configuration of an {@link io.helidon.nima.webserver.http1.Http1ConnectionSelector}. + * Configuration of an {@link Http1ConnectionSelector}. */ @Prototype.Blueprint @Prototype.CustomMethods(Http1ConnectionSelectorConfigBlueprint.CustomMethods.class) diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1Headers.java b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1Headers.java similarity index 85% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1Headers.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1Headers.java index d59701aee24..1934a4fd672 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1Headers.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1Headers.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http1; +package io.helidon.webserver.http1; import io.helidon.common.buffers.DataReader; -import io.helidon.common.http.DirectHandler; -import io.helidon.common.http.Http1HeadersParser; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.RequestException; -import io.helidon.common.http.WritableHeaders; -import io.helidon.nima.webserver.http.DirectTransportRequest; +import io.helidon.http.DirectHandler; +import io.helidon.http.Http1HeadersParser; +import io.helidon.http.HttpPrologue; +import io.helidon.http.RequestException; +import io.helidon.http.WritableHeaders; +import io.helidon.webserver.http.DirectTransportRequest; /** * HTTP/1 headers reader. diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1LoggingConnectionListener.java b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1LoggingConnectionListener.java similarity index 90% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1LoggingConnectionListener.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1LoggingConnectionListener.java index 05d2f14ff5b..096967cc11d 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1LoggingConnectionListener.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1LoggingConnectionListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http1; +package io.helidon.webserver.http1; import io.helidon.common.buffers.BufferData; -import io.helidon.common.http.Headers; -import io.helidon.common.http.HttpPrologue; -import io.helidon.nima.webserver.ConnectionContext; +import io.helidon.http.Headers; +import io.helidon.http.HttpPrologue; +import io.helidon.webserver.ConnectionContext; import static java.lang.System.Logger.Level.DEBUG; import static java.lang.System.Logger.Level.TRACE; diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1Prologue.java b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1Prologue.java similarity index 94% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1Prologue.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1Prologue.java index 7e0fcfd7a9e..bc4e47a5a3c 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1Prologue.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1Prologue.java @@ -14,18 +14,18 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http1; +package io.helidon.webserver.http1; import java.nio.charset.StandardCharsets; import io.helidon.common.buffers.Bytes; import io.helidon.common.buffers.DataReader; -import io.helidon.common.http.DirectHandler; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.RequestException; -import io.helidon.nima.webserver.CloseConnectionException; -import io.helidon.nima.webserver.http.DirectTransportRequest; +import io.helidon.http.DirectHandler; +import io.helidon.http.Http; +import io.helidon.http.HttpPrologue; +import io.helidon.http.RequestException; +import io.helidon.webserver.CloseConnectionException; +import io.helidon.webserver.http.DirectTransportRequest; /** * HTTP 1 prologue parsing support. diff --git a/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ProtocolConfigProvider.java b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ProtocolConfigProvider.java new file mode 100644 index 00000000000..82be2cfcc1f --- /dev/null +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ProtocolConfigProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.webserver.http1; + +import io.helidon.common.config.Config; +import io.helidon.webserver.spi.ProtocolConfigProvider; + +/** + * Implementation of a service provider interface to create HTTP/1.1 protocol configuration. + */ +public class Http1ProtocolConfigProvider implements ProtocolConfigProvider { + /** + * Required default constructor for {@link java.util.ServiceLoader}. + */ + public Http1ProtocolConfigProvider() { + } + + @Override + public String configKey() { + return Http1ConnectionProvider.CONFIG_NAME; + } + + @Override + public Http1Config create(Config config, String name) { + return Http1Config.builder() + .config(config) + .name(name) + .build(); + } +} diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1Route.java b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1Route.java similarity index 84% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1Route.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1Route.java index 1fa943a9c3a..c9a018e9dc6 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1Route.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1Route.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,20 +14,20 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http1; +package io.helidon.webserver.http1; import java.util.function.Predicate; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.PathMatcher; -import io.helidon.common.http.PathMatchers; -import io.helidon.nima.webserver.http.Handler; -import io.helidon.nima.webserver.http.HttpRoute; +import io.helidon.http.Http; +import io.helidon.http.HttpPrologue; +import io.helidon.http.PathMatcher; +import io.helidon.http.PathMatchers; +import io.helidon.webserver.http.Handler; +import io.helidon.webserver.http.HttpRoute; /** * A route for HTTP/1.1 only. - * To create a route valid for any version of HTTP, please use {@link io.helidon.nima.webserver.http.HttpRoute}. + * To create a route valid for any version of HTTP, please use {@link io.helidon.webserver.http.HttpRoute}. */ public class Http1Route implements HttpRoute { private final Predicate methodPredicate; diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ServerRequest.java b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ServerRequest.java similarity index 92% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ServerRequest.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ServerRequest.java index 6554c1f0247..fbb8ca4732a 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ServerRequest.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ServerRequest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http1; +package io.helidon.webserver.http1; import java.util.concurrent.CountDownLatch; import java.util.function.Supplier; @@ -23,20 +23,20 @@ import io.helidon.common.buffers.BufferData; import io.helidon.common.context.Context; import io.helidon.common.context.Contexts; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.RoutedPath; -import io.helidon.common.http.ServerRequestHeaders; -import io.helidon.common.http.WritableHeaders; import io.helidon.common.socket.PeerInfo; import io.helidon.common.uri.UriInfo; import io.helidon.common.uri.UriQuery; -import io.helidon.nima.http.encoding.ContentDecoder; -import io.helidon.nima.webserver.ConnectionContext; -import io.helidon.nima.webserver.ListenerContext; -import io.helidon.nima.webserver.http.HttpSecurity; -import io.helidon.nima.webserver.http.RoutingRequest; +import io.helidon.http.Headers; +import io.helidon.http.Http; +import io.helidon.http.HttpPrologue; +import io.helidon.http.RoutedPath; +import io.helidon.http.ServerRequestHeaders; +import io.helidon.http.WritableHeaders; +import io.helidon.http.encoding.ContentDecoder; +import io.helidon.webserver.ConnectionContext; +import io.helidon.webserver.ListenerContext; +import io.helidon.webserver.http.HttpSecurity; +import io.helidon.webserver.http.RoutingRequest; /** * Http 1 server request base. diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ServerRequestNoEntity.java b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ServerRequestNoEntity.java similarity index 79% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ServerRequestNoEntity.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ServerRequestNoEntity.java index 2f90afdc2fb..a8dccf27821 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ServerRequestNoEntity.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ServerRequestNoEntity.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http1; +package io.helidon.webserver.http1; -import io.helidon.common.http.Headers; -import io.helidon.common.http.HttpPrologue; -import io.helidon.nima.http.media.ReadableEntity; -import io.helidon.nima.http.media.ReadableEntityBase; -import io.helidon.nima.webserver.ConnectionContext; -import io.helidon.nima.webserver.http.HttpSecurity; +import io.helidon.http.Headers; +import io.helidon.http.HttpPrologue; +import io.helidon.http.media.ReadableEntity; +import io.helidon.http.media.ReadableEntityBase; +import io.helidon.webserver.ConnectionContext; +import io.helidon.webserver.http.HttpSecurity; class Http1ServerRequestNoEntity extends Http1ServerRequest { Http1ServerRequestNoEntity(ConnectionContext ctx, diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ServerRequestWithEntity.java b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ServerRequestWithEntity.java similarity index 89% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ServerRequestWithEntity.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ServerRequestWithEntity.java index c1743b1be88..f82db9fc2a0 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ServerRequestWithEntity.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ServerRequestWithEntity.java @@ -14,20 +14,20 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http1; +package io.helidon.webserver.http1; import java.util.concurrent.CountDownLatch; import java.util.function.Supplier; import io.helidon.common.LazyValue; import io.helidon.common.buffers.BufferData; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.ServerRequestHeaders; -import io.helidon.nima.http.encoding.ContentDecoder; -import io.helidon.nima.http.media.ReadableEntity; -import io.helidon.nima.webserver.ConnectionContext; -import io.helidon.nima.webserver.http.HttpSecurity; -import io.helidon.nima.webserver.http.ServerRequestEntity; +import io.helidon.http.HttpPrologue; +import io.helidon.http.ServerRequestHeaders; +import io.helidon.http.encoding.ContentDecoder; +import io.helidon.http.media.ReadableEntity; +import io.helidon.webserver.ConnectionContext; +import io.helidon.webserver.http.HttpSecurity; +import io.helidon.webserver.http.ServerRequestEntity; final class Http1ServerRequestWithEntity extends Http1ServerRequest { private final LazyValue entity; diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ServerResponse.java b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ServerResponse.java similarity index 95% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ServerResponse.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ServerResponse.java index 1ca41402fb0..d165b5fefdb 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/Http1ServerResponse.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1ServerResponse.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http1; +package io.helidon.webserver.http1; import java.io.BufferedOutputStream; import java.io.IOException; @@ -29,21 +29,21 @@ import io.helidon.common.HelidonServiceLoader; import io.helidon.common.buffers.BufferData; import io.helidon.common.buffers.DataWriter; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.DateTime; -import io.helidon.common.http.Http.Header; -import io.helidon.common.http.Http.HeaderName; -import io.helidon.common.http.HttpException; -import io.helidon.common.http.ServerResponseHeaders; -import io.helidon.common.http.WritableHeaders; import io.helidon.common.media.type.MediaType; import io.helidon.common.media.type.MediaTypes; -import io.helidon.nima.http.media.EntityWriter; -import io.helidon.nima.http.media.MediaContext; -import io.helidon.nima.webserver.ConnectionContext; -import io.helidon.nima.webserver.http.ServerResponseBase; -import io.helidon.nima.webserver.http.spi.Sink; -import io.helidon.nima.webserver.http.spi.SinkProvider; +import io.helidon.http.Http; +import io.helidon.http.Http.DateTime; +import io.helidon.http.Http.Header; +import io.helidon.http.Http.HeaderName; +import io.helidon.http.HttpException; +import io.helidon.http.ServerResponseHeaders; +import io.helidon.http.WritableHeaders; +import io.helidon.http.media.EntityWriter; +import io.helidon.http.media.MediaContext; +import io.helidon.webserver.ConnectionContext; +import io.helidon.webserver.http.ServerResponseBase; +import io.helidon.webserver.http.spi.Sink; +import io.helidon.webserver.http.spi.SinkProvider; /** * An HTTP/1 server response. @@ -59,6 +59,7 @@ class Http1ServerResponse extends ServerResponseBase { Http.Headers.create(Http.HeaderNames.TRAILER, STREAM_STATUS_NAME.defaultCase() + "," + STREAM_RESULT_NAME.defaultCase()); + @SuppressWarnings("rawtypes") private static final List SINK_PROVIDERS = HelidonServiceLoader.builder(ServiceLoader.load(SinkProvider.class)).build().asList(); private static final WritableHeaders EMPTY_HEADERS = WritableHeaders.create(); @@ -235,11 +236,9 @@ public void commit() { @Override @SuppressWarnings("unchecked") public > X sink(GenericType sinkType) { - for (SinkProvider p : SINK_PROVIDERS) { + for (SinkProvider p : SINK_PROVIDERS) { if (p.supports(sinkType, request)) { - return (X) p.create(this, - (e, m) -> handleSinkData(e, (MediaType) m), - this::commit); + return (X) p.create(this, this::handleSinkData, this::commit); } } // Request not acceptable if provider not found @@ -272,7 +271,7 @@ private void handleSinkData(Object data, MediaType mediaType) { } } - private static void writeHeaders(io.helidon.common.http.Headers headers, BufferData buffer, boolean validate) { + private static void writeHeaders(io.helidon.http.Headers headers, BufferData buffer, boolean validate) { if (validate) { headers.forEach(Header::validate); } @@ -281,6 +280,7 @@ private static void writeHeaders(io.helidon.common.http.Headers headers, BufferD } } + private BufferData responseBuffer(byte[] bytes) { if (isSent) { throw new IllegalStateException("Response already sent"); @@ -576,7 +576,7 @@ private void writeChunked(BufferData buffer) { dataWriter.write(toWrite); } - private void checkContentLength(BufferData buffer) throws IOException { + private void checkContentLength(BufferData ignored) throws IOException { if (bytesWritten > contentLength && contentLength != -1) { throw new IOException("Content length was set to " + contentLength + ", but you are writing additional " + (bytesWritten - contentLength) + " " diff --git a/webserver/webserver/src/main/java/io/helidon/webserver/http1/package-info.java b/webserver/webserver/src/main/java/io/helidon/webserver/http1/package-info.java new file mode 100644 index 00000000000..15c5c60400d --- /dev/null +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http1/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebServer HTTP/1.1 specific APIs. + */ +package io.helidon.webserver.http1; diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/spi/Http1UpgradeProvider.java b/webserver/webserver/src/main/java/io/helidon/webserver/http1/spi/Http1UpgradeProvider.java similarity index 91% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/spi/Http1UpgradeProvider.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http1/spi/Http1UpgradeProvider.java index 5a141caf824..d8971f6dc84 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/spi/Http1UpgradeProvider.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http1/spi/Http1UpgradeProvider.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http1.spi; +package io.helidon.webserver.http1.spi; -import io.helidon.nima.webserver.ProtocolConfigs; -import io.helidon.nima.webserver.spi.ProtocolConfig; +import io.helidon.webserver.ProtocolConfigs; +import io.helidon.webserver.spi.ProtocolConfig; /** * {@link java.util.ServiceLoader} provider interface for HTTP/1.1 connection upgrade provider. diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/spi/Http1Upgrader.java b/webserver/webserver/src/main/java/io/helidon/webserver/http1/spi/Http1Upgrader.java similarity index 82% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/spi/Http1Upgrader.java rename to webserver/webserver/src/main/java/io/helidon/webserver/http1/spi/Http1Upgrader.java index 3f8dda3c4d5..f45b2fb52ba 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/http1/spi/Http1Upgrader.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http1/spi/Http1Upgrader.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http1.spi; +package io.helidon.webserver.http1.spi; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.WritableHeaders; -import io.helidon.nima.webserver.ConnectionContext; -import io.helidon.nima.webserver.spi.ServerConnection; +import io.helidon.http.HttpPrologue; +import io.helidon.http.WritableHeaders; +import io.helidon.webserver.ConnectionContext; +import io.helidon.webserver.spi.ServerConnection; /** * HTTP/1.1 connection upgrader. @@ -39,7 +39,7 @@ public interface Http1Upgrader { * @param ctx connection context * @param prologue http prologue of the upgrade request * @param headers http headers of the upgrade request - * @return a new connection to use instead of the original {@link io.helidon.nima.webserver.http1.Http1Connection}, + * @return a new connection to use instead of the original {@link io.helidon.webserver.http1.Http1Connection}, * or {@code null} if the connection cannot be upgraded */ ServerConnection upgrade(ConnectionContext ctx, HttpPrologue prologue, WritableHeaders headers); diff --git a/webserver/webserver/src/main/java/io/helidon/webserver/http1/spi/package-info.java b/webserver/webserver/src/main/java/io/helidon/webserver/http1/spi/package-info.java new file mode 100644 index 00000000000..4388d82ddb1 --- /dev/null +++ b/webserver/webserver/src/main/java/io/helidon/webserver/http1/spi/package-info.java @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebServer HTTP/1.1 specific SPIs. + * + * @see io.helidon.webserver.http1.spi.Http1UpgradeProvider + */ +package io.helidon.webserver.http1.spi; diff --git a/webserver/webserver/src/main/java/io/helidon/webserver/package-info.java b/webserver/webserver/src/main/java/io/helidon/webserver/package-info.java new file mode 100644 index 00000000000..f355c8749ba --- /dev/null +++ b/webserver/webserver/src/main/java/io/helidon/webserver/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebServer module, combining common server API, HTTP API and HTTP/1.1 API to create a server. + */ +package io.helidon.webserver; diff --git a/webserver/webserver/src/main/java/io/helidon/webserver/spi/ProtocolConfig.java b/webserver/webserver/src/main/java/io/helidon/webserver/spi/ProtocolConfig.java new file mode 100644 index 00000000000..3d93cb137ae --- /dev/null +++ b/webserver/webserver/src/main/java/io/helidon/webserver/spi/ProtocolConfig.java @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.webserver.spi; + +import io.helidon.common.config.NamedService; + +/** + * Protocol configuration abstraction, used to setup a protocol. + */ +public interface ProtocolConfig extends NamedService { +} diff --git a/webserver/webserver/src/main/java/io/helidon/webserver/spi/ProtocolConfigProvider.java b/webserver/webserver/src/main/java/io/helidon/webserver/spi/ProtocolConfigProvider.java new file mode 100644 index 00000000000..a2cf79311ae --- /dev/null +++ b/webserver/webserver/src/main/java/io/helidon/webserver/spi/ProtocolConfigProvider.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.webserver.spi; + +import io.helidon.common.config.ConfiguredProvider; + +/** + * Provider of protocol configuration. As we use protocols from multiple places (connection selectors, upgrade from HTTP/1), + * we have a single abstraction of their configuration. + * + * @param type of configuration supported by this provider + */ +public interface ProtocolConfigProvider extends ConfiguredProvider { + +} diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/spi/ServerConnection.java b/webserver/webserver/src/main/java/io/helidon/webserver/spi/ServerConnection.java similarity index 93% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/spi/ServerConnection.java rename to webserver/webserver/src/main/java/io/helidon/webserver/spi/ServerConnection.java index 552c4cfe234..6c436a6722d 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/spi/ServerConnection.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/spi/ServerConnection.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webserver.spi; +package io.helidon.webserver.spi; import java.time.Duration; import java.util.concurrent.Semaphore; @@ -25,7 +25,7 @@ public interface ServerConnection { /** * Start handling the connection. Data is provided through - * {@link ServerConnectionSelector#connection(io.helidon.nima.webserver.ConnectionContext)}. + * {@link ServerConnectionSelector#connection(io.helidon.webserver.ConnectionContext)}. * * @param requestSemaphore semaphore that is responsible for maximal concurrent request limit, the connection implementation * is responsible for acquiring a permit from the semaphore for the duration of a request, and diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/spi/ServerConnectionSelector.java b/webserver/webserver/src/main/java/io/helidon/webserver/spi/ServerConnectionSelector.java similarity index 92% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/spi/ServerConnectionSelector.java rename to webserver/webserver/src/main/java/io/helidon/webserver/spi/ServerConnectionSelector.java index 6f62300c357..7847a9111bb 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/spi/ServerConnectionSelector.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/spi/ServerConnectionSelector.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.nima.webserver.spi; +package io.helidon.webserver.spi; import java.util.Set; import io.helidon.common.buffers.BufferData; -import io.helidon.nima.webserver.ConnectionContext; +import io.helidon.webserver.ConnectionContext; /** * Connection selector is given a chance to analyze request bytes and decide whether this is a connection it can accept. @@ -35,7 +35,7 @@ public interface ServerConnectionSelector { /** * Does this selector support current server connection. * The same buffer will be sent to - * {@link io.helidon.nima.webserver.spi.ServerConnection#handle(java.util.concurrent.Semaphore)} + * {@link ServerConnection#handle(java.util.concurrent.Semaphore)} * * @param data bytes (with available bytes of at least {@link #bytesToIdentifyConnection()}) * @return support response diff --git a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/spi/ServerConnectionSelectorProvider.java b/webserver/webserver/src/main/java/io/helidon/webserver/spi/ServerConnectionSelectorProvider.java similarity index 95% rename from nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/spi/ServerConnectionSelectorProvider.java rename to webserver/webserver/src/main/java/io/helidon/webserver/spi/ServerConnectionSelectorProvider.java index 71697152655..241d1f3e626 100644 --- a/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/spi/ServerConnectionSelectorProvider.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/spi/ServerConnectionSelectorProvider.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.helidon.nima.webserver.spi; +package io.helidon.webserver.spi; -import io.helidon.nima.webserver.ProtocolConfigs; +import io.helidon.webserver.ProtocolConfigs; /** * {@link java.util.ServiceLoader} provider interface for server connection providers. diff --git a/webserver/webserver/src/main/java/io/helidon/webserver/spi/package-info.java b/webserver/webserver/src/main/java/io/helidon/webserver/spi/package-info.java new file mode 100644 index 00000000000..af6d072b37b --- /dev/null +++ b/webserver/webserver/src/main/java/io/helidon/webserver/spi/package-info.java @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * Helidon WebServer SPI. + * + * @see io.helidon.webserver.spi.ServerConnectionSelectorProvider + */ +package io.helidon.webserver.spi; diff --git a/webserver/webserver/src/main/java/module-info.java b/webserver/webserver/src/main/java/module-info.java new file mode 100644 index 00000000000..543b51a1e1e --- /dev/null +++ b/webserver/webserver/src/main/java/module-info.java @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.common.features.api.Feature; +import io.helidon.common.features.api.HelidonFlavor; +import io.helidon.webserver.http.spi.SinkProvider; +import io.helidon.webserver.http1.Http1ConnectionProvider; +import io.helidon.webserver.http1.Http1ProtocolConfigProvider; +import io.helidon.webserver.http1.spi.Http1UpgradeProvider; +import io.helidon.webserver.spi.ProtocolConfigProvider; +import io.helidon.webserver.spi.ServerConnectionSelectorProvider; + +/** + * Helidon WebServer. + */ +@Feature(value = "WebServer", + description = "Helidon WebServer", + in = HelidonFlavor.SE +) +module io.helidon.webserver { + requires transitive io.helidon.common.buffers; + requires transitive io.helidon.common.socket; + requires transitive io.helidon.http.encoding; + requires transitive io.helidon.http.media; + requires transitive io.helidon.common.tls; + requires transitive io.helidon.config; + requires transitive io.helidon.common.context; + requires transitive io.helidon.common.security; + requires io.helidon.logging.common; + requires io.helidon.builder.api; + requires io.helidon.common.features.api; + requires io.helidon.common.features; + requires io.helidon.common.task; + + requires java.management; + // only used to keep logging active until shutdown hook finishes + requires java.logging; + + requires jakarta.annotation; + requires io.helidon.common.uri; + + requires static io.helidon.config.metadata; + requires static io.helidon.inject.configdriven.runtime; + requires static jakarta.inject; + // to compile @Generated + requires static java.compiler; + + // needed to compile injection generated classes + requires io.helidon.inject.api; + requires static io.helidon.inject.runtime; + + // provides multiple packages due to intentional cyclic dependency + // we want to support HTTP/1.1 by default (we could fully separate it, but the API would be harder to use + // for the basic routes); this would also require 4 modules (API + SPI, HTTP, HTTP/1.1, WebServer) + // and these modules would be used mostly together (both WebSocket and HTTP/2 require HTTP/1.1 to upgrade from) + exports io.helidon.webserver; + exports io.helidon.webserver.spi; + exports io.helidon.webserver.http; + exports io.helidon.webserver.http.spi; + exports io.helidon.webserver.http1; + exports io.helidon.webserver.http1.spi; + + uses Http1UpgradeProvider; + uses ServerConnectionSelectorProvider; + uses SinkProvider; + uses ProtocolConfigProvider; + + provides ProtocolConfigProvider + with Http1ProtocolConfigProvider; + provides ServerConnectionSelectorProvider with Http1ConnectionProvider; + provides io.helidon.inject.api.ModuleComponent with io.helidon.webserver.Injection$$Module; +} diff --git a/nima/webserver/webserver/src/test/java/io/helidon/nima/webserver/ListenerConfigTest.java b/webserver/webserver/src/test/java/io/helidon/webserver/ListenerConfigTest.java similarity index 98% rename from nima/webserver/webserver/src/test/java/io/helidon/nima/webserver/ListenerConfigTest.java rename to webserver/webserver/src/test/java/io/helidon/webserver/ListenerConfigTest.java index cc7b417cba5..af618e24f42 100644 --- a/nima/webserver/webserver/src/test/java/io/helidon/nima/webserver/ListenerConfigTest.java +++ b/webserver/webserver/src/test/java/io/helidon/webserver/ListenerConfigTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webserver; +package io.helidon.webserver; import io.helidon.config.Config; diff --git a/nima/webserver/webserver/src/test/java/io/helidon/nima/webserver/ThreadPerTaskExecutorTest.java b/webserver/webserver/src/test/java/io/helidon/webserver/ThreadPerTaskExecutorTest.java similarity index 99% rename from nima/webserver/webserver/src/test/java/io/helidon/nima/webserver/ThreadPerTaskExecutorTest.java rename to webserver/webserver/src/test/java/io/helidon/webserver/ThreadPerTaskExecutorTest.java index 8f7d4bd4e5c..76340ea9e03 100644 --- a/nima/webserver/webserver/src/test/java/io/helidon/nima/webserver/ThreadPerTaskExecutorTest.java +++ b/webserver/webserver/src/test/java/io/helidon/webserver/ThreadPerTaskExecutorTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.helidon.nima.webserver; +package io.helidon.webserver; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CountDownLatch; diff --git a/nima/webserver/webserver/src/test/java/io/helidon/nima/webserver/WebServerConfigDrivenTest.java b/webserver/webserver/src/test/java/io/helidon/webserver/WebServerConfigDrivenTest.java similarity index 98% rename from nima/webserver/webserver/src/test/java/io/helidon/nima/webserver/WebServerConfigDrivenTest.java rename to webserver/webserver/src/test/java/io/helidon/webserver/WebServerConfigDrivenTest.java index a036829e59e..5ae961cc649 100644 --- a/nima/webserver/webserver/src/test/java/io/helidon/nima/webserver/WebServerConfigDrivenTest.java +++ b/webserver/webserver/src/test/java/io/helidon/webserver/WebServerConfigDrivenTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webserver; +package io.helidon.webserver; import io.helidon.config.Config; import io.helidon.inject.api.Bootstrap; diff --git a/nima/webserver/webserver/src/test/java/io/helidon/nima/webserver/WebServerConfigTest.java b/webserver/webserver/src/test/java/io/helidon/webserver/WebServerConfigTest.java similarity index 96% rename from nima/webserver/webserver/src/test/java/io/helidon/nima/webserver/WebServerConfigTest.java rename to webserver/webserver/src/test/java/io/helidon/webserver/WebServerConfigTest.java index 36cfed13469..d3d0005d67a 100644 --- a/nima/webserver/webserver/src/test/java/io/helidon/nima/webserver/WebServerConfigTest.java +++ b/webserver/webserver/src/test/java/io/helidon/webserver/WebServerConfigTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.webserver; +package io.helidon.webserver; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -23,14 +23,14 @@ import java.util.NoSuchElementException; import io.helidon.common.GenericType; -import io.helidon.common.http.WritableHeaders; +import io.helidon.http.WritableHeaders; import io.helidon.config.Config; -import io.helidon.nima.http.encoding.ContentEncodingContext; -import io.helidon.nima.http.media.EntityWriter; -import io.helidon.nima.http.media.MediaContext; -import io.helidon.nima.http.media.jsonp.JsonpSupport; -import io.helidon.nima.webserver.spi.ProtocolConfig; -import io.helidon.nima.webserver.spi.ServerConnectionSelector; +import io.helidon.http.encoding.ContentEncodingContext; +import io.helidon.http.media.EntityWriter; +import io.helidon.http.media.MediaContext; +import io.helidon.http.media.jsonp.JsonpSupport; +import io.helidon.webserver.spi.ProtocolConfig; +import io.helidon.webserver.spi.ServerConnectionSelector; import jakarta.json.Json; import jakarta.json.JsonObject; diff --git a/nima/webserver/webserver/src/test/java/io/helidon/nima/webserver/http/ErrorHandlersTest.java b/webserver/webserver/src/test/java/io/helidon/webserver/http/ErrorHandlersTest.java similarity index 97% rename from nima/webserver/webserver/src/test/java/io/helidon/nima/webserver/http/ErrorHandlersTest.java rename to webserver/webserver/src/test/java/io/helidon/webserver/http/ErrorHandlersTest.java index a7f4301da25..22b44e9b365 100644 --- a/nima/webserver/webserver/src/test/java/io/helidon/nima/webserver/http/ErrorHandlersTest.java +++ b/webserver/webserver/src/test/java/io/helidon/webserver/http/ErrorHandlersTest.java @@ -14,21 +14,21 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http; +package io.helidon.webserver.http; import java.nio.charset.StandardCharsets; import java.util.Map; import java.util.Optional; import java.util.stream.Stream; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpPrologue; +import io.helidon.http.Http; +import io.helidon.http.HttpPrologue; import io.helidon.common.uri.UriFragment; import io.helidon.common.uri.UriPath; import io.helidon.common.uri.UriQuery; -import io.helidon.nima.http.media.ReadableEntityBase; -import io.helidon.nima.webserver.ConnectionContext; -import io.helidon.nima.webserver.ListenerContext; +import io.helidon.http.media.ReadableEntityBase; +import io.helidon.webserver.ConnectionContext; +import io.helidon.webserver.ListenerContext; import org.hamcrest.Matcher; import org.junit.jupiter.api.Test; diff --git a/nima/webserver/webserver/src/test/java/io/helidon/nima/webserver/http/HttpRoutingTest.java b/webserver/webserver/src/test/java/io/helidon/webserver/http/HttpRoutingTest.java similarity index 98% rename from nima/webserver/webserver/src/test/java/io/helidon/nima/webserver/http/HttpRoutingTest.java rename to webserver/webserver/src/test/java/io/helidon/webserver/http/HttpRoutingTest.java index 279127bf9e0..a55debe2e46 100644 --- a/nima/webserver/webserver/src/test/java/io/helidon/nima/webserver/http/HttpRoutingTest.java +++ b/webserver/webserver/src/test/java/io/helidon/webserver/http/HttpRoutingTest.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http; +package io.helidon.webserver.http; import java.util.function.Function; import java.util.function.Supplier; import java.util.stream.Stream; -import io.helidon.common.http.Http; +import io.helidon.http.Http; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; diff --git a/nima/webserver/webserver/src/test/java/io/helidon/nima/webserver/http/HttpRulesTest.java b/webserver/webserver/src/test/java/io/helidon/webserver/http/HttpRulesTest.java similarity index 98% rename from nima/webserver/webserver/src/test/java/io/helidon/nima/webserver/http/HttpRulesTest.java rename to webserver/webserver/src/test/java/io/helidon/webserver/http/HttpRulesTest.java index a3efb768c2f..5f79bade0b9 100644 --- a/nima/webserver/webserver/src/test/java/io/helidon/nima/webserver/http/HttpRulesTest.java +++ b/webserver/webserver/src/test/java/io/helidon/webserver/http/HttpRulesTest.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http; +package io.helidon.webserver.http; import java.util.function.Function; import java.util.function.Supplier; import java.util.stream.Stream; -import io.helidon.common.http.Http; -import io.helidon.common.http.PathMatchers; +import io.helidon.http.Http; +import io.helidon.http.PathMatchers; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; diff --git a/nima/webserver/webserver/src/test/java/io/helidon/nima/webserver/http/PathMatchersTest.java b/webserver/webserver/src/test/java/io/helidon/webserver/http/PathMatchersTest.java similarity index 96% rename from nima/webserver/webserver/src/test/java/io/helidon/nima/webserver/http/PathMatchersTest.java rename to webserver/webserver/src/test/java/io/helidon/webserver/http/PathMatchersTest.java index 0b67fa1496a..9b98497186d 100644 --- a/nima/webserver/webserver/src/test/java/io/helidon/nima/webserver/http/PathMatchersTest.java +++ b/webserver/webserver/src/test/java/io/helidon/webserver/http/PathMatchersTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.nima.webserver.http; +package io.helidon.webserver.http; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; -import io.helidon.common.http.PathMatcher; -import io.helidon.common.http.PathMatchers; +import io.helidon.http.PathMatcher; +import io.helidon.http.PathMatchers; import io.helidon.common.uri.UriPath; import org.hamcrest.Description; diff --git a/webserver/webserver/src/test/java/io/helidon/webserver/http1/ConnectionConfigTest.java b/webserver/webserver/src/test/java/io/helidon/webserver/http1/ConnectionConfigTest.java new file mode 100644 index 00000000000..d635bfa2587 --- /dev/null +++ b/webserver/webserver/src/test/java/io/helidon/webserver/http1/ConnectionConfigTest.java @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.webserver.http1; + +import java.util.Map; + +import io.helidon.config.Config; +import io.helidon.webserver.WebServer; + +import org.junit.jupiter.api.Test; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.hasKey; +import static org.hamcrest.Matchers.not; + +public class ConnectionConfigTest { + + @Test + void testConnectionConfig() { + // This will pick up application.yaml from the classpath as default configuration file + TestConnectionSelectorProvider.reset(); + + Config config = Config.create(); + WebServer.builder().config(config.get("server")).build(); + + Map http1Configs = TestConnectionSelectorProvider.config(); + + assertThat(http1Configs, hasKey("@default")); + assertThat(http1Configs, hasKey("other")); + assertThat("Discover services is disabled for admin port", http1Configs, not(hasKey("admin"))); + + Http1Config http1Config = http1Configs.get("@default"); + assertThat(http1Config.maxPrologueLength(), is(4096)); + assertThat(http1Config.maxHeadersSize(), is(8192)); + assertThat(http1Config.validatePath(), is(true)); + assertThat(http1Config.validateRequestHeaders(), is(true)); + assertThat(http1Config.validateResponseHeaders(), is(false)); + + http1Config = http1Configs.get("other"); + assertThat(http1Config.maxPrologueLength(), is(81)); + assertThat(http1Config.maxHeadersSize(), is(42)); + assertThat(http1Config.validatePath(), is(false)); + assertThat(http1Config.validateRequestHeaders(), is(false)); + assertThat(http1Config.validateResponseHeaders(), is(true)); + } + +} diff --git a/webserver/webserver/src/test/java/io/helidon/webserver/http1/TestConnectionSelectorProvider.java b/webserver/webserver/src/test/java/io/helidon/webserver/http1/TestConnectionSelectorProvider.java new file mode 100644 index 00000000000..4672d48d3a5 --- /dev/null +++ b/webserver/webserver/src/test/java/io/helidon/webserver/http1/TestConnectionSelectorProvider.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.webserver.http1; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import io.helidon.common.Weight; +import io.helidon.webserver.ProtocolConfigs; +import io.helidon.webserver.spi.ServerConnectionSelector; +import io.helidon.webserver.spi.ServerConnectionSelectorProvider; + +import static org.mockito.Mockito.mock; + +@Weight(10) +public class TestConnectionSelectorProvider implements ServerConnectionSelectorProvider { + + private static final Map CONFIGS = new ConcurrentHashMap<>(); + + static Map config() { + return CONFIGS; + } + + static void reset() { + CONFIGS.clear(); + } + + @Override + public Class protocolConfigType() { + return Http1Config.class; + } + + @Override + public String protocolType() { + return "http_1_1"; + } + + @Override + public ServerConnectionSelector create(String socketName, Http1Config config, ProtocolConfigs configs) { + CONFIGS.put(socketName, config); + return mock(ServerConnectionSelector.class); + } + +} diff --git a/webserver/webserver/src/test/resources/META-INF/services/io.helidon.webserver.spi.ServerConnectionSelectorProvider b/webserver/webserver/src/test/resources/META-INF/services/io.helidon.webserver.spi.ServerConnectionSelectorProvider new file mode 100644 index 00000000000..6d3c23473fa --- /dev/null +++ b/webserver/webserver/src/test/resources/META-INF/services/io.helidon.webserver.spi.ServerConnectionSelectorProvider @@ -0,0 +1,17 @@ +# +# Copyright (c) 2023 Oracle and/or its affiliates. +# +# 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. +# + +io.helidon.webserver.http1.TestConnectionSelectorProvider \ No newline at end of file diff --git a/nima/webserver/webserver/src/test/resources/application.yaml b/webserver/webserver/src/test/resources/application.yaml similarity index 100% rename from nima/webserver/webserver/src/test/resources/application.yaml rename to webserver/webserver/src/test/resources/application.yaml diff --git a/webserver/websocket/etc/spotbugs/exclude.xml b/webserver/websocket/etc/spotbugs/exclude.xml new file mode 100644 index 00000000000..c9bc53bcc8d --- /dev/null +++ b/webserver/websocket/etc/spotbugs/exclude.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + diff --git a/webserver/websocket/pom.xml b/webserver/websocket/pom.xml new file mode 100644 index 00000000000..07ef7c339fc --- /dev/null +++ b/webserver/websocket/pom.xml @@ -0,0 +1,134 @@ + + + + 4.0.0 + + io.helidon.webserver + helidon-webserver-project + 4.0.0-SNAPSHOT + + + helidon-webserver-websocket + Helidon WebSocket WebServer + + + etc/spotbugs/exclude.xml + + + + + io.helidon.websocket + helidon-websocket + + + io.helidon.webserver + helidon-webserver + + + io.helidon.common.features + helidon-common-features-api + true + + + io.helidon.config + helidon-config-metadata + true + + + io.helidon.builder + helidon-builder-api + + + io.helidon.config + helidon-config-yaml + test + + + org.junit.jupiter + junit-jupiter-api + test + + + mockito-core + org.mockito + test + + + org.hamcrest + hamcrest-all + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + io.helidon.config + helidon-config-metadata-processor + ${helidon.version} + + + io.helidon.builder + helidon-builder-processor + ${helidon.version} + + + io.helidon.common.processor + helidon-common-processor-helidon-copyright + ${helidon.version} + + + + + + io.helidon.builder + helidon-builder-processor + ${helidon.version} + + + io.helidon.config + helidon-config-metadata-processor + ${helidon.version} + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + io.helidon.common.processor + helidon-common-processor-helidon-copyright + ${helidon.version} + + + + + + + diff --git a/nima/websocket/webserver/src/main/java/io/helidon/nima/websocket/webserver/WsConfigBlueprint.java b/webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsConfigBlueprint.java similarity index 93% rename from nima/websocket/webserver/src/main/java/io/helidon/nima/websocket/webserver/WsConfigBlueprint.java rename to webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsConfigBlueprint.java index 2dfeb11a9f8..5504b3519ae 100644 --- a/nima/websocket/webserver/src/main/java/io/helidon/nima/websocket/webserver/WsConfigBlueprint.java +++ b/webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsConfigBlueprint.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.nima.websocket.webserver; +package io.helidon.webserver.websocket; import java.util.Set; import io.helidon.builder.api.Prototype; import io.helidon.config.metadata.Configured; import io.helidon.config.metadata.ConfiguredOption; -import io.helidon.nima.webserver.spi.ProtocolConfig; +import io.helidon.webserver.spi.ProtocolConfig; /** * WebSocket protocol configuration. diff --git a/nima/websocket/webserver/src/main/java/io/helidon/nima/websocket/webserver/WsConnection.java b/webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsConnection.java similarity index 92% rename from nima/websocket/webserver/src/main/java/io/helidon/nima/websocket/webserver/WsConnection.java rename to webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsConnection.java index 086566fbec4..9c972d06892 100644 --- a/nima/websocket/webserver/src/main/java/io/helidon/nima/websocket/webserver/WsConnection.java +++ b/webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsConnection.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.websocket.webserver; +package io.helidon.webserver.websocket; import java.lang.System.Logger.Level; import java.nio.charset.StandardCharsets; @@ -25,21 +25,19 @@ import io.helidon.common.buffers.BufferData; import io.helidon.common.buffers.DataReader; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; -import io.helidon.common.http.HttpPrologue; -import io.helidon.nima.webserver.CloseConnectionException; -import io.helidon.nima.webserver.ConnectionContext; -import io.helidon.nima.webserver.spi.ServerConnection; -import io.helidon.nima.websocket.ClientWsFrame; -import io.helidon.nima.websocket.ServerWsFrame; -import io.helidon.nima.websocket.WsCloseCodes; -import io.helidon.nima.websocket.WsCloseException; -import io.helidon.nima.websocket.WsListener; -import io.helidon.nima.websocket.WsOpCode; -import io.helidon.nima.websocket.WsSession; - -import static io.helidon.nima.websocket.webserver.WsUpgrader.PROTOCOL; +import io.helidon.http.Headers; +import io.helidon.http.Http; +import io.helidon.http.HttpPrologue; +import io.helidon.webserver.CloseConnectionException; +import io.helidon.webserver.ConnectionContext; +import io.helidon.webserver.spi.ServerConnection; +import io.helidon.websocket.ClientWsFrame; +import io.helidon.websocket.ServerWsFrame; +import io.helidon.websocket.WsCloseCodes; +import io.helidon.websocket.WsCloseException; +import io.helidon.websocket.WsListener; +import io.helidon.websocket.WsOpCode; +import io.helidon.websocket.WsSession; /** * WebSocket connection, server side session implementation. @@ -171,7 +169,7 @@ public WsSession terminate() { @Override public Optional subProtocol() { - return upgradeHeaders.first(PROTOCOL); + return upgradeHeaders.first(WsUpgrader.PROTOCOL); } @Override diff --git a/webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsProtocolConfigProvider.java b/webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsProtocolConfigProvider.java new file mode 100644 index 00000000000..ffc1bd37a67 --- /dev/null +++ b/webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsProtocolConfigProvider.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.helidon.webserver.websocket; + +import io.helidon.common.config.Config; +import io.helidon.webserver.spi.ProtocolConfigProvider; + +/** + * Service provider implementation for WebSocket protocol configuration. + */ +public class WsProtocolConfigProvider implements ProtocolConfigProvider { + @Override + public String configKey() { + return WsUpgradeProvider.CONFIG_NAME; + } + + @Override + public WsConfig create(Config config, String name) { + return WsConfig.builder() + .config(config) + .name(name) + .build(); + } +} diff --git a/nima/websocket/webserver/src/main/java/io/helidon/nima/websocket/webserver/WsRoute.java b/webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsRoute.java similarity index 82% rename from nima/websocket/webserver/src/main/java/io/helidon/nima/websocket/webserver/WsRoute.java rename to webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsRoute.java index 1699e4dd0d7..8ee28270931 100644 --- a/nima/websocket/webserver/src/main/java/io/helidon/nima/websocket/webserver/WsRoute.java +++ b/webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsRoute.java @@ -14,19 +14,19 @@ * limitations under the License. */ -package io.helidon.nima.websocket.webserver; +package io.helidon.webserver.websocket; import java.util.function.Supplier; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.PathMatcher; -import io.helidon.common.http.PathMatchers; -import io.helidon.nima.webserver.Route; -import io.helidon.nima.websocket.WsListener; +import io.helidon.http.HttpPrologue; +import io.helidon.http.PathMatcher; +import io.helidon.http.PathMatchers; +import io.helidon.webserver.Route; +import io.helidon.websocket.WsListener; /** * WebSocket route. Result of routing in - * {@link io.helidon.nima.websocket.webserver.WsRouting#findRoute(io.helidon.common.http.HttpPrologue)}. + * {@link WsRouting#findRoute(io.helidon.http.HttpPrologue)}. */ public class WsRoute implements Route { private final PathMatcher pathMatcher; diff --git a/nima/websocket/webserver/src/main/java/io/helidon/nima/websocket/webserver/WsRouting.java b/webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsRouting.java similarity index 92% rename from nima/websocket/webserver/src/main/java/io/helidon/nima/websocket/webserver/WsRouting.java rename to webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsRouting.java index c1aaf910ddf..988ad554e40 100644 --- a/nima/websocket/webserver/src/main/java/io/helidon/nima/websocket/webserver/WsRouting.java +++ b/webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsRouting.java @@ -14,17 +14,17 @@ * limitations under the License. */ -package io.helidon.nima.websocket.webserver; +package io.helidon.webserver.websocket; import java.util.ArrayList; import java.util.List; import java.util.function.Supplier; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.NotFoundException; -import io.helidon.common.http.PathMatchers; -import io.helidon.nima.webserver.Routing; -import io.helidon.nima.websocket.WsListener; +import io.helidon.http.HttpPrologue; +import io.helidon.http.NotFoundException; +import io.helidon.http.PathMatchers; +import io.helidon.webserver.Routing; +import io.helidon.websocket.WsListener; /** * WebSocket specific routing. diff --git a/nima/websocket/webserver/src/main/java/io/helidon/nima/websocket/webserver/WsUpgradeProvider.java b/webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsUpgradeProvider.java similarity index 82% rename from nima/websocket/webserver/src/main/java/io/helidon/nima/websocket/webserver/WsUpgradeProvider.java rename to webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsUpgradeProvider.java index 49bfd16d726..4f9573ca07c 100644 --- a/nima/websocket/webserver/src/main/java/io/helidon/nima/websocket/webserver/WsUpgradeProvider.java +++ b/webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsUpgradeProvider.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.helidon.nima.websocket.webserver; +package io.helidon.webserver.websocket; -import io.helidon.nima.webserver.ProtocolConfigs; -import io.helidon.nima.webserver.http1.spi.Http1UpgradeProvider; -import io.helidon.nima.webserver.http1.spi.Http1Upgrader; +import io.helidon.webserver.ProtocolConfigs; +import io.helidon.webserver.http1.spi.Http1UpgradeProvider; +import io.helidon.webserver.http1.spi.Http1Upgrader; /** * {@link java.util.ServiceLoader} provider implementation for upgrade from HTTP/1.1 to WebSocket. @@ -33,7 +33,7 @@ public class WsUpgradeProvider implements Http1UpgradeProvider { * Create a new instance with default configuration. * * @deprecated This constructor is only to be used by {@link java.util.ServiceLoader}, - * use {@link io.helidon.nima.websocket.webserver.WsUpgrader#create(WsConfig)} for manual setup + * use {@link WsUpgrader#create(WsConfig)} for manual setup */ @Deprecated() public WsUpgradeProvider() { diff --git a/nima/websocket/webserver/src/main/java/io/helidon/nima/websocket/webserver/WsUpgrader.java b/webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsUpgrader.java similarity index 91% rename from nima/websocket/webserver/src/main/java/io/helidon/nima/websocket/webserver/WsUpgrader.java rename to webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsUpgrader.java index 8f08678c1a8..f59ffc7e049 100644 --- a/nima/websocket/webserver/src/main/java/io/helidon/nima/websocket/webserver/WsUpgrader.java +++ b/webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsUpgrader.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.websocket.webserver; +package io.helidon.webserver.websocket; import java.lang.System.Logger.Level; import java.security.MessageDigest; @@ -25,24 +25,24 @@ import io.helidon.common.buffers.BufferData; import io.helidon.common.buffers.DataWriter; -import io.helidon.common.http.DirectHandler; -import io.helidon.common.http.Headers; -import io.helidon.common.http.Http; -import io.helidon.common.http.Http.HeaderName; -import io.helidon.common.http.Http.HeaderNames; -import io.helidon.common.http.HttpPrologue; -import io.helidon.common.http.NotFoundException; -import io.helidon.common.http.RequestException; -import io.helidon.common.http.WritableHeaders; -import io.helidon.nima.webserver.ConnectionContext; -import io.helidon.nima.webserver.http1.spi.Http1Upgrader; -import io.helidon.nima.webserver.spi.ServerConnection; -import io.helidon.nima.websocket.WsUpgradeException; +import io.helidon.http.DirectHandler; +import io.helidon.http.Headers; +import io.helidon.http.Http; +import io.helidon.http.Http.HeaderName; +import io.helidon.http.Http.HeaderNames; +import io.helidon.http.HttpPrologue; +import io.helidon.http.NotFoundException; +import io.helidon.http.RequestException; +import io.helidon.http.WritableHeaders; +import io.helidon.webserver.ConnectionContext; +import io.helidon.webserver.http1.spi.Http1Upgrader; +import io.helidon.webserver.spi.ServerConnection; +import io.helidon.websocket.WsUpgradeException; import static java.nio.charset.StandardCharsets.US_ASCII; /** - * {@link io.helidon.nima.webserver.http1.spi.Http1Upgrader} implementation to upgrade from HTTP/1.1 to WebSocket. + * {@link io.helidon.webserver.http1.spi.Http1Upgrader} implementation to upgrade from HTTP/1.1 to WebSocket. */ public class WsUpgrader implements Http1Upgrader { diff --git a/webserver/websocket/src/main/java/io/helidon/webserver/websocket/package-info.java b/webserver/websocket/src/main/java/io/helidon/webserver/websocket/package-info.java new file mode 100644 index 00000000000..e4c8365dea2 --- /dev/null +++ b/webserver/websocket/src/main/java/io/helidon/webserver/websocket/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * WebSocket server support. + */ +package io.helidon.webserver.websocket; diff --git a/webserver/websocket/src/main/java/module-info.java b/webserver/websocket/src/main/java/module-info.java new file mode 100644 index 00000000000..5f7b5c3c9e0 --- /dev/null +++ b/webserver/websocket/src/main/java/module-info.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.common.features.api.Feature; +import io.helidon.common.features.api.HelidonFlavor; +import io.helidon.webserver.http1.spi.Http1UpgradeProvider; +import io.helidon.webserver.spi.ProtocolConfigProvider; +import io.helidon.webserver.websocket.WsProtocolConfigProvider; +import io.helidon.webserver.websocket.WsUpgradeProvider; + +/** + * Helidon WebServer WebSocket Support. + */ +@Feature(value = "WebSocket", + description = "WebServer WebSocket support", + in = HelidonFlavor.SE, + path = {"WebSocket", "WebServer"} +) +module io.helidon.webserver.websocket { + requires static io.helidon.common.features.api; + requires static io.helidon.config.metadata; + + requires io.helidon.common; + requires io.helidon.http; + requires io.helidon.common.socket; + requires io.helidon.builder.api; + requires transitive io.helidon.websocket; + requires transitive io.helidon.webserver; + + exports io.helidon.webserver.websocket; + + provides Http1UpgradeProvider + with WsUpgradeProvider; + provides ProtocolConfigProvider + with WsProtocolConfigProvider; +} \ No newline at end of file diff --git a/nima/websocket/webserver/src/test/java/io/helidon/nima/websocket/webserver/WsUpgradeProviderConfigTest.java b/webserver/websocket/src/test/java/io/helidon/webserver/websocket/WsUpgradeProviderConfigTest.java similarity index 95% rename from nima/websocket/webserver/src/test/java/io/helidon/nima/websocket/webserver/WsUpgradeProviderConfigTest.java rename to webserver/websocket/src/test/java/io/helidon/webserver/websocket/WsUpgradeProviderConfigTest.java index ea3a42ae2fb..17b8719a203 100644 --- a/nima/websocket/webserver/src/test/java/io/helidon/nima/websocket/webserver/WsUpgradeProviderConfigTest.java +++ b/webserver/websocket/src/test/java/io/helidon/webserver/websocket/WsUpgradeProviderConfigTest.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package io.helidon.nima.websocket.webserver; +package io.helidon.webserver.websocket; import java.lang.reflect.InvocationTargetException; import java.util.List; import java.util.Set; import io.helidon.config.Config; -import io.helidon.nima.webserver.ProtocolConfigs; +import io.helidon.webserver.ProtocolConfigs; import org.junit.jupiter.api.Test; diff --git a/nima/websocket/webserver/src/test/resources/application.yaml b/webserver/websocket/src/test/resources/application.yaml similarity index 100% rename from nima/websocket/webserver/src/test/resources/application.yaml rename to webserver/websocket/src/test/resources/application.yaml diff --git a/websocket/pom.xml b/websocket/pom.xml new file mode 100644 index 00000000000..9b391b0986e --- /dev/null +++ b/websocket/pom.xml @@ -0,0 +1,79 @@ + + + + 4.0.0 + + io.helidon + helidon-project + 4.0.0-SNAPSHOT + + + io.helidon.websocket + helidon-websocket + Helidon WebSocket + + + + io.helidon.common + helidon-common-buffers + + + io.helidon.common + helidon-common-socket + + + io.helidon.http + helidon-http + + + io.helidon.common.features + helidon-common-features-api + true + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-all + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + io.helidon.common.features + helidon-common-features-processor + ${helidon.version} + + + + + + + + diff --git a/nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/AbstractWsFrame.java b/websocket/src/main/java/io/helidon/websocket/AbstractWsFrame.java similarity index 99% rename from nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/AbstractWsFrame.java rename to websocket/src/main/java/io/helidon/websocket/AbstractWsFrame.java index 83c21529c01..6bd28fb53df 100644 --- a/nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/AbstractWsFrame.java +++ b/websocket/src/main/java/io/helidon/websocket/AbstractWsFrame.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.websocket; +package io.helidon.websocket; import io.helidon.common.LazyValue; import io.helidon.common.buffers.BufferData; diff --git a/nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/ClientWsFrame.java b/websocket/src/main/java/io/helidon/websocket/ClientWsFrame.java similarity index 98% rename from nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/ClientWsFrame.java rename to websocket/src/main/java/io/helidon/websocket/ClientWsFrame.java index 2ea93ea9167..399df346d03 100644 --- a/nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/ClientWsFrame.java +++ b/websocket/src/main/java/io/helidon/websocket/ClientWsFrame.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.websocket; +package io.helidon.websocket; import java.nio.charset.StandardCharsets; import java.security.SecureRandom; @@ -115,7 +115,7 @@ public static ClientWsFrame control(WsOpCode opCode, BufferData bufferData) { * @param dataReader data reader to get frame bytes from * @param maxFrameLength maximal length of a frame, to protect memory from too big frames * @return a new client frame - * @throws io.helidon.nima.websocket.WsCloseException in case of invalid frame + * @throws WsCloseException in case of invalid frame * @throws java.lang.RuntimeException depending on implementation of dataReader */ public static ClientWsFrame read(SocketContext ctx, diff --git a/nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/ServerWsFrame.java b/websocket/src/main/java/io/helidon/websocket/ServerWsFrame.java similarity index 97% rename from nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/ServerWsFrame.java rename to websocket/src/main/java/io/helidon/websocket/ServerWsFrame.java index 79663b86d7c..ba67f8bf902 100644 --- a/nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/ServerWsFrame.java +++ b/websocket/src/main/java/io/helidon/websocket/ServerWsFrame.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.websocket; +package io.helidon.websocket; import java.nio.charset.StandardCharsets; @@ -87,7 +87,7 @@ public static ServerWsFrame control(WsOpCode opCode, BufferData bufferData) { * @param dataReader data reader to get frame bytes from * @param maxFrameLength maximal length of a frame, to protect memory from too big frames * @return a new server frame - * @throws io.helidon.nima.websocket.WsCloseException in case of invalid frame + * @throws WsCloseException in case of invalid frame * @throws java.lang.RuntimeException depending on implementation of dataReader */ public static ServerWsFrame read(SocketContext ctx, DataReader dataReader, int maxFrameLength) { diff --git a/nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/WsCloseCodes.java b/websocket/src/main/java/io/helidon/websocket/WsCloseCodes.java similarity index 90% rename from nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/WsCloseCodes.java rename to websocket/src/main/java/io/helidon/websocket/WsCloseCodes.java index 95904936e61..e321c20187d 100644 --- a/nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/WsCloseCodes.java +++ b/websocket/src/main/java/io/helidon/websocket/WsCloseCodes.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package io.helidon.nima.websocket; +package io.helidon.websocket; /** - * Codes to use with {@link io.helidon.nima.websocket.WsSession#close(int, String)} and to receive - * in {@link io.helidon.nima.websocket.WsListener#onClose(WsSession, int, String)}. + * Codes to use with {@link WsSession#close(int, String)} and to receive + * in {@link WsListener#onClose(WsSession, int, String)}. */ public final class WsCloseCodes { /** - * Code to use with {@link io.helidon.nima.websocket.WsSession#close(int, String)} to indicate normal close operation. + * Code to use with {@link WsSession#close(int, String)} to indicate normal close operation. */ public static final int NORMAL_CLOSE = 1000; /** diff --git a/nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/WsCloseException.java b/websocket/src/main/java/io/helidon/websocket/WsCloseException.java similarity index 90% rename from nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/WsCloseException.java rename to websocket/src/main/java/io/helidon/websocket/WsCloseException.java index adac7539988..b73c1bca728 100644 --- a/nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/WsCloseException.java +++ b/websocket/src/main/java/io/helidon/websocket/WsCloseException.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.websocket; +package io.helidon.websocket; /** * Exception requesting a close of the WebSocket communication. @@ -26,7 +26,7 @@ public class WsCloseException extends RuntimeException { * Create a new exception. * * @param message message to use, will be used as the description of the close code - * @param closeCode WebSocket close code, see {@link io.helidon.nima.websocket.WsCloseCodes} + * @param closeCode WebSocket close code, see {@link WsCloseCodes} */ public WsCloseException(String message, int closeCode) { super(message); diff --git a/nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/WsFrame.java b/websocket/src/main/java/io/helidon/websocket/WsFrame.java similarity index 98% rename from nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/WsFrame.java rename to websocket/src/main/java/io/helidon/websocket/WsFrame.java index 0d6b09f3901..bd576936aca 100644 --- a/nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/WsFrame.java +++ b/websocket/src/main/java/io/helidon/websocket/WsFrame.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.websocket; +package io.helidon.websocket; import io.helidon.common.buffers.BufferData; diff --git a/nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/WsListener.java b/websocket/src/main/java/io/helidon/websocket/WsListener.java similarity index 95% rename from nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/WsListener.java rename to websocket/src/main/java/io/helidon/websocket/WsListener.java index f2308ebd0f2..b1a26cf3719 100644 --- a/nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/WsListener.java +++ b/websocket/src/main/java/io/helidon/websocket/WsListener.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.helidon.nima.websocket; +package io.helidon.websocket; import java.util.Optional; import io.helidon.common.buffers.BufferData; -import io.helidon.common.http.Headers; -import io.helidon.common.http.HttpPrologue; +import io.helidon.http.Headers; +import io.helidon.http.HttpPrologue; /** * WebSocket listener. diff --git a/nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/WsOpCode.java b/websocket/src/main/java/io/helidon/websocket/WsOpCode.java similarity index 98% rename from nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/WsOpCode.java rename to websocket/src/main/java/io/helidon/websocket/WsOpCode.java index 9b93082de24..e15ae1feee0 100644 --- a/nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/WsOpCode.java +++ b/websocket/src/main/java/io/helidon/websocket/WsOpCode.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.websocket; +package io.helidon.websocket; /** * WebSocket operation code. diff --git a/nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/WsSession.java b/websocket/src/main/java/io/helidon/websocket/WsSession.java similarity index 93% rename from nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/WsSession.java rename to websocket/src/main/java/io/helidon/websocket/WsSession.java index 7d37d143b24..237e6dae73c 100644 --- a/nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/WsSession.java +++ b/websocket/src/main/java/io/helidon/websocket/WsSession.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.helidon.nima.websocket; +package io.helidon.websocket; import java.util.Optional; @@ -61,7 +61,7 @@ public interface WsSession { /** * Close session. * - * @param code close code, may be one of {@link io.helidon.nima.websocket.WsCloseCodes} + * @param code close code, may be one of {@link WsCloseCodes} * @param reason reason description * @return this instance */ diff --git a/nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/WsUpgradeException.java b/websocket/src/main/java/io/helidon/websocket/WsUpgradeException.java similarity index 90% rename from nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/WsUpgradeException.java rename to websocket/src/main/java/io/helidon/websocket/WsUpgradeException.java index 1ddc340d172..50d6c1746a1 100644 --- a/nima/websocket/websocket/src/main/java/io/helidon/nima/websocket/WsUpgradeException.java +++ b/websocket/src/main/java/io/helidon/websocket/WsUpgradeException.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.helidon.nima.websocket; +package io.helidon.websocket; -import io.helidon.common.http.HttpPrologue; +import io.helidon.http.HttpPrologue; /** - * An exception that may be thrown by {@link WsListener#onHttpUpgrade(HttpPrologue, io.helidon.common.http.Headers)} + * An exception that may be thrown by {@link WsListener#onHttpUpgrade(HttpPrologue, io.helidon.http.Headers)} * during handshake process to reject a websocket upgrade. */ public class WsUpgradeException extends Exception { diff --git a/websocket/src/main/java/io/helidon/websocket/package-info.java b/websocket/src/main/java/io/helidon/websocket/package-info.java new file mode 100644 index 00000000000..aca9c7eb98a --- /dev/null +++ b/websocket/src/main/java/io/helidon/websocket/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +/** + * WebSocket APIs. + */ +package io.helidon.websocket; diff --git a/websocket/src/main/java/module-info.java b/websocket/src/main/java/module-info.java new file mode 100644 index 00000000000..c16e78a65bb --- /dev/null +++ b/websocket/src/main/java/module-info.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * + * 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. + */ + +import io.helidon.common.features.api.Feature; +import io.helidon.common.features.api.HelidonFlavor; + +/** + * Helidon WebSocket APIs. + */ +@Feature(value = "WebSocket", + description = "WebSocket APIs", + in = HelidonFlavor.SE, + path = "WebSocket" +) +module io.helidon.websocket { + requires static io.helidon.common.features.api; + + requires io.helidon.common; + requires transitive io.helidon.common.socket; + requires transitive io.helidon.common.buffers; + requires transitive io.helidon.http; + + exports io.helidon.websocket; +}