Package jadex.extension.rs.publish
Class GrizzlyRestServicePublishService
- java.lang.Object
-
- jadex.extension.rs.publish.AbstractRestServicePublishService
-
- jadex.extension.rs.publish.GrizzlyRestServicePublishService
-
- All Implemented Interfaces:
IPublishService
,IWebPublishService
public class GrizzlyRestServicePublishService extends AbstractRestServicePublishService
The default web service publish service. Publishes web services using the Grizzly web server.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GrizzlyRestServicePublishService.HtmlHandler
Allow responding with different htmls based on virtual host name.static class
GrizzlyRestServicePublishService.MainHttpHandler
Main handler dealing with incoming request more intelligently than Grizzly does.static class
GrizzlyRestServicePublishService.RedirectErrorPageGenerator
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.Integer,Tuple2<GrizzlyRestServicePublishService.MainHttpHandler,org.glassfish.grizzly.http.server.HttpServer>>
portservers
The servers per port.protected java.util.Map<IServiceIdentifier,Tuple2<org.glassfish.grizzly.http.server.HttpServer,java.net.URI>>
sidservers
The servers per service id.-
Fields inherited from class jadex.extension.rs.publish.AbstractRestServicePublishService
component, DEFAULT_FORMATS, FORMATS, GENERATE, GENERATE_INFO, generator, JADEXSERVICE, proxyclasses
-
Fields inherited from interface jadex.bridge.service.types.publish.IPublishService
DEFAULT_RSPUBLISH_COMPONENTS, PUBLISH_RS, PUBLISH_WS
-
-
Constructor Summary
Constructors Constructor Description GrizzlyRestServicePublishService()
Create a new publish service.GrizzlyRestServicePublishService(IRestMethodGenerator generator)
Create a new publish service.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tuple2<GrizzlyRestServicePublishService.MainHttpHandler,org.glassfish.grizzly.http.server.HttpServer>
getHttpServer(java.net.URI uri, PublishInfo info)
Get or start an api to the http server.void
internalPublishService(java.net.URI uri, org.glassfish.jersey.server.ResourceConfig rc, IServiceIdentifier sid, PublishInfo info)
boolean
isPublished(IServiceIdentifier sid)
Test if a service is published.IFuture<java.lang.Void>
mirrorHttpServer(java.net.URI sourceserveruri, java.net.URI targetserveruri, PublishInfo info)
Mirror an existing http server.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 an html page.xIFuture<java.lang.Void>
publishRedirect(java.net.URI uri, java.lang.String html)
Publish permanent redirect.IFuture<java.lang.Void>
publishResources(java.lang.String uri, java.lang.String path)
Publish resources via a rel jar path.IFuture<java.lang.Void>
shutdownHttpServer(java.net.URI uri)
Explicitely terminated an existing http server.protected org.glassfish.grizzly.http.server.HttpServer
startServer(java.net.URI uri, PublishInfo info, java.lang.String errorpagefallback)
Starts a server.IFuture<java.lang.Void>
unpublish(java.lang.String vhost, java.net.URI uri)
Unpublish an already-published handler.IFuture<java.lang.Void>
unpublishService(IServiceIdentifier sid)
Unpublish a service.-
Methods inherited from class jadex.extension.rs.publish.AbstractRestServicePublishService
addMapping, createProxyClass, digest, digest, getProxyClass, getServiceInfo, hex, initWebProxyRefresh, invoke, isSupported, login, parseHeader, publishService
-
-
-
-
Field Detail
-
sidservers
protected java.util.Map<IServiceIdentifier,Tuple2<org.glassfish.grizzly.http.server.HttpServer,java.net.URI>> sidservers
The servers per service id.
-
portservers
protected java.util.Map<java.lang.Integer,Tuple2<GrizzlyRestServicePublishService.MainHttpHandler,org.glassfish.grizzly.http.server.HttpServer>> portservers
The servers per port.
-
-
Constructor Detail
-
GrizzlyRestServicePublishService
public GrizzlyRestServicePublishService()
Create a new publish service.
-
GrizzlyRestServicePublishService
public GrizzlyRestServicePublishService(IRestMethodGenerator generator)
Create a new publish service.
-
-
Method Detail
-
internalPublishService
public void internalPublishService(java.net.URI uri, org.glassfish.jersey.server.ResourceConfig rc, IServiceIdentifier sid, PublishInfo info)
- Specified by:
internalPublishService
in classAbstractRestServicePublishService
-
getHttpServer
public Tuple2<GrizzlyRestServicePublishService.MainHttpHandler,org.glassfish.grizzly.http.server.HttpServer> getHttpServer(java.net.URI uri, PublishInfo info)
Get or start an api to the http server.
-
mirrorHttpServer
public IFuture<java.lang.Void> mirrorHttpServer(java.net.URI sourceserveruri, java.net.URI targetserveruri, PublishInfo info)
Mirror an existing http server.- Parameters:
sourceserveruri
- The URI of the server being mirrored.targetserveruri
- The URI of the mirror server.info
- Publish infos for the mirror server.
-
shutdownHttpServer
public IFuture<java.lang.Void> shutdownHttpServer(java.net.URI uri)
Explicitely terminated an existing http server.- Parameters:
uri
- URI of the server.
-
publishRedirect
public IFuture<java.lang.Void> publishRedirect(java.net.URI uri, java.lang.String html)
Publish permanent redirect.
-
publishHMTLPage
public IFuture<java.lang.Void> publishHMTLPage(java.lang.String pid, java.lang.String vhost, java.lang.String html)
Publish an html page.x- Specified by:
publishHMTLPage
in interfaceIWebPublishService
- Specified by:
publishHMTLPage
in classAbstractRestServicePublishService
-
publishResources
public IFuture<java.lang.Void> publishResources(java.lang.String uri, java.lang.String path)
Publish resources via a rel jar path. The resources are searched with respect to the component classloader (todo: allow for specifiying RID).- Specified by:
publishResources
in interfaceIWebPublishService
- Specified by:
publishResources
in classAbstractRestServicePublishService
-
publishExternal
public IFuture<java.lang.Void> publishExternal(java.net.URI uri, java.lang.String rootpath)
Publish file resources from the file system.- Specified by:
publishExternal
in classAbstractRestServicePublishService
-
unpublishService
public IFuture<java.lang.Void> unpublishService(IServiceIdentifier sid)
Unpublish a service.- Specified by:
unpublishService
in interfaceIPublishService
- Specified by:
unpublishService
in classAbstractRestServicePublishService
- Parameters:
sid
- The service identifier.
-
unpublish
public IFuture<java.lang.Void> unpublish(java.lang.String vhost, java.net.URI uri)
Unpublish an already-published handler.- Parameters:
vhost
- The virtual host, if any, null for general.uti
- The uri being unpublished.
-
isPublished
public boolean isPublished(IServiceIdentifier sid)
Test if a service is published.- Specified by:
isPublished
in classAbstractRestServicePublishService
-
startServer
protected org.glassfish.grizzly.http.server.HttpServer startServer(java.net.URI uri, PublishInfo info, java.lang.String errorpagefallback) throws java.lang.Exception
Starts a server.- Parameters:
uri
- The server URI.info
- Publish infos.errorpagefallback
- Error page URL fallback if not provided in publish infos.- Returns:
- The server.
- Throws:
java.lang.Exception
-
-