javax.xml.ws.spi.http.package-info Maven / Gradle / Ivy
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2009-2017 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* https://oss.oracle.com/licenses/CDDL+GPL-1.1
* or LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
/**
Provides HTTP SPI that is used for portable deployment of JAX-WS
web services in containers(for e.g. servlet containers). This SPI
is not for end developers but provides a way for the container
developers to deploy JAX-WS services portably.
The portable deployment is done as below:
- Container creates {@link javax.xml.ws.Endpoint} objects for an
application. The necessary information to create Endpoint objects
may be got from web service deployment descriptor files.
- Container needs to create {@link javax.xml.ws.spi.http.HttpContext}
objects for the deployment. For example, a HttpContext could be
created using servlet configuration(for e.g url-pattern) for the
web service in servlet container case.
- Then publishes all the endpoints using
{@link javax.xml.ws.Endpoint#publish(HttpContext)}. During publish(),
JAX-WS runtime registers a {@link javax.xml.ws.spi.http.HttpHandler}
callback to handle incoming requests or
{@link javax.xml.ws.spi.http.HttpExchange} objects. The HttpExchange
object encapsulates a HTTP request and a response.
{@literal
Container JAX-WS runtime
--------- --------------
1. Creates Invoker1, ... InvokerN
2. Provider.createEndpoint(...) --> 3. creates Endpoint1
configures Endpoint1
...
4. Provider.createEndpoint(...) --> 5. creates EndpointN
configures EndpointN
6. Creates ApplicationContext
7. creates HttpContext1, ... HttpContextN
8. Endpoint1.publish(HttpContext1) --> 9. creates HttpHandler1
HttpContext1.setHandler(HttpHandler1)
...
10. EndpointN.publish(HttpContextN) --> 11. creates HttpHandlerN
HttpContextN.setHandler(HttpHandlerN)
}
The request processing is done as below(for every request):
{@literal
Container JAX-WS runtime
--------- --------------
1. Creates a HttpExchange
2. Gets handler from HttpContext
3. HttpHandler.handle(HttpExchange) --> 4. reads request from HttpExchange
<-- 5. Calls Invoker
6. Invokes the actual instance
7. Writes the response to HttpExchange
}
The portable undeployment is done as below:
Container
---------
1. {@literal @}preDestroy on instances
2. Endpoint1.stop()
...
3. EndpointN.stop()
@author Jitendra Kotamraju
@since 1.7, JAX-WS 2.2
*/
package javax.xml.ws.spi.http;