The com.yahoo.jdisc.service.ServerProvider interface defines a component that is capable of acting as a server for an external client. This document explains how to implement and deploy a custom server provider.
All requests that are processed in a JDisc application are created by server providers.
These are the parts of the JDisc Container that accept incoming connections.
Upon accepting a request from an external client,
the server provider must create and dispatch a corresponding com.yahoo.jdisc.Request
instance.
Upon receiving the com.yahoo.jdisc.Response
,
the server needs to respond back to the client.
To implement a server provider, either implement the
ServerProvider interface directly, or subclass the more convenient
AbstractServerProvider.
Please note the following:
CurrentContainer
.
Declare that as a constructor argument (which triggers injection),
and store it locally.isServerRequest()
method returns true
).
To create such a request, use
this constructor.ContentChannel
is the same as for
dispatching a client request from a request handler.To install a server provider in a container, use the server element in services.xml, e.g.:
<container id="default" version="1.0"> <server id="my.package.MyServerProvider" bundle="the name in <artifactId> in pom.xml" /> <nodes> <node hostalias="node1" /> </nodes> </container>