< prev index next >
jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/transport/http/server/EndpointImpl.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 67,83 ****
import org.w3c.dom.Element;
/**
* Implements {@link Endpoint}.
! * <p/>
! * <p/>
* This class accumulates the information necessary to create
* {@link WSEndpoint}, and then when {@link #publish} method
* is called it will be created.
! * <p/>
! * <p/>
* This object also allows accumulated information to be retrieved.
*
* @author Jitendra Kotamraju
*/
public class EndpointImpl extends Endpoint {
--- 67,81 ----
import org.w3c.dom.Element;
/**
* Implements {@link Endpoint}.
! *
* This class accumulates the information necessary to create
* {@link WSEndpoint}, and then when {@link #publish} method
* is called it will be created.
! *
* This object also allows accumulated information to be retrieved.
*
* @author Jitendra Kotamraju
*/
public class EndpointImpl extends Endpoint {
*** 203,220 ****
--- 201,221 ----
implementor = null; // this violates the semantics, but hey, this is a backdoor.
implClass = null;
invoker = null;
}
+ @Override
public Binding getBinding() {
return binding;
}
+ @Override
public Object getImplementor() {
return implementor;
}
+ @Override
public void publish(String address) {
canPublish();
URL url;
try {
url = new URL(address);
*** 230,291 ****
}
createEndpoint(url.getPath());
((HttpEndpoint) actualEndpoint).publish(address);
}
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);
}
public void publish(HttpContext serverContext) {
canPublish();
createEndpoint(serverContext.getPath());
((HttpEndpoint) actualEndpoint).publish(serverContext);
}
public void stop() {
if (isPublished()) {
((HttpEndpoint) actualEndpoint).stop();
actualEndpoint = null;
stopped = true;
}
}
public boolean isPublished() {
return actualEndpoint != null;
}
public List<Source> getMetadata() {
return metadata;
}
public void setMetadata(java.util.List<Source> metadata) {
if (isPublished()) {
throw new IllegalStateException("Cannot set Metadata. Endpoint is already published");
}
this.metadata = metadata;
}
public Executor getExecutor() {
return executor;
}
public void setExecutor(Executor executor) {
this.executor = executor;
}
public Map<String, Object> getProperties() {
! return new HashMap<String, Object>(properties);
}
public void setProperties(Map<String, Object> map) {
! this.properties = new HashMap<String, Object>(map);
}
/*
* Checks the permission of "publishEndpoint" before accessing HTTP classes.
* Also it checks if there is an available HTTP server implementation.
--- 231,302 ----
}
createEndpoint(url.getPath());
((HttpEndpoint) actualEndpoint).publish(address);
}
+ @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);
}
+ @Override
public void publish(HttpContext serverContext) {
canPublish();
createEndpoint(serverContext.getPath());
((HttpEndpoint) actualEndpoint).publish(serverContext);
}
+ @Override
public void stop() {
if (isPublished()) {
((HttpEndpoint) actualEndpoint).stop();
actualEndpoint = null;
stopped = true;
}
}
+ @Override
public boolean isPublished() {
return actualEndpoint != null;
}
+ @Override
public List<Source> getMetadata() {
return metadata;
}
+ @Override
public void setMetadata(java.util.List<Source> metadata) {
if (isPublished()) {
throw new IllegalStateException("Cannot set Metadata. Endpoint is already published");
}
this.metadata = metadata;
}
+ @Override
public Executor getExecutor() {
return executor;
}
+ @Override
public void setExecutor(Executor executor) {
this.executor = executor;
}
+ @Override
public Map<String, Object> getProperties() {
! return new HashMap<>(properties);
}
+ @Override
public void setProperties(Map<String, Object> map) {
! this.properties = new HashMap<>(map);
}
/*
* Checks the permission of "publishEndpoint" before accessing HTTP classes.
* Also it checks if there is an available HTTP server implementation.
*** 333,359 ****
/**
* Convert metadata sources using identity transform. So that we can
* reuse the Source object multiple times.
*/
private List<SDDocumentSource> buildDocList() {
! List<SDDocumentSource> r = new ArrayList<SDDocumentSource>();
if (metadata != null) {
for (Source source : metadata) {
try {
XMLStreamBufferResult xsbr = XmlUtil.identityTransform(source, new XMLStreamBufferResult());
String systemId = source.getSystemId();
r.add(SDDocumentSource.create(new URL(systemId), xsbr.getXMLStreamBuffer()));
! } catch (TransformerException te) {
throw new ServerRtException("server.rt.err", te);
- } catch (IOException te) {
- throw new ServerRtException("server.rt.err", te);
- } catch (SAXException e) {
- throw new ServerRtException("server.rt.err", e);
- } catch (ParserConfigurationException e) {
- throw new ServerRtException("server.rt.err", e);
}
}
}
return r;
--- 344,364 ----
/**
* Convert metadata sources using identity transform. So that we can
* reuse the Source object multiple times.
*/
private List<SDDocumentSource> buildDocList() {
! List<SDDocumentSource> r = new ArrayList<>();
if (metadata != null) {
for (Source source : metadata) {
try {
XMLStreamBufferResult xsbr = XmlUtil.identityTransform(source, new XMLStreamBufferResult());
String systemId = source.getSystemId();
r.add(SDDocumentSource.create(new URL(systemId), xsbr.getXMLStreamBuffer()));
! } catch (TransformerException | IOException | SAXException | ParserConfigurationException te) {
throw new ServerRtException("server.rt.err", te);
}
}
}
return r;
*** 365,379 ****
private @Nullable SDDocumentSource getPrimaryWsdl(MetadataReader metadataReader) {
// Takes care of @WebService, @WebServiceProvider's wsdlLocation
EndpointFactory.verifyImplementorClass(implClass, metadataReader);
String wsdlLocation = EndpointFactory.getWsdlLocation(implClass, metadataReader);
if (wsdlLocation != null) {
- ClassLoader cl = implClass.getClassLoader();
- URL url = cl.getResource(wsdlLocation);
- if (url != null) {
- return SDDocumentSource.create(url);
- }
return SDDocumentSource.create(implClass, wsdlLocation);
}
return null;
}
--- 370,379 ----
*** 386,399 ****
--- 386,401 ----
throw new IllegalStateException(
"Cannot publish this endpoint. Endpoint has been already stopped.");
}
}
+ @Override
public EndpointReference getEndpointReference(Element...referenceParameters) {
return getEndpointReference(W3CEndpointReference.class, referenceParameters);
}
+ @Override
public <T extends EndpointReference> T getEndpointReference(Class<T> clazz, Element...referenceParameters) {
if (!isPublished()) {
throw new WebServiceException("Endpoint is not published yet");
}
return ((HttpEndpoint)actualEndpoint).getEndpointReference(clazz,referenceParameters);
*** 456,472 ****
@Override
public void start(@NotNull WSWebServiceContext wsc, @NotNull WSEndpoint endpoint) {
try {
spiInvoker.inject(wsc);
! } catch (IllegalAccessException e) {
! throw new WebServiceException(e);
! } catch (InvocationTargetException e) {
throw new WebServiceException(e);
}
}
public Object invoke(@NotNull Packet p, @NotNull Method m, @NotNull Object... args) throws InvocationTargetException, IllegalAccessException {
return spiInvoker.invoke(m, args);
}
}
}
--- 458,473 ----
@Override
public void start(@NotNull WSWebServiceContext wsc, @NotNull WSEndpoint endpoint) {
try {
spiInvoker.inject(wsc);
! } catch (IllegalAccessException | InvocationTargetException e) {
throw new WebServiceException(e);
}
}
+ @Override
public Object invoke(@NotNull Packet p, @NotNull Method m, @NotNull Object... args) throws InvocationTargetException, IllegalAccessException {
return spiInvoker.invoke(m, args);
}
}
}
< prev index next >