Class HttpContextBuilder
java.lang.Object
org.jboss.resteasy.plugins.server.sun.http.HttpContextBuilder
Helper class to create a ResteasyDeployment and bind it to an HttpContext of an HttpServer. Setting the SecurityDomain
will turn on Basic Authentication. Right now, only BasicAuthentication is supported.
HttpContext.getAttributes() data is available within Providers and Resources by injecting a ResteasyConfiguration interface
HttpServer httpServer = HttpServer.create(new InetSocketAddress(port), 10);
contextBuilder = new HttpContextBuilder();
contextBuilder.getDeployment().getActualResourceClasses().add(SimpleResource.class);
HttpContext context = contextBuilder.bind(httpServer);
context.getAttributes().put("some.config.info", "42");
httpServer.start();
contextBuilder.cleanup();
httpServer.stop(0);
Create your HttpServer the way you want then use the org.jboss.resteasy.plugins.server.sun.http.HttpContextBuilder to
initialize Resteasy
and bind it to an HttpContext. The HttpContext attributes are available by injecting in a
org.jboss.resteasy.spi.ResteasyConfiguration
interface using @Context within your provider and resource classes.- Author:
- Bill Burke* @version $Revision: 1 $
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected HttpContextprotected ResteasyDeploymentprotected ResteasyHttpHandlerprotected Stringprotected SecurityDomain -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbind(HttpServer server) voidcleanup()getPath()voidsetDeployment(ResteasyDeployment deployment) voidPath to bind contextvoidsetSecurityDomain(SecurityDomain securityDomain) Will turn on Basic Authentication
-
Field Details
-
deployment
-
path
-
handler
-
securityDomain
-
boundContext
-
-
Constructor Details
-
HttpContextBuilder
public HttpContextBuilder()
-
-
Method Details
-
getDeployment
-
setDeployment
-
getPath
-
setPath
Path to bind context- Parameters:
path-
-
getSecurityDomain
-
setSecurityDomain
Will turn on Basic Authentication- Parameters:
securityDomain-
-
bind
-
cleanup
public void cleanup()
-