Class HttpRestServer

java.lang.Object
org.refcodes.observer.AbstractObservable<RestEndpoint,org.refcodes.web.HttpRequest>
org.refcodes.rest.AbstractRestfulServer
org.refcodes.rest.HttpRestServer
All Implemented Interfaces:
org.refcodes.component.Closable, org.refcodes.component.Closable.CloseBuilder<org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.web.HttpServerContext,RestfulHttpServer>>, org.refcodes.component.ConnectionComponent<org.refcodes.web.HttpServerContext>, org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.web.HttpServerContext,RestfulHttpServer>, org.refcodes.component.ConnectionOpenable<org.refcodes.web.HttpServerContext>, org.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<org.refcodes.web.HttpServerContext,org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.web.HttpServerContext,RestfulHttpServer>>, org.refcodes.component.ConnectionStatusAccessor, org.refcodes.component.LinkComponent, org.refcodes.component.Openable, org.refcodes.component.OpenedAccessor, org.refcodes.io.MaxConnectionsAccessor, org.refcodes.io.MaxConnectionsAccessor.MaxConnectionsBuilder<RestfulHttpServer>, org.refcodes.io.MaxConnectionsAccessor.MaxConnectionsMutator, org.refcodes.io.MaxConnectionsAccessor.MaxConnectionsProperty, org.refcodes.mixin.Disposable, org.refcodes.mixin.PortAccessor, org.refcodes.mixin.PortAccessor.PortBuilder<RestfulHttpServer>, org.refcodes.mixin.PortAccessor.PortMutator, org.refcodes.mixin.PortAccessor.PortProperty, org.refcodes.observer.Observable<RestEndpoint>, org.refcodes.observer.Observers<RestEndpoint,RestfulServer>, HttpExceptionHandlerAccessor, HttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder<RestfulHttpServer>, HttpExceptionHandlerAccessor.HttpExceptionHandlerMutator, HttpExceptionHandlerAccessor.HttpExceptionHandlerProperty, HttpExceptionHandlingAccessor, HttpExceptionHandlingAccessor.HttpExceptionHandlingBuilder<RestfulHttpServer>, HttpExceptionHandlingAccessor.HttpExceptionHandlingMutator, HttpExceptionHandlingAccessor.HttpExceptionHandlingProperty, RestfulHttpServer, RestfulServer, org.refcodes.security.KeyStoreDescriptorAccessor, org.refcodes.security.KeyStoreDescriptorAccessor.KeyStoreDescriptorBuilder<RestfulHttpServer>, org.refcodes.security.KeyStoreDescriptorAccessor.KeyStoreDescriptorMutator, org.refcodes.security.KeyStoreDescriptorAccessor.KeyStoreDescriptorProperty, org.refcodes.web.BaseLocatorAccessor, org.refcodes.web.BaseLocatorAccessor.BaseLocatorBuilder<RestfulServer>, org.refcodes.web.BaseLocatorAccessor.BaseLocatorMutator, org.refcodes.web.BaseLocatorAccessor.BaseLocatorProperty, org.refcodes.web.BasicAuthObservable<RestfulHttpServer>, org.refcodes.web.HttpsConnectionRequestObservable<RestfulHttpServer>, org.refcodes.web.HttpServerInterceptable, org.refcodes.web.MediaTypeFactoryLookup, org.refcodes.web.MediaTypeFactoryLookup.MutableMediaTypeFactoryLookup, org.refcodes.web.PostHttpInterceptable<org.refcodes.web.PostHttpServerInterceptor>, org.refcodes.web.PostHttpServerInterceptable, org.refcodes.web.PreHttpInterceptable<org.refcodes.web.PreHttpServerInterceptor>, org.refcodes.web.PreHttpServerInterceptable, org.refcodes.web.RealmAccessor, org.refcodes.web.RealmAccessor.RealmBuilder<RestfulServer>, org.refcodes.web.RealmAccessor.RealmMutator, org.refcodes.web.RealmAccessor.RealmProperty, org.refcodes.web.SchemeAccessor, org.refcodes.web.SchemeAccessor.SchemeBuilder<RestfulHttpServer>, org.refcodes.web.SchemeAccessor.SchemeMutator, org.refcodes.web.SchemeAccessor.SchemeProperty
Direct Known Subclasses:
HttpRestServerSingleton

public class HttpRestServer extends AbstractRestfulServer implements RestfulHttpServer
Implementation of the RestfulHttpServer interface using the RestfulHttpServer defined in the com.sun.net.httpserver package. The HttpRestServer is being initialized with some common MediaTypeFactory instances (as implemented by the AbstractRestfulServer). At the time of writing this document the MediaTypeFactory instances being preconfigured are:
  • JsonMediaTypeFactory
  • XmlMediaTypeFactory
  • TextMediaTypeFactory
  • FormMediaTypeFactory
The HttpRestServer supports HTTP as well as HTTPS protocols as being based on the RestfulHttpServer as well as on the HttpsServer. For opening up an HTTPS connection, refer to the methods such as RestfulHttpServer.open(String, KeyStoreDescriptor, int) or RestfulHttpServer.open(KeyStoreDescriptor, int) and the like. Set the system property SystemProperty.LOG_DEBUG to true (set when invoking the JRA by passing the argument -Dlog.debug=true to the java executable) to log additional erroneous situations e.g. related to content types and accept types alongside marshaling and unmarshaling.