public class WebServiceHandler extends LegacyServiceHandler
WebHandler
paths.
Service registration is being performed via SourceNameMapper
, which loads the
programs marked with with-services
, via addService(com.goldencode.p2j.util.LegacyService, java.lang.Class<?>)
API.
Any converted Java code mapped to a service must have a class-level LegacyService
annotation. This annotation specifies one or more paths
to be served by
this handler.
The implicit basepath is /web
, and the implicit timeout is 10 seconds (set to 0
to disable it). This timeout is read from the appserver's timeout.
The values which need to be configured in the directory are:
WebHandler/basepath
, to specify the basepath.
Defaults to /web
.WebHandler/alias
, a process certificate alias associated with the workers
which will process the WebHandler requests; these will delegate the call to the
appserver. This context is automatically marked as HEADLESS.WebHandler/keyStore
, the key store with the certificate to authenticate
this process. If is missing, the store will be built from the directory.WebHandler/storePassword
, the store password, only if
WebHandler/keyStore
is set.WebHandler/poolSize
- the pool size of workers. Defaults to 10.WebHandler/appserver
- the name of the appserver handling the requests.
This appserver must be in the same FWD server as the handler (can't use a remote one).
Each queue of workers is ordered by the number of pending tasks to be executed - for each incoming request, the worker with the smallest number of pending tasks will be chosen.
Modifier and Type | Class and Description |
---|---|
private static class |
WebServiceHandler.WebHandlerConfig
A configuration for a WebHandler, as it was defined in
openedge.properties . |
org.eclipse.jetty.server.handler.AbstractHandler.ErrorDispatchHandler
org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener
Modifier and Type | Field and Description |
---|---|
private static org.eclipse.jetty.server.handler.ContextHandler |
handler
The context handler.
|
private static WebServiceHandler |
instance
The singleton instance for this handler.
|
private java.util.Map<java.lang.String,java.util.List<WebServiceHandler.WebHandlerConfig>> |
services
The exposed WebHandler services.
|
basePath
Constructor and Description |
---|
WebServiceHandler()
Initialize this handler with the 'WebHandler' type and '/web' default basepath.
|
Modifier and Type | Method and Description |
---|---|
static void |
addService(LegacyService pls,
java.lang.Class<?> cls)
Register a legacy service associated with a
WebHandler
implementation. |
void |
handle(java.lang.String target,
org.eclipse.jetty.server.Request baseRequest,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Code to process web requests.
|
static org.eclipse.jetty.server.handler.AbstractHandler |
initialize()
Initialize the WebHandler worker(s) and start the workers.
|
static void |
terminate()
Terminate the rest worker threads.
|
static boolean |
useWebServiceAuthentication()
Determine if this web service is configured to authenticate the APIs.
|
authorize, getBasePath, getPaths, getTimeout, getType, handle, handle, initializeHandler, postHandle, readBody, resolveBasePath, terminateWorkers, useAuthorization
destroy, doError, doStart, doStop, getServer, setServer
addBean, addBean, addEventListener, addManaged, contains, dump, dump, dump, dump, dump, dumpBeans, dumpObject, dumpObjects, dumpStdErr, dumpThis, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeans
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
private static WebServiceHandler instance
private static org.eclipse.jetty.server.handler.ContextHandler handler
private java.util.Map<java.lang.String,java.util.List<WebServiceHandler.WebHandlerConfig>> services
public WebServiceHandler()
public static org.eclipse.jetty.server.handler.AbstractHandler initialize()
public static boolean useWebServiceAuthentication()
true
if the authentication is enabled for this web service, in the directory.public static void terminate()
public static void addService(LegacyService pls, java.lang.Class<?> cls)
WebHandler
implementation.pls
- The annotation describing the service.cls
- The WebHandler implementation.public void handle(java.lang.String target, org.eclipse.jetty.server.Request baseRequest, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
handle
in interface org.eclipse.jetty.server.Handler
handle
in class LegacyServiceHandler
target
- The target path.request
- The HTTP request.response
- The HTTP response.java.io.IOException