blob: 9255e98261ea69e977c1b833f0c84eb35cbb1875 [file] [log] [blame]
<!--
/***************************************************************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
***************************************************************************************************************************/
-->
{8.0.0-new, 8.1.2-deprecated}
Overview
<p>
The Jetty Microservice API consists of a combination of the Juneau Core, Server, and Client APIs and an embedded
Eclipse Jetty Servlet Container.
</p>
<p>
The API builds upon the {@doc juneau-microservice-core Core Microservice} classes to produce easy-to-create and
easy-to-use microservices in a standard Java 1.8+ environment.
</p>
<p>
The <c>juneau-microservice-jetty</c> library consists of the following classes:
</p>
<ul class='javatree'>
<li class='jp'>{@link oaj.microservice.jetty}
<ul>
<li class='jc'>{@link oaj.microservice.jetty.JettyMicroservice} - The Jetty microservice class.
<li class='jc'>{@link oaj.microservice.jetty.JettyMicroserviceBuilder} - Builder for the microservice class.
<li class='jic'>{@link oaj.microservice.jetty.JettyMicroserviceListener} - Interface for hooking into lifecyle events of the microservice.
<ul>
<li class='jc'>{@link oaj.microservice.jetty.BasicJettyMicroserviceListener} - Adapter for JettyMicroserviceListener class.
</ul>
<li class='jic'>{@link oaj.microservice.jetty.JettyServerFactory} - Interface for defining custom Jetty servers.
<ul>
<li class='jc'>{@link oaj.microservice.jetty.BasicJettyServerFactory} - Adapter for JettyServerFactory class.
</ul>
</ul>
</ul>
<p>
The most-basic creation of a Jetty microservice from an entry-point method is shown below:
</p>
<p class='bpcode w800'>
<jk>public class</jk> App {
<jk>public static void</jk> main(String[] args) {
JettyMicroservice
.<jsm>create</jsm>() <jc>// Create builder.</jc>
.args(args) <jc>// Pass in args.</jc>
.servlets(RootResource.<jk>class</jk>) <jc>// A Juneau RestServlet class.</jc>
.build() <jc>// Create microservice.</jc>
.start() <jc>// Start microservice.</jc>
;
}
}
</p>