@Override @SuppressWarnings("unchecked") protected <T> T doRefer(final Class<T> serviceType, final URL url) throws RpcException { ClientProxyFactoryBean proxyFactoryBean = new ClientProxyFactoryBean(); proxyFactoryBean.setAddress(url.setProtocol("http").toIdentityString()); proxyFactoryBean.setServiceClass(serviceType); proxyFactoryBean.setBus(bus); T ref = (T) proxyFactoryBean.create(); Client proxy = ClientProxy.getClient(ref); HTTPConduit conduit = (HTTPConduit) proxy.getConduit(); HTTPClientPolicy policy = new HTTPClientPolicy(); policy.setConnectionTimeout(url.getParameter(Constants.CONNECT_TIMEOUT_KEY, Constants.DEFAULT_CONNECT_TIMEOUT)); policy.setReceiveTimeout(url.getParameter(Constants.TIMEOUT_KEY, Constants.DEFAULT_TIMEOUT)); conduit.setClient(policy); return ref; }
/** * Close the conduit */ public void close() { if (clientSidePolicy != null) { clientSidePolicy.removePropertyChangeListener(this); } }
/** * Create an instance of {@link HTTPClientPolicy } * */ public HTTPClientPolicy createHTTPClientPolicy() { return new HTTPClientPolicy(); }
result &= (p1.isAllowChunking() == p2.isAllowChunking()) && (p1.isAutoRedirect() == p2.isAutoRedirect()) && StringUtils.equals(p1.getAccept(), p2.getAccept()) && StringUtils.equals(p1.getAcceptEncoding(), p2.getAcceptEncoding()) && StringUtils.equals(p1.getAcceptLanguage(), p2.getAcceptLanguage()) && StringUtils.equals(p1.getBrowserType(), p2.getBrowserType()); if (!result) { return false; result &= (p1.getCacheControl() == null ? p2.getCacheControl() == null : p1.getCacheControl() .equals(p2.getCacheControl()) && p1.getConnection().value().equals(p2.getConnection().value())) && (p1.getConnectionTimeout() == p2.getConnectionTimeout()) && StringUtils.equals(p1.getContentType(), p2.getContentType()) && StringUtils.equals(p1.getCookie(), p2.getCookie()) && StringUtils.equals(p1.getDecoupledEndpoint(), p2.getDecoupledEndpoint()) && StringUtils.equals(p1.getHost(), p2.getHost()); if (!result) { return false; result &= StringUtils.equals(p1.getProxyServer(), p2.getProxyServer()) && (p1.isSetProxyServerPort() ? p1.getProxyServerPort() == p2.getProxyServerPort() : !p2 .isSetProxyServerPort()) && p1.getProxyServerType().value().equals(p2.getProxyServerType().value()) && (p1.getConnectionRequestTimeout() == p2.getConnectionRequestTimeout()) && (p1.getReceiveTimeout() == p2.getReceiveTimeout()) && StringUtils.equals(p1.getReferer(), p2.getReferer());
/** * Construct a new {@code Proxy} instance from the given policy. */ private Proxy createProxy(final HTTPClientPolicy policy) { return new Proxy(Proxy.Type.valueOf(policy.getProxyServerType().toString()), new InetSocketAddress(policy.getProxyServer(), policy.getProxyServerPort())); } }
/** * This method sets the Client Side Policy for this HTTPConduit. Using this * method will override any HTTPClientPolicy set in configuration. */ public void setClient(HTTPClientPolicy client) { if (this.clientSidePolicy != null) { this.clientSidePolicy.removePropertyChangeListener(this); } this.clientSidePolicyCalced = true; this.clientSidePolicy = client; clientSidePolicy.removePropertyChangeListener(this); //make sure we aren't added twice clientSidePolicy.addPropertyChangeListener(this); endpointInfo.setProperty("org.apache.cxf.ws.addressing.replyto", client.getDecoupledEndpoint()); }
public static String toString(HTTPClientPolicy p) { StringBuilder buf = new StringBuilder(); buf.append(p); buf.append("[DecoupledEndpoint=\""); buf.append(p.getDecoupledEndpoint()); buf.append("\", ReceiveTimeout="); buf.append(p.getReceiveTimeout()); buf.append("])"); return buf.toString(); } }
public QName getDataClassName() { return new ObjectFactory().createServer(null).getName(); }
public QName getDataClassName() { return new ObjectFactory().createClient(null).getName(); }
public static String toString(HTTPServerPolicy p) { StringBuilder buf = new StringBuilder(); buf.append(p); buf.append("[ContentType=\""); buf.append(p.getContentType()); buf.append("\", ReceiveTimeout="); buf.append(p.getReceiveTimeout()); buf.append("])"); return buf.toString(); } }
@Override public void thresholdReached() { if (chunking) { connection.setChunkedStreamingMode( URLConnectionHTTPConduit.this.getClient().getChunkLength()); } } @Override
/** * This call gets called by the HTTPTransportFactory after it * causes an injection of the Spring configuration properties * of this Conduit. */ public void finalizeConfig() { // See if not set by configuration, if there are defaults // in order from the Endpoint, Service, or Bus. configureConduitFromEndpointInfo(this, endpointInfo); logConfig(); if (getClient().getDecoupledEndpoint() != null) { this.endpointInfo.setProperty("org.apache.cxf.ws.addressing.replyto", getClient().getDecoupledEndpoint()); } }
/** * Gets the value of the proxyServerType property. * <p> * Specifies the type of the proxy server. Can be either HTTP or SOCKS. * */ public ProxyServerType getProxyServerType() { if (null == proxyServerType) { return ProxyServerType.fromValue("HTTP"); } return proxyServerType; }
/** * Gets the value of the connection property. * <p> * The connection disposition. If close the connection to the server is closed * after each request/response dialog. If Keep-Alive the client requests the server * to keep the connection open, and if the server honors the keep alive request, * the connection is reused. Many servers and proxies do not honor keep-alive requests. * */ public ConnectionType getConnection() { if (null == connection) { return ConnectionType.fromValue("Keep-Alive"); } return connection; }
/** * Create an instance of {@link HTTPServerPolicy } * */ public HTTPServerPolicy createHTTPServerPolicy() { return new HTTPServerPolicy(); }
public String value() { return name(); }
public static ProxyServerType fromValue(String v) { return valueOf(v); }
public static ConnectionType fromValue(String v) { for (ConnectionType c: ConnectionType.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); }
private int getMaxRetransmits() { HTTPClientPolicy policy = getClient(outMessage); // Default MaxRetransmits is -1 which means unlimited. return (policy == null) ? -1 : policy.getMaxRetransmits(); }
@Override @SuppressWarnings("unchecked") protected <T> T doRefer(final Class<T> serviceType, final URL url) throws RpcException { ClientProxyFactoryBean proxyFactoryBean = new ClientProxyFactoryBean(); proxyFactoryBean.setAddress(url.setProtocol("http").toIdentityString()); proxyFactoryBean.setServiceClass(serviceType); proxyFactoryBean.setBus(bus); T ref = (T) proxyFactoryBean.create(); Client proxy = ClientProxy.getClient(ref); HTTPConduit conduit = (HTTPConduit) proxy.getConduit(); HTTPClientPolicy policy = new HTTPClientPolicy(); policy.setConnectionTimeout(url.getParameter(Constants.CONNECT_TIMEOUT_KEY, Constants.DEFAULT_CONNECT_TIMEOUT)); policy.setReceiveTimeout(url.getParameter(Constants.TIMEOUT_KEY, Constants.DEFAULT_TIMEOUT)); conduit.setClient(policy); return ref; }