javax.xml.ws.spi.http.HttpContext Java Examples

The following examples show how to use javax.xml.ws.spi.http.HttpContext. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EndpointAPITest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@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] = GrizzlyHttpContextFactory.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();
    }
}
 
Example #2
Source File: EndpointAPITest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@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] = GrizzlyHttpContextFactory.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();
    }
}
 
Example #3
Source File: EndpointAPITest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testMultiplePublishSameAddress() throws Exception {
    server.start();
    String contextPath = "/ctxt";
    String path = "/echo";
    //need to use the same HttpContext, otherwise Grizzly get confused
    HttpContext ctx = GrizzlyHttpContextFactory.createHttpContext(server, contextPath, path);
    for (int i = 0; i < 3; i++) {
        String address = "http://localhost:" + currentPort + contextPath + path;

        Endpoint endpoint = Endpoint.create(new EndpointBean());
        endpoint.publish(ctx); // Use grizzly HTTP context for publishing

        invokeEndpoint(address);

        endpoint.stop();
    }
}
 
Example #4
Source File: EndpointImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example #5
Source File: JAXWSHttpSpiDestinationTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
    control = EasyMock.createNiceControl();
    bus = control.createMock(Bus.class);
    bus.getExtension(org.apache.cxf.policy.PolicyDataEngine.class);
    EasyMock.expectLastCall().andReturn(null).anyTimes();
    observer = control.createMock(MessageObserver.class);
    context = control.createMock(HttpContext.class);
    endpoint = new EndpointInfo();
    endpoint.setAddress(ADDRESS);
}
 
Example #6
Source File: JAXWSHttpSpiTransportFactoryTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
    control = EasyMock.createNiceControl();
    context = control.createMock(HttpContext.class);
    bus = control.createMock(Bus.class);
    factory = new JAXWSHttpSpiTransportFactory(context);
}
 
Example #7
Source File: EndpointImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example #8
Source File: EndpointImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example #9
Source File: EndpointImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example #10
Source File: EndpointImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@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);
}
 
Example #11
Source File: EndpointImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example #12
Source File: EndpointImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example #13
Source File: EndpointImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example #14
Source File: EndpointImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public void publish(HttpContext serverContext) {
    canPublish();
    createEndpoint(serverContext.getPath());
    ((HttpEndpoint) actualEndpoint).publish(serverContext);
}
 
Example #15
Source File: EndpointImpl.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public void publish(HttpContext serverContext) {
    canPublish();
    createEndpoint(serverContext.getPath());
    ((HttpEndpoint) actualEndpoint).publish(serverContext);
}
 
Example #16
Source File: JAXWSHttpSpiTransportFactory.java    From cxf with Apache License 2.0 4 votes vote down vote up
public JAXWSHttpSpiTransportFactory(HttpContext context) {
    super();
    this.context = context;
}
 
Example #17
Source File: EndpointImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public void publish(HttpContext serverContext) {
    canPublish();
    createEndpoint(serverContext.getPath());
    ((HttpEndpoint) actualEndpoint).publish(serverContext);
}
 
Example #18
Source File: EndpointAPITest.java    From cxf with Apache License 2.0 4 votes vote down vote up
@Test
public void testSingleEndpoint() throws Exception {

    String contextPath = "/ctxt";
    String path = "/echo";
    String address = "http://localhost:" + currentPort + contextPath + path;

    HttpContext context = GrizzlyHttpContextFactory.createHttpContext(server, contextPath, path);

    Endpoint endpoint = Endpoint.create(new EndpointBean());
    endpoint.publish(context); // Use grizzly HTTP context for publishing

    server.start();

    invokeEndpoint(address);

    endpoint.stop();
}
 
Example #19
Source File: EndpointImpl.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public void publish(HttpContext serverContext) {
    canPublish();
    createEndpoint(serverContext.getPath());
    ((HttpEndpoint) actualEndpoint).publish(serverContext);
}
 
Example #20
Source File: EndpointImpl.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public void publish(HttpContext serverContext) {
    canPublish();
    createEndpoint(serverContext.getPath());
    ((HttpEndpoint) actualEndpoint).publish(serverContext);
}
 
Example #21
Source File: EndpointImpl.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public void publish(HttpContext serverContext) {
    canPublish();
    createEndpoint(serverContext.getPath());
    ((HttpEndpoint) actualEndpoint).publish(serverContext);
}
 
Example #22
Source File: EndpointImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void publish(HttpContext serverContext) {
    canPublish();
    createEndpoint(serverContext.getPath());
    ((HttpEndpoint) actualEndpoint).publish(serverContext);
}
 
Example #23
Source File: EndpointImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public void publish(HttpContext serverContext) {
    canPublish();
    createEndpoint(serverContext.getPath());
    ((HttpEndpoint) actualEndpoint).publish(serverContext);
}
 
Example #24
Source File: Endpoint.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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.");
}
 
Example #25
Source File: Endpoint.java    From JDKSourceCode1.8 with MIT License 2 votes vote down vote up
/**
 * 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.");
}
 
Example #26
Source File: Endpoint.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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.");
}
 
Example #27
Source File: Endpoint.java    From jdk8u60 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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.");
}
 
Example #28
Source File: Endpoint.java    From Java8CN with Apache License 2.0 2 votes vote down vote up
/**
 * 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.");
}
 
Example #29
Source File: Endpoint.java    From openjdk-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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.");
}
 
Example #30
Source File: Endpoint.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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.");
}