Return-Path: Delivered-To: apmail-incubator-cxf-commits-archive@locus.apache.org Received: (qmail 21376 invoked from network); 17 Apr 2007 14:35:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Apr 2007 14:35:32 -0000 Received: (qmail 57127 invoked by uid 500); 17 Apr 2007 14:35:38 -0000 Delivered-To: apmail-incubator-cxf-commits-archive@incubator.apache.org Received: (qmail 57070 invoked by uid 500); 17 Apr 2007 14:35:37 -0000 Mailing-List: contact cxf-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cxf-dev@incubator.apache.org Delivered-To: mailing list cxf-commits@incubator.apache.org Received: (qmail 57051 invoked by uid 99); 17 Apr 2007 14:35:37 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Apr 2007 07:35:37 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Apr 2007 07:35:30 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id D224B1A9838; Tue, 17 Apr 2007 07:35:09 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r529624 - in /incubator/cxf/trunk: rt/transports/http/src/main/java/org/apache/cxf/transport/http/ rt/transports/http/src/test/java/org/apache/cxf/transport/http/ testutils/src/main/resources/wsdl/ Date: Tue, 17 Apr 2007 14:35:09 -0000 To: cxf-commits@incubator.apache.org From: eglynn@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070417143509.D224B1A9838@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: eglynn Date: Tue Apr 17 07:35:08 2007 New Revision: 529624 URL: http://svn.apache.org/viewvc?view=rev&rev=529624 Log: Reverting ClientServerTest.testBogusAddress() from a non-existant, but valid, URL back to a malformed URL. Changing HTTPConduit default URL construction strategy from upfront to on-demand, to avoid a premature MalformedURLException. Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world.wsdl Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java?view=diff&rev=529624&r1=529623&r2=529624 ============================================================================== --- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java (original) +++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java Tue Apr 17 07:35:08 2007 @@ -182,10 +182,17 @@ private final EndpointInfo endpointInfo; /** - * This field holds the "default" URL for this particular conduit, which + * This field holds the "default" address for this particular conduit, which * is set at construction. */ - private final URL defaultEndpointURL; + private final String defaultEndpointAddress; + + /** + * This field holds the "default" URL for this particular conduit, which + * is created on demand. + */ + private URL defaultEndpointURL; + private Destination decoupledDestination; private MessageObserver decoupledObserver; private int decoupledDestinationRefCount; @@ -253,25 +260,22 @@ /** * Constructor * - * @param associatedBus The associated Bus. - * @param endpoint The endpoint info of the initiator. - * @param epr The endpoint reference of the target. + * @param b the associated Bus. + * @param endpoint the endpoint info of the initiator. + * @param t the endpoint reference of the target. * @throws IOException */ - public HTTPConduit( - Bus associatedBus, - EndpointInfo endpoint, - EndpointReferenceType epr - ) throws IOException { - - super(getTargetReference(endpoint, epr, associatedBus)); - - bus = associatedBus; - endpointInfo = endpoint; - - defaultEndpointURL = epr == null - ? new URL(endpointInfo.getAddress()) - : new URL(epr.getAddress().getValue()); + public HTTPConduit(Bus b, + EndpointInfo ei, + EndpointReferenceType t) throws IOException { + super(getTargetReference(ei, t, b)); + + bus = b; + endpointInfo = ei; + + defaultEndpointAddress = t == null + ? ei.getAddress() + : t.getAddress().getValue(); initializeConfig(); } @@ -595,7 +599,7 @@ String pathInfo = (String)message.get(Message.PATH_INFO); String queryString = (String)message.get(Message.QUERY_STRING); - String result = value != null ? value : defaultEndpointURL.toString(); + String result = value != null ? value : getURL().toString(); // REVISIT: is this really correct? if (null != pathInfo && !result.endsWith(pathInfo)) { @@ -646,9 +650,28 @@ } /** - * @return the encapsulated URL + * @return the default target address */ - protected URL getURL() { + protected String getAddress() throws MalformedURLException { + return defaultEndpointAddress; + } + + /** + * @return the default target URL + */ + protected synchronized URL getURL() throws MalformedURLException { + return getURL(true); + } + + /** + * @param createOnDemand create URL on-demand if null + * @return the default target URL + */ + protected synchronized URL getURL(boolean createOnDemand) + throws MalformedURLException { + if (defaultEndpointURL == null && createOnDemand) { + defaultEndpointURL = new URL(defaultEndpointAddress); + } return defaultEndpointURL; } Modified: incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java?view=diff&rev=529624&r1=529623&r2=529624 ============================================================================== --- incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java (original) +++ incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java Tue Apr 17 07:35:08 2007 @@ -116,7 +116,13 @@ assertEquals("unexpected target", EndpointReferenceUtils.getAddress(ref), EndpointReferenceUtils.getAddress(target)); - assertEquals("unexpected URL", + + assertEquals("unexpected address", + conduit.getAddress(), + "http://nowhere.com/bar/foo"); + assertNull("unexpected upfront URL", + conduit.getURL(false)); + assertEquals("unexpected on-demand URL", conduit.getURL().getPath(), "/bar/foo"); } Modified: incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world.wsdl URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world.wsdl?view=diff&rev=529624&r1=529623&r2=529624 ============================================================================== --- incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world.wsdl (original) +++ incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world.wsdl Tue Apr 17 07:35:08 2007 @@ -392,7 +392,8 @@ - + +