@Singleton @Path(value="/server") public class RestServiceServer extends AbstractServiceServer
| Constructor and Description |
|---|
RestServiceServer() |
| Modifier and Type | Method and Description |
|---|---|
javax.ws.rs.core.Response |
addService(javax.ws.rs.core.UriInfo uriInfo,
javax.servlet.http.HttpServletRequest request,
javax.ws.rs.core.HttpHeaders headers,
InputStream inputStream)
Adds a service described by the
ServiceDescriptor in the request content stream. |
protected IClassLoaderCreator |
getClassLoaderCreator() |
protected com.airepublic.microverse.core.descriptor.WebCall |
getHeartbeatWebCall(String serviceId,
String serviceVersion) |
protected String |
getMimeTypeForResponse(javax.ws.rs.core.HttpHeaders headers)
Gets the mime-type from the request header 'accept' to determine the content-type of the
response content.
|
protected String |
getMimeTypeFromRequest(javax.ws.rs.core.HttpHeaders headers)
Gets the mime-type from the request header 'content-type' to determine the mime-type of the
request content.
|
protected com.airepublic.microverse.core.descriptor.WebCall |
getServiceWebCall(String serviceId,
String serviceVersion) |
javax.ws.rs.core.Response |
getSupportedMediaTypes() |
javax.ws.rs.core.Response |
heartbeat()
This method should be called by a monitoring service to check whether this service-server is
still running.
|
void |
init() |
protected void |
onServiceRegistration(com.airepublic.microverse.core.descriptor.ServiceDescriptor serviceDescriptor) |
protected void |
onServiceUnregistration(com.airepublic.microverse.core.descriptor.ServiceDescriptor serviceDescriptor) |
javax.ws.rs.core.Response |
process(javax.ws.rs.core.HttpHeaders headers,
InputStream inputStream,
javax.ws.rs.core.UriInfo uriInfo)
Processes the request and answers to the response using the context information.
|
javax.ws.rs.core.Response |
removeService(javax.ws.rs.core.HttpHeaders headers,
String serviceId,
String serviceVersion)
Removes a service described by the
ServiceDescriptor in the request content stream. |
protected com.airepublic.microverse.core.descriptor.ServiceDescriptor |
unmarshalServiceDescriptor(javax.ws.rs.core.HttpHeaders headers,
InputStream inputStream)
Unmarshal the
ServiceDescriptor from the request input-stream. |
addService, close, getServiceDescriptors, getSupportedMimeTypes, process, removeService, unmarshal@PostConstruct public void init()
init in class AbstractServiceServerprotected IClassLoaderCreator getClassLoaderCreator()
getClassLoaderCreator in class AbstractServiceServer@Path(value="mediatypes") @GET @Produces(value="text/plain") public javax.ws.rs.core.Response getSupportedMediaTypes()
@Path(value="add")
@POST
public javax.ws.rs.core.Response addService(@Context
javax.ws.rs.core.UriInfo uriInfo,
@Context
javax.servlet.http.HttpServletRequest request,
@Context
javax.ws.rs.core.HttpHeaders headers,
InputStream inputStream)
ServiceDescriptor in the request content stream. If
no mime-type is set in the ServiceDescriptor the mime-type of the request will be set
as service mime-type.request - the requestheaders - the http-headersinputStream - the request content input streamprotected com.airepublic.microverse.core.descriptor.WebCall getServiceWebCall(String serviceId, String serviceVersion)
getServiceWebCall in class AbstractServiceServerprotected com.airepublic.microverse.core.descriptor.WebCall getHeartbeatWebCall(String serviceId, String serviceVersion)
getHeartbeatWebCall in class AbstractServiceServer@Path(value="remove/{serviceId}/{serviceVersion : .+}")
@POST
public javax.ws.rs.core.Response removeService(@Context
javax.ws.rs.core.HttpHeaders headers,
@PathParam(value="serviceId")
String serviceId,
@PathParam(value="serviceVersion")
String serviceVersion)
ServiceDescriptor in the request content stream.headers - the http-headersinputStream - the request content input streamprotected void onServiceRegistration(com.airepublic.microverse.core.descriptor.ServiceDescriptor serviceDescriptor)
onServiceRegistration in class AbstractServiceServerprotected void onServiceUnregistration(com.airepublic.microverse.core.descriptor.ServiceDescriptor serviceDescriptor)
onServiceUnregistration in class AbstractServiceServerprotected String getMimeTypeFromRequest(javax.ws.rs.core.HttpHeaders headers)
headers - the request headersprotected String getMimeTypeForResponse(javax.ws.rs.core.HttpHeaders headers)
headers - the request headersprotected com.airepublic.microverse.core.descriptor.ServiceDescriptor unmarshalServiceDescriptor(javax.ws.rs.core.HttpHeaders headers,
InputStream inputStream)
ServiceDescriptor from the request input-stream.headers - the request headersinputStream - the InputStreamServiceDescriptor@Path(value="process/{serviceClass : .+}")
@POST
public javax.ws.rs.core.Response process(@Context
javax.ws.rs.core.HttpHeaders headers,
InputStream inputStream,
@Context
javax.ws.rs.core.UriInfo uriInfo)
request - the requestresponse - the responsecontext - the context@Path(value="heartbeat") @GET public javax.ws.rs.core.Response heartbeat()
heartbeat in class AbstractServiceServerResponse OKCopyright © 2016. All rights reserved.