voyent
incorrect URL being formed by HttpAdapter  XML
Forum Index -> Contributor's Corner
Author Message
greg.hopkins

Joined: 12/Nov/2008 00:00:00
Messages: 1
Offline


I have found what I think is a small bug in HttpAdapter.

Here is a code snippet: (from 1.8.0, line 214)
Code:
 _connection =
                     (HttpURLConnection)
                         new URL(
                             "http",
                             localAddress,
                             localPort,
                             "/" +
                                 message.getStringProperty(
                                     Message.DESTINATION_SERVLET_CONTEXT_PATH) +
                                 "/block/message"
                         ).openConnection();
 


As you can see, the URL is being prefixed with a "/". After a great deal of debugging, I discovered that the String property in the message already has a leading "/", so the URL being formed is something like "//<app context>/block/message" for example. I am running on WebSphere 6.1, and get an error regarding the previously mentioned "//" not being available. I believe the error is happening on an HTTP GET.

I propose this change... does it make sense??
Code:
 String destinationServletContextPath = message.getStringProperty(Message.DESTINATION_SERVLET_CONTEXT_PATH);
 _connection =
                     (HttpURLConnection)
                         new URL(
                             "http",
                             localAddress,
                             localPort,
                             (desinationServletContextPath.charAt(0) == '/' ? "" : "/") + destinationServletContextPath +
                                 "/block/message"
                         ).openConnection();
 
jack.van.ooststroom


Joined: 26/Oct/2004 00:00:00
Messages: 223
Offline


The fix will be included in the up coming 1.8.1 release: ICE-4526

Thanks,

Jack van Ooststroom
Senior Developer
ICEsoft Technologies, Inc.
[Email]
 
Forum Index -> Contributor's Corner
Go to:   
Powered by JForum 2.1.7ice © JForum Team