本文整理汇总了Java中javax.xml.ws.spi.http.HttpContext类的典型用法代码示例。如果您正苦于以下问题:Java HttpContext类的具体用法?Java HttpContext怎么用?Java HttpContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HttpContext类属于javax.xml.ws.spi.http包,在下文中一共展示了HttpContext类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testMultiplePublishSameAddress
import javax.xml.ws.spi.http.HttpContext; //导入依赖的package包/类
@Test
public void testMultiplePublishSameAddress() throws Exception
{
server.start();
String contextPath = "/ctxt";
String path = "/echo";
for (int i = 0; i < 3; i++)
{
HttpContext ctx = UndertowContextFactory.createHttpContext(server, contextPath, path);
String address = "http://localhost:" + currentPort + contextPath + path;
Endpoint endpoint = Endpoint.create(new EndpointBean());
endpoint.publish(ctx); // Use httpserver context for publishing
invokeEndpoint(address);
endpoint.stop();
}
}
示例2: testMultipleEndpointsSameContext
import javax.xml.ws.spi.http.HttpContext; //导入依赖的package包/类
@Test
public void testMultipleEndpointsSameContext() throws Exception
{
server.start();
String contextPath = "/ctxt";
String path = "/echo";
int k = 3;
Endpoint[] endpoints = new Endpoint[k];
HttpContext[] contexts = new HttpContext[k];
String[] addresses = new String[k];
for (int i = 0; i < k; i++)
{
addresses[i] = "http://localhost:" + currentPort + contextPath + path + i;
contexts[i] = UndertowContextFactory.createHttpContext(server, contextPath, path + i);
endpoints[i] = Endpoint.create(new EndpointBean());
endpoints[i].publish(contexts[i]);
}
for (int i = 0; i < k; i++)
{
invokeEndpoint(addresses[i]);
}
for (int i = 0; i < k; i++)
{
endpoints[i].stop();
}
}
示例3: testMultipleEndpointsDifferentContexts
import javax.xml.ws.spi.http.HttpContext; //导入依赖的package包/类
@Test
public void testMultipleEndpointsDifferentContexts() throws Exception
{
server.start();
String contextPath = "/ctxt";
String path = "/echo";
int k = 3;
Endpoint[] endpoints = new Endpoint[k];
HttpContext[] contexts = new HttpContext[k];
String[] addresses = new String[k];
for (int i = 0; i < k; i++)
{
addresses[i] = "http://localhost:" + currentPort + contextPath + i + path;
contexts[i] = UndertowContextFactory.createHttpContext(server, contextPath + i, path);
endpoints[i] = Endpoint.create(new EndpointBean());
endpoints[i].publish(contexts[i]);
}
for (int i = 0; i < k; i++)
{
invokeEndpoint(addresses[i]);
}
for (int i = 0; i < k; i++)
{
endpoints[i].stop();
}
}
示例4: publish
import javax.xml.ws.spi.http.HttpContext; //导入依赖的package包/类
public void publish(Object serverContext) {
canPublish();
if (!com.sun.net.httpserver.HttpContext.class.isAssignableFrom(serverContext.getClass())) {
throw new IllegalArgumentException(serverContext.getClass() + " is not a supported context.");
}
createEndpoint(((com.sun.net.httpserver.HttpContext)serverContext).getPath());
((HttpEndpoint) actualEndpoint).publish(serverContext);
}
示例5: publish
import javax.xml.ws.spi.http.HttpContext; //导入依赖的package包/类
@Override
public void publish(Object serverContext) {
canPublish();
if (!com.sun.net.httpserver.HttpContext.class.isAssignableFrom(serverContext.getClass())) {
throw new IllegalArgumentException(serverContext.getClass() + " is not a supported context.");
}
createEndpoint(((com.sun.net.httpserver.HttpContext)serverContext).getPath());
((HttpEndpoint) actualEndpoint).publish(serverContext);
}
示例6: getHttpContext
import javax.xml.ws.spi.http.HttpContext; //导入依赖的package包/类
@Override
public HttpContext getHttpContext()
{
if (context == null)
{
context = new UndertowHttpContext(new PathHandler(), PathUtils.getContextPathFromRequest(undertowExchange.getRequestPath()),
PathUtils.getPathFromRequest(undertowExchange.getRequestPath()));
}
return context;
}
示例7: createHttpContext
import javax.xml.ws.spi.http.HttpContext; //导入依赖的package包/类
public static HttpContext createHttpContext(UndertowServer server, String contextPath, String path)
{
return new UndertowHttpContext(server.getPathHandler(), contextPath, path);
}
示例8: testSingleEndpoint
import javax.xml.ws.spi.http.HttpContext; //导入依赖的package包/类
@Test
public void testSingleEndpoint() throws Exception
{
String contextPath = "/ctxt";
String path = "/echo";
String address = "http://localhost:" + currentPort + contextPath + path;
HttpContext context = UndertowContextFactory.createHttpContext(server, contextPath, path);
Endpoint endpoint = Endpoint.create(new EndpointBean());
endpoint.publish(context); // Use httpserver context for publishing
server.start();
invokeEndpoint(address);
endpoint.stop();
}
示例9: publish
import javax.xml.ws.spi.http.HttpContext; //导入依赖的package包/类
/**
* Publishes this endpoint at the provided server context.
* A server context encapsulates the server infrastructure
* and addressing information for a particular transport.
* For a call to this method to succeed, the server context
* passed as an argument to it MUST be compatible with the
* endpoint's binding.
*
* <p>
* This is meant for container developers to publish the
* the endpoints portably and not intended for the end
* developers.
*
*
* @param serverContext An object representing a server
* context to be used for publishing the endpoint.
*
* @throws java.lang.IllegalArgumentException
* If the provided server context is not
* supported by the implementation or turns
* out to be unusable in conjunction with the
* endpoint's binding.
*
* @throws java.lang.IllegalStateException
* If the endpoint has been published already or it has been stopped.
*
* @throws java.lang.SecurityException
* If a <code>java.lang.SecurityManger</code>
* is being used and the application doesn't have the
* <code>WebServicePermission("publishEndpoint")</code> permission.
* @since JAX-WS 2.2
*/
public void publish(HttpContext serverContext) {
throw new UnsupportedOperationException("JAX-WS 2.2 implementation must override this default behaviour.");
}
示例10: publish
import javax.xml.ws.spi.http.HttpContext; //导入依赖的package包/类
/**
* Publishes this endpoint at the provided server context.
* A server context encapsulates the server infrastructure
* and addressing information for a particular transport.
* For a call to this method to succeed, the server context
* passed as an argument to it MUST be compatible with the
* endpoint's binding.
*
* <p>
* This is meant for container developers to publish the
* the endpoints portably and not intended for the end
* developers.
*
*
* @param serverContext An object representing a server
* context to be used for publishing the endpoint.
*
* @throws java.lang.IllegalArgumentException
* If the provided server context is not
* supported by the implementation or turns
* out to be unusable in conjunction with the
* endpoint's binding.
*
* @throws java.lang.IllegalStateException
* If the endpoint has been published already or it has been stopped.
*
* @throws java.lang.SecurityException
* If a {@code java.lang.SecurityManger}
* is being used and the application doesn't have the
* {@code WebServicePermission("publishEndpoint")} permission.
* @since 1.7, JAX-WS 2.2
*/
public void publish(HttpContext serverContext) {
throw new UnsupportedOperationException("JAX-WS 2.2 implementation must override this default behaviour.");
}