You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ch...@apache.org on 2006/10/05 21:51:03 UTC

svn commit: r453338 - /webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java

Author: chuckw
Date: Thu Oct  5 12:51:03 2006
New Revision: 453338

URL: http://svn.apache.org/viewvc?view=rev&rev=453338
Log:
Correct interpretation of urls that access information about services in http transport to:
  1.  Work properly when contextRoot is "/" (consistent with
      ConfigurationContext.getServiceContextPath())
  2.  Ensure that relative links to services in the service html are always valid
      (requires redirecting to the correct form of the contextPath)

One side-effect of these fixes is that requests like ?wsdl and ?xsd must use
the correct full service context path, whereas before the code was a bit more liberal.
This change is however consistent with uri dispatching and seems the right thing to do.

All tests pass.  My application works and developers are happy (especially .Net users who
need to access the wsdl by url to update their web references).


Modified:
    webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java

Modified: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java?view=diff&rev=453338&r1=453337&r2=453338
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java (original)
+++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java Thu Oct  5 12:51:03 2006
@@ -56,8 +56,8 @@
             final MessageContext msgContext) throws HttpException, IOException {    
 
         ConfigurationContext configurationContext = msgContext.getConfigurationContext();
-        final String contextPath = "/" + configurationContext.getContextRoot() + "/";
         final String servicePath = configurationContext.getServiceContextPath();
+        final String contextPath = (servicePath.startsWith("/") ? servicePath : "/" + servicePath) + "/";
 
         HttpVersion ver = request.getRequestLine().getHttpVersion();
         String uri = request.getRequestLine().getUri();
@@ -96,8 +96,8 @@
                 return;
             }
             if (uri.indexOf("?") < 0) {
-                if (!(uri.endsWith(contextPath) || uri.endsWith(contextPath+"/"))) {
-                    String serviceName = uri.replaceAll(contextPath+"/", "");
+                if (!uri.endsWith(contextPath)) {
+                    String serviceName = uri.replace(contextPath, "");
                     if (serviceName.indexOf("/") < 0) {
                         String res = HTTPTransportReceiver.printServiceHTML(serviceName, configurationContext);
                         StringEntity entity = new StringEntity(res);



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Re: svn commit: r453338 - /webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java

Posted by Thilina Gunarathne <cs...@gmail.com>.
Hi Chuck,
Can you please have a look at this...

This is blocking me from  cutting  the release candidate...

~Thilina

On 10/6/06, Ruchith Fernando <ru...@gmail.com> wrote:
> Hi Chuck,
>
> > -                    String serviceName = uri.replaceAll(contextPath+"/", "");
> > +                if (!uri.endsWith(contextPath)) {
> > +                    String serviceName = uri.replace(contextPath, "");
> >                      if (serviceName.indexOf("/") < 0) {
>
> This only works with JDK 1.5 [1] :-(
>
> Thanks,
> Ruchith
>
> [1] http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html#replace(java.lang.CharSequence,%20java.lang.CharSequence)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-dev-help@ws.apache.org
>
>


-- 
http://webservices.apache.org/~thilina/
http://thilinag.blogspot.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


Re: svn commit: r453338 - /webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java

Posted by Ruchith Fernando <ru...@gmail.com>.
Hi Chuck,

> -                    String serviceName = uri.replaceAll(contextPath+"/", "");
> +                if (!uri.endsWith(contextPath)) {
> +                    String serviceName = uri.replace(contextPath, "");
>                      if (serviceName.indexOf("/") < 0) {

This only works with JDK 1.5 [1] :-(

Thanks,
Ruchith

[1] http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html#replace(java.lang.CharSequence,%20java.lang.CharSequence)

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org