Package jadex.extension.rs.publish
Class ExternalRestPublishService
- java.lang.Object
-
- jadex.extension.rs.publish.AbstractRestPublishService
-
- jadex.extension.rs.publish.ExternalRestPublishService
-
- All Implemented Interfaces:
IPublishService
,IWebPublishService
,IRequestHandlerService
public class ExternalRestPublishService extends AbstractRestPublishService implements IRequestHandlerService
Rest publish service that works with an external web server. In case of an external web server the host:port/context part of requests are determined by the server. // todo: should store the published servers using hostname and port // currently can get confused if mixed published ids are used (with and without []) // leads to problems because different ports are used then for different handlers // and the default handler (at port 0) is not found for a request coming on another port such as 8080
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jadex.extension.rs.publish.AbstractRestPublishService
AbstractRestPublishService.ConversationInfo, AbstractRestPublishService.MappingInfo, AbstractRestPublishService.ResponseInfo, AbstractRestPublishService.SSEEvent
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_APP
The default app name.static java.lang.String
DEFAULT_COMPLETECONTEXT
The default hostportappcontext.static java.lang.String
DEFAULT_HOST
The default host name.static int
DEFAULT_PORT
The default port.protected boolean
inited
Inited flag because impl is used for 2 services.protected java.util.Map<java.lang.Integer,IPathHandler>
portservers
The servers per port.protected java.util.Map<IServiceIdentifier,Tuple2<IPathHandler,java.net.URI>>
sidservers
The servers per service id (for unpublishing).-
Fields inherited from class jadex.extension.rs.publish.AbstractRestPublishService
ASYNC_CONTEXT_INFO, binser, component, conversationinfos, converters, FINISHED, HEADER_JADEX_ALIVE, HEADER_JADEX_CALLFINISHED, HEADER_JADEX_CALLID, HEADER_JADEX_CLIENTTIMEOUT, HEADER_JADEX_ISLOGGEDIN, HEADER_JADEX_LOGIN, HEADER_JADEX_LOGOUT, HEADER_JADEX_MAX, HEADER_JADEX_TERMINATE, HEADER_JADEX_VERSION, jsonser, loginsec, PARAMETER_MEDIATYPES, sessions, sseevents
-
Fields inherited from interface jadex.bridge.service.types.publish.IPublishService
DEFAULT_RSPUBLISH_COMPONENTS, PUBLISH_RS, PUBLISH_WS
-
-
Constructor Summary
Constructors Constructor Description ExternalRestPublishService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.net.URI
convertUri(java.lang.String pid)
Convert the publish id to uri.java.lang.Object
getHttpServer(java.net.URI uri, PublishInfo info)
Get or start an api to the http server.java.lang.String
getServicesInfo(jakarta.servlet.http.HttpServletRequest request, IPathHandler ph)
Produce overview site of published services.IFuture<java.lang.Void>
handleRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, java.lang.Object args)
Handle the request.IFuture<java.lang.Void>
init()
The service init.IFuture<java.lang.Boolean>
isSupported(java.lang.String publishtype)
Test if publishing a specific type is supported (e.g.IFuture<java.lang.Void>
mirrorHttpServer(java.net.URI sourceserveruri, java.net.URI targetserveruri, PublishInfo info)
IFuture<java.lang.Void>
publishExternal(java.net.URI uri, java.lang.String rootpath)
Publish file resources from the file system.IFuture<java.lang.Void>
publishHMTLPage(java.lang.String pid, java.lang.String vhost, java.lang.String html)
Publish a static page (without ressources).IFuture<java.lang.Void>
publishRedirect(java.net.URI uri, java.lang.String html)
IFuture<java.lang.Void>
publishResources(java.lang.String uri, java.lang.String rootpath)
Publish file resources from the classpath.IFuture<java.lang.Void>
publishService(IServiceIdentifier serviceid, PublishInfo info)
Publish a service.IFuture<java.lang.Void>
shutdownHttpServer(java.net.URI uri)
IFuture<java.lang.Void>
unpublish(java.lang.String vhost, java.net.URI uri)
IFuture<java.lang.Void>
unpublishService(IServiceIdentifier sid)
Unpublish a service.-
Methods inherited from class jadex.extension.rs.publish.AbstractRestPublishService
addConverter, addEntry, complete, convertJsonValue, convertParameter, convertParameter, createSSEEvent, createSSEEvent, createSSEJson, evaluateMapping, extractCallerValues, generateInParameters, getAsyncContextInfo, getCleanPublishId, getParameterInfos, getRequestTimeout, getServiceInfo, getServletHost, getServletUrl, getSession, getSession, getSessionId, guessRestType, handleRequest, hasStringConvertableParameters, isComplete, isLoggedIn, isLoggedIn, loadFunctionJS, loadJadexJS, loadStyleCSS, login, logout, main, mapParameters, mapResult, parseMimetypes, pruneObsoleteConversations, removeConverter, sendDelayedSSEEvents, setCORSHeader, setLoginSecurity, setNoCachingHeader, splitQueryString, terminateConversation, writeResponse, writeResponseContent, writeResponseHeader
-
-
-
-
Field Detail
-
DEFAULT_HOST
public static final java.lang.String DEFAULT_HOST
The default host name.- See Also:
- Constant Field Values
-
DEFAULT_PORT
public static final int DEFAULT_PORT
The default port.- See Also:
- Constant Field Values
-
DEFAULT_APP
public static final java.lang.String DEFAULT_APP
The default app name.- See Also:
- Constant Field Values
-
DEFAULT_COMPLETECONTEXT
public static final java.lang.String DEFAULT_COMPLETECONTEXT
The default hostportappcontext.- See Also:
- Constant Field Values
-
sidservers
protected java.util.Map<IServiceIdentifier,Tuple2<IPathHandler,java.net.URI>> sidservers
The servers per service id (for unpublishing).
-
portservers
protected java.util.Map<java.lang.Integer,IPathHandler> portservers
The servers per port.
-
inited
protected boolean inited
Inited flag because impl is used for 2 services.
-
-
Method Detail
-
init
public IFuture<java.lang.Void> init()
The service init.- Overrides:
init
in classAbstractRestPublishService
-
handleRequest
public IFuture<java.lang.Void> handleRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, java.lang.Object args)
Handle the request.- Specified by:
handleRequest
in interfaceIRequestHandlerService
- Parameters:
request
- The request.response
- The response.args
- Container specific args.
-
isSupported
public IFuture<java.lang.Boolean> isSupported(java.lang.String publishtype)
Test if publishing a specific type is supported (e.g. web service).- Specified by:
isSupported
in interfaceIPublishService
- Overrides:
isSupported
in classAbstractRestPublishService
- Parameters:
publishtype
- The type to test.- Returns:
- True, if can be published.
-
publishService
public IFuture<java.lang.Void> publishService(IServiceIdentifier serviceid, PublishInfo info)
Publish a service.- Specified by:
publishService
in interfaceIPublishService
- Specified by:
publishService
in classAbstractRestPublishService
- Parameters:
cl
- The classloader.service
- The original service.pid
- The publish id (e.g. url or name).
-
getHttpServer
public java.lang.Object getHttpServer(java.net.URI uri, PublishInfo info)
Get or start an api to the http server.- Specified by:
getHttpServer
in classAbstractRestPublishService
-
unpublishService
public IFuture<java.lang.Void> unpublishService(IServiceIdentifier sid)
Unpublish a service.- Specified by:
unpublishService
in interfaceIPublishService
- Parameters:
sid
- The service identifier.
-
publishHMTLPage
public IFuture<java.lang.Void> publishHMTLPage(java.lang.String pid, java.lang.String vhost, java.lang.String html)
Publish a static page (without ressources).- Specified by:
publishHMTLPage
in interfaceIWebPublishService
-
publishResources
public IFuture<java.lang.Void> publishResources(java.lang.String uri, java.lang.String rootpath)
Publish file resources from the classpath.- Specified by:
publishResources
in interfaceIWebPublishService
-
publishExternal
public IFuture<java.lang.Void> publishExternal(java.net.URI uri, java.lang.String rootpath)
Publish file resources from the file system.
-
publishRedirect
public IFuture<java.lang.Void> publishRedirect(java.net.URI uri, java.lang.String html)
-
unpublish
public IFuture<java.lang.Void> unpublish(java.lang.String vhost, java.net.URI uri)
-
mirrorHttpServer
public IFuture<java.lang.Void> mirrorHttpServer(java.net.URI sourceserveruri, java.net.URI targetserveruri, PublishInfo info)
-
shutdownHttpServer
public IFuture<java.lang.Void> shutdownHttpServer(java.net.URI uri)
-
getServicesInfo
public java.lang.String getServicesInfo(jakarta.servlet.http.HttpServletRequest request, IPathHandler ph)
Produce overview site of published services.
-
convertUri
public java.net.URI convertUri(java.lang.String pid)
Convert the publish id to uri.
-
-