Class ExternalRestPublishService

  • All Implemented Interfaces:
    IPublishService, IWebPublishService, IRequestHandlerService
    Direct Known Subclasses:
    NanoRestPublishService

    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
    • Field Detail

      • DEFAULT_HOST

        public static final java.lang.String DEFAULT_HOST
        The default host name.
        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
      • 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.
    • Constructor Detail

      • ExternalRestPublishService

        public ExternalRestPublishService()
    • Method Detail

      • handleRequest

        public IFuture<java.lang.Void> handleRequest​(javax.servlet.http.HttpServletRequest request,
                                                     javax.servlet.http.HttpServletResponse response,
                                                     java.lang.Object args)
        Handle the request.
        Specified by:
        handleRequest in interface IRequestHandlerService
        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 interface IPublishService
        Overrides:
        isSupported in class AbstractRestPublishService
        Parameters:
        publishtype - The type to test.
        Returns:
        True, if can be published.
      • 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 interface IWebPublishService
      • 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 interface IWebPublishService
      • 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​(javax.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.