Created: (CXF-1717) URI returned by UriInfo.getAbsolutePath only contains relative portion of the URI

View: New views
9 Messages — Rating Filter:   Alert me  

Created: (CXF-1717) URI returned by UriInfo.getAbsolutePath only contains relative portion of the URI

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

URI returned by UriInfo.getAbsolutePath only contains relative portion of the URI
---------------------------------------------------------------------------------

                 Key: CXF-1717
                 URL: https://issues.apache.org/jira/browse/CXF-1717
             Project: CXF
          Issue Type: Bug
          Components: REST
    Affects Versions: 2.1.1
         Environment: Tomcat 6.x running on Windows XP and Java 1.6
            Reporter: Bill Simons


With a class like:

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Updated: (CXF-1717) URI returned by UriInfo.getAbsolutePath only contains relative portion of the URI

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ https://issues.apache.org/jira/browse/CXF-1717?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bill Simons updated CXF-1717:
-----------------------------

    Description:
With a class like:

@Path("/helloWorld")
public class HelloWorldResource {
    @Context
    private UriInfo context;
   
    /** Creates a new instance of HelloWorldResource */
    public HelloWorldResource() {
    }

    /**
     * Retrieves representation of an instance of helloworld.HelloWorldResource
     * @return an instance of java.lang.String
     */
    @GET
    @ProduceMime("text/plain")
    public String getXml() {
        return context.getAbsolutePath().toString();
    }
}

The String returned by the context.getAbsolutePath().toString only contains the path( /helloWorld )portion of the URI. It should contain the full URI (http://localhost:8080/helloWorld).

  was:With a class like:


updated description... hit submit too early

> URI returned by UriInfo.getAbsolutePath only contains relative portion of the URI
> ---------------------------------------------------------------------------------
>
>                 Key: CXF-1717
>                 URL: https://issues.apache.org/jira/browse/CXF-1717
>             Project: CXF
>          Issue Type: Bug
>          Components: REST
>    Affects Versions: 2.1.1
>         Environment: Tomcat 6.x running on Windows XP and Java 1.6
>            Reporter: Bill Simons
>
> With a class like:
> @Path("/helloWorld")
> public class HelloWorldResource {
>     @Context
>     private UriInfo context;
>    
>     /** Creates a new instance of HelloWorldResource */
>     public HelloWorldResource() {
>     }
>     /**
>      * Retrieves representation of an instance of helloworld.HelloWorldResource
>      * @return an instance of java.lang.String
>      */
>     @GET
>     @ProduceMime("text/plain")
>     public String getXml() {
>         return context.getAbsolutePath().toString();
>     }
> }
> The String returned by the context.getAbsolutePath().toString only contains the path( /helloWorld )portion of the URI. It should contain the full URI (http://localhost:8080/helloWorld).

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Resolved: (CXF-1717) URI returned by UriInfo.getAbsolutePath only contains relative portion of the URI

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ https://issues.apache.org/jira/browse/CXF-1717?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin resolved CXF-1717.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.1.2

This is now fixed with a system test in place - feel free to reopen if it does not work in your case

> URI returned by UriInfo.getAbsolutePath only contains relative portion of the URI
> ---------------------------------------------------------------------------------
>
>                 Key: CXF-1717
>                 URL: https://issues.apache.org/jira/browse/CXF-1717
>             Project: CXF
>          Issue Type: Bug
>          Components: REST
>    Affects Versions: 2.1.1
>         Environment: Tomcat 6.x running on Windows XP and Java 1.6
>            Reporter: Bill Simons
>             Fix For: 2.1.2
>
>
> With a class like:
> @Path("/helloWorld")
> public class HelloWorldResource {
>     @Context
>     private UriInfo context;
>    
>     /** Creates a new instance of HelloWorldResource */
>     public HelloWorldResource() {
>     }
>     /**
>      * Retrieves representation of an instance of helloworld.HelloWorldResource
>      * @return an instance of java.lang.String
>      */
>     @GET
>     @ProduceMime("text/plain")
>     public String getXml() {
>         return context.getAbsolutePath().toString();
>     }
> }
> The String returned by the context.getAbsolutePath().toString only contains the path( /helloWorld )portion of the URI. It should contain the full URI (http://localhost:8080/helloWorld).

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Commented: (CXF-1717) URI returned by UriInfo.getAbsolutePath only contains relative portion of the URI

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/CXF-1717?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12619021#action_12619021 ]

Bill Simons commented on CXF-1717:
----------------------------------

Thanks for the update.  It doesn't look like the fix is in the latest maven snapshot (2.1.2-20080724.010135-4).

Where can I get the code with the fix?  When will the latest SNAPSHOT be posted?

Thanks.

> URI returned by UriInfo.getAbsolutePath only contains relative portion of the URI
> ---------------------------------------------------------------------------------
>
>                 Key: CXF-1717
>                 URL: https://issues.apache.org/jira/browse/CXF-1717
>             Project: CXF
>          Issue Type: Bug
>          Components: REST
>    Affects Versions: 2.1.1
>         Environment: Tomcat 6.x running on Windows XP and Java 1.6
>            Reporter: Bill Simons
>             Fix For: 2.1.2
>
>
> With a class like:
> @Path("/helloWorld")
> public class HelloWorldResource {
>     @Context
>     private UriInfo context;
>    
>     /** Creates a new instance of HelloWorldResource */
>     public HelloWorldResource() {
>     }
>     /**
>      * Retrieves representation of an instance of helloworld.HelloWorldResource
>      * @return an instance of java.lang.String
>      */
>     @GET
>     @ProduceMime("text/plain")
>     public String getXml() {
>         return context.getAbsolutePath().toString();
>     }
> }
> The String returned by the context.getAbsolutePath().toString only contains the path( /helloWorld )portion of the URI. It should contain the full URI (http://localhost:8080/helloWorld).

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Commented: (CXF-1717) URI returned by UriInfo.getAbsolutePath only contains relative portion of the URI

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/CXF-1717?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12619025#action_12619025 ]

Sergey Beryozkin commented on CXF-1717:
---------------------------------------

Have a look please at this code :

http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriInfoImpl.java?view=markup, specifically

 public URI getBaseUri() {
        URI u = URI.create(getEndpointAddress());
        return HttpUtils.toAbsoluteUri(u, message);
    }


Does the snapshot you downloaded contains the same UriInfoImpl ?
If not then this fix just didn't make it inot the latest published snapshot - Dan Kulp would know when the next one will be available



> URI returned by UriInfo.getAbsolutePath only contains relative portion of the URI
> ---------------------------------------------------------------------------------
>
>                 Key: CXF-1717
>                 URL: https://issues.apache.org/jira/browse/CXF-1717
>             Project: CXF
>          Issue Type: Bug
>          Components: REST
>    Affects Versions: 2.1.1
>         Environment: Tomcat 6.x running on Windows XP and Java 1.6
>            Reporter: Bill Simons
>             Fix For: 2.1.2
>
>
> With a class like:
> @Path("/helloWorld")
> public class HelloWorldResource {
>     @Context
>     private UriInfo context;
>    
>     /** Creates a new instance of HelloWorldResource */
>     public HelloWorldResource() {
>     }
>     /**
>      * Retrieves representation of an instance of helloworld.HelloWorldResource
>      * @return an instance of java.lang.String
>      */
>     @GET
>     @ProduceMime("text/plain")
>     public String getXml() {
>         return context.getAbsolutePath().toString();
>     }
> }
> The String returned by the context.getAbsolutePath().toString only contains the path( /helloWorld )portion of the URI. It should contain the full URI (http://localhost:8080/helloWorld).

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Commented: (CXF-1717) URI returned by UriInfo.getAbsolutePath only contains relative portion of the URI

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/CXF-1717?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12619032#action_12619032 ]

Daniel Kulp commented on CXF-1717:
----------------------------------

I'll do another snapshot later this afternoon.



> URI returned by UriInfo.getAbsolutePath only contains relative portion of the URI
> ---------------------------------------------------------------------------------
>
>                 Key: CXF-1717
>                 URL: https://issues.apache.org/jira/browse/CXF-1717
>             Project: CXF
>          Issue Type: Bug
>          Components: REST
>    Affects Versions: 2.1.1
>         Environment: Tomcat 6.x running on Windows XP and Java 1.6
>            Reporter: Bill Simons
>             Fix For: 2.1.2
>
>
> With a class like:
> @Path("/helloWorld")
> public class HelloWorldResource {
>     @Context
>     private UriInfo context;
>    
>     /** Creates a new instance of HelloWorldResource */
>     public HelloWorldResource() {
>     }
>     /**
>      * Retrieves representation of an instance of helloworld.HelloWorldResource
>      * @return an instance of java.lang.String
>      */
>     @GET
>     @ProduceMime("text/plain")
>     public String getXml() {
>         return context.getAbsolutePath().toString();
>     }
> }
> The String returned by the context.getAbsolutePath().toString only contains the path( /helloWorld )portion of the URI. It should contain the full URI (http://localhost:8080/helloWorld).

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Commented: (CXF-1717) URI returned by UriInfo.getAbsolutePath only contains relative portion of the URI

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/CXF-1717?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12619089#action_12619089 ]

Bill Simons commented on CXF-1717:
----------------------------------

Picked up the snapshot and the scheme, host and port number all are present.

The issue I'm now seeing is that if the CXFServlet is mapped to a url pattern that is not "/*", the mapped portion of the url is not present.

For example, in my web.xml file I have:
    <servlet-mapping>
        <servlet-name>CXFServlet</servlet-name>
        <url-pattern>/test/*</url-pattern>
    </servlet-mapping>

I now access my HelloWorld service on the url http://localhost:8080/test/helloWorld.  The value returned from .getAbsolutePath() is actually http://localhost:8080/helloWorld (/test is omitted).

Is that cause for re-opening this issue or entering a new one?


> URI returned by UriInfo.getAbsolutePath only contains relative portion of the URI
> ---------------------------------------------------------------------------------
>
>                 Key: CXF-1717
>                 URL: https://issues.apache.org/jira/browse/CXF-1717
>             Project: CXF
>          Issue Type: Bug
>          Components: REST
>    Affects Versions: 2.1.1
>         Environment: Tomcat 6.x running on Windows XP and Java 1.6
>            Reporter: Bill Simons
>             Fix For: 2.1.2
>
>
> With a class like:
> @Path("/helloWorld")
> public class HelloWorldResource {
>     @Context
>     private UriInfo context;
>    
>     /** Creates a new instance of HelloWorldResource */
>     public HelloWorldResource() {
>     }
>     /**
>      * Retrieves representation of an instance of helloworld.HelloWorldResource
>      * @return an instance of java.lang.String
>      */
>     @GET
>     @ProduceMime("text/plain")
>     public String getXml() {
>         return context.getAbsolutePath().toString();
>     }
> }
> The String returned by the context.getAbsolutePath().toString only contains the path( /helloWorld )portion of the URI. It should contain the full URI (http://localhost:8080/helloWorld).

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Reopened: (CXF-1717) URI returned by UriInfo.getAbsolutePath only contains relative portion of the URI

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ https://issues.apache.org/jira/browse/CXF-1717?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin reopened CXF-1717:
-----------------------------------


> URI returned by UriInfo.getAbsolutePath only contains relative portion of the URI
> ---------------------------------------------------------------------------------
>
>                 Key: CXF-1717
>                 URL: https://issues.apache.org/jira/browse/CXF-1717
>             Project: CXF
>          Issue Type: Bug
>          Components: REST
>    Affects Versions: 2.1.1
>         Environment: Tomcat 6.x running on Windows XP and Java 1.6
>            Reporter: Bill Simons
>             Fix For: 2.1.2
>
>
> With a class like:
> @Path("/helloWorld")
> public class HelloWorldResource {
>     @Context
>     private UriInfo context;
>    
>     /** Creates a new instance of HelloWorldResource */
>     public HelloWorldResource() {
>     }
>     /**
>      * Retrieves representation of an instance of helloworld.HelloWorldResource
>      * @return an instance of java.lang.String
>      */
>     @GET
>     @ProduceMime("text/plain")
>     public String getXml() {
>         return context.getAbsolutePath().toString();
>     }
> }
> The String returned by the context.getAbsolutePath().toString only contains the path( /helloWorld )portion of the URI. It should contain the full URI (http://localhost:8080/helloWorld).

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Commented: (CXF-1717) URI returned by UriInfo.getAbsolutePath only contains relative portion of the URI

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/CXF-1717?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12619151#action_12619151 ]

Sergey Beryozkin commented on CXF-1717:
---------------------------------------

Hmm...I'm wondering is it a CXFServlet issue ?

Or perhaps HttpUtils.toAbsoluteUri(u, message); is not taking this extra path segment into consideration ?
Probably yes.

Unfortunately I won't be able to look at this issue during the next month, I'm traveling these weekends. If you can get a chance to track the remaining problem down then it would be cool. Otherwise I'll be able to have a look at it sometime in late August/early September.



> URI returned by UriInfo.getAbsolutePath only contains relative portion of the URI
> ---------------------------------------------------------------------------------
>
>                 Key: CXF-1717
>                 URL: https://issues.apache.org/jira/browse/CXF-1717
>             Project: CXF
>          Issue Type: Bug
>          Components: REST
>    Affects Versions: 2.1.1
>         Environment: Tomcat 6.x running on Windows XP and Java 1.6
>            Reporter: Bill Simons
>             Fix For: 2.1.2
>
>
> With a class like:
> @Path("/helloWorld")
> public class HelloWorldResource {
>     @Context
>     private UriInfo context;
>    
>     /** Creates a new instance of HelloWorldResource */
>     public HelloWorldResource() {
>     }
>     /**
>      * Retrieves representation of an instance of helloworld.HelloWorldResource
>      * @return an instance of java.lang.String
>      */
>     @GET
>     @ProduceMime("text/plain")
>     public String getXml() {
>         return context.getAbsolutePath().toString();
>     }
> }
> The String returned by the context.getAbsolutePath().toString only contains the path( /helloWorld )portion of the URI. It should contain the full URI (http://localhost:8080/helloWorld).

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

LightInTheBox - Buy quality products at wholesale price