Return-Path: Delivered-To: apmail-cxf-issues-archive@www.apache.org Received: (qmail 44304 invoked from network); 4 Feb 2010 14:38:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Feb 2010 14:38:52 -0000 Received: (qmail 4802 invoked by uid 500); 4 Feb 2010 14:38:52 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 4787 invoked by uid 500); 4 Feb 2010 14:38:52 -0000 Mailing-List: contact issues-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list issues@cxf.apache.org Received: (qmail 4758 invoked by uid 99); 4 Feb 2010 14:38:52 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Feb 2010 14:38:52 +0000 X-ASF-Spam-Status: No, hits=-1998.5 required=10.0 tests=ALL_TRUSTED,WEIRD_PORT X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Feb 2010 14:38:49 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id ED45029A0012 for ; Thu, 4 Feb 2010 06:38:27 -0800 (PST) Message-ID: <1159800447.37251265294307970.JavaMail.jira@brutus.apache.org> Date: Thu, 4 Feb 2010 14:38:27 +0000 (UTC) From: "Julien Wajsberg (JIRA)" To: issues@cxf.apache.org Subject: [jira] Updated: (CXF-2652) UriInfo.getAbsolutePath throws "java.net.URISyntaxException: Illegal character in path" when there is an encoded space in the request URI In-Reply-To: <651895686.37191265293948086.JavaMail.jira@brutus.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/CXF-2652?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Julien Wajsberg updated CXF-2652: --------------------------------- Description: I tried this simple code : {code} package mypackage; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.UriInfo; @Path("uri") public class UriService { @GET @Path("something/{id}") public void addSomething(String string, @Context UriInfo uriInfo, @PathParam("id") String id) { System.out.println("getPath -> " + uriInfo.getPath()); System.out.println("getBasePath -> " + uriInfo.getBaseUri()); System.out.println("getAbsolutePath -> " + uriInfo.getBaseUri().resolve(uriInfo.getPath(false))); System.out.println("getAbsolutePath -> " + uriInfo.getAbsolutePath()); } } {code} With a Spring-based setup and default beans.xml taken from the user guide. Then we can use a normal browser . With "http://localhost:9080/Uritest/rest/uri/something/3", we get in stdout : {panel} getPath -> /uri/something/3 getBasePath -> http://localhost:9080/Uritest/rest getAbsolutePath -> http://localhost:9080/uri/something/3 getAbsolutePath -> http://localhost:9080/Uritest/rest/uri/something/3 {panel} But with "http://localhost:9080/Uritest/rest/uri/something/3 4", we get an exception : {noformat} java.net.URISyntaxException: Illegal character in path at index 50: http://localhost:9080/Uritest/rest/uri/something/3 4 {noformat} And in stdout : {panel} getPath -> /uri/something/3 4 getBasePath -> http://localhost:9080/Uritest/rest getAbsolutePath -> http://localhost:9080/uri/something/3%204 {panel} NB : in JAX-RS javadoc, it's said that "getAbsolutePath()" is a shortcut to uriInfo.getBase().resolve(uriInfo.getPath())", which is plain wrong, because : # getBase doesn't exist, that's getBaseUri # getPath as returned by CXF begins with a slash ("/") so "resolve" doesn't do what we want here. (maybe another bug ? tell me and I'll create another issue) was: I tried this simple code : {code} package mypackage; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.UriInfo; @Path("uri") public class UriService { @GET @Path("something/{id}") public void addSomething(String string, @Context UriInfo uriInfo, @PathParam("id") String id) { System.out.println("getPath -> " + uriInfo.getPath()); System.out.println("getBasePath -> " + uriInfo.getBaseUri()); System.out.println("getAbsolutePath -> " + uriInfo.getBaseUri().resolve(uriInfo.getPath(false))); System.out.println("getAbsolutePath -> " + uriInfo.getAbsolutePath()); } } {code} With a Spring-based setup and default beans.xml taken from the user guide. Then we can use a normal browser . With "http://localhost:9080/Uritest/rest/uri/something/3", we get in stdout : {panel} getPath -> /uri/something/3 getBasePath -> http://localhost:9080/Uritest/rest getAbsolutePath -> http://localhost:9080/uri/something/3 getAbsolutePath -> http://localhost:9080/Uritest/rest/uri/something/3 {panel} But with "http://localhost:9080/Uritest/rest/uri/something/3 4", we get an exception : {noformat} java.net.URISyntaxException: Illegal character in path at index 50: http://localhost:9080/Uritest/rest/uri/something/3 4 {noformat} And in stdout : {panel} getPath -> /uri/something/3 4 getBasePath -> http://localhost:9080/Uritest/rest getAbsolutePath -> http://localhost:9080/uri/something/3%204 {panel} NB : in JAX-RS javadoc, it's said that "getAbsolutePath()" is a shortcut to uriInfo.getBase().resolve(uriInfo.getPath())", which is plain wrong, because : # getBase doesn't exist, that's getBaseUri # getPath as returned by CXF begins with a slash ("/") so "resolve" doesn't do what we want here. > UriInfo.getAbsolutePath throws "java.net.URISyntaxException: Illegal character in path" when there is an encoded space in the request URI > ----------------------------------------------------------------------------------------------------------------------------------------- > > Key: CXF-2652 > URL: https://issues.apache.org/jira/browse/CXF-2652 > Project: CXF > Issue Type: Bug > Components: JAX-RS > Affects Versions: 2.2.6 > Environment: Used with Spring > Reporter: Julien Wajsberg > > I tried this simple code : > {code} > package mypackage; > import javax.ws.rs.GET; > import javax.ws.rs.Path; > import javax.ws.rs.PathParam; > import javax.ws.rs.core.Context; > import javax.ws.rs.core.UriInfo; > @Path("uri") > public class UriService { > @GET > @Path("something/{id}") > public void addSomething(String string, @Context UriInfo uriInfo, @PathParam("id") String id) { > System.out.println("getPath -> " + uriInfo.getPath()); > System.out.println("getBasePath -> " + uriInfo.getBaseUri()); > System.out.println("getAbsolutePath -> " + uriInfo.getBaseUri().resolve(uriInfo.getPath(false))); > System.out.println("getAbsolutePath -> " + uriInfo.getAbsolutePath()); > } > } > {code} > With a Spring-based setup and default beans.xml taken from the user guide. > Then we can use a normal browser . > With "http://localhost:9080/Uritest/rest/uri/something/3", we get in stdout : > {panel} > getPath -> /uri/something/3 > getBasePath -> http://localhost:9080/Uritest/rest > getAbsolutePath -> http://localhost:9080/uri/something/3 > getAbsolutePath -> http://localhost:9080/Uritest/rest/uri/something/3 > {panel} > But with "http://localhost:9080/Uritest/rest/uri/something/3 4", we get an exception : > {noformat} > java.net.URISyntaxException: Illegal character in path at index 50: http://localhost:9080/Uritest/rest/uri/something/3 4 > {noformat} > And in stdout : > {panel} > getPath -> /uri/something/3 4 > getBasePath -> http://localhost:9080/Uritest/rest > getAbsolutePath -> http://localhost:9080/uri/something/3%204 > {panel} > NB : in JAX-RS javadoc, it's said that "getAbsolutePath()" is a shortcut to uriInfo.getBase().resolve(uriInfo.getPath())", which is plain wrong, because : > # getBase doesn't exist, that's getBaseUri > # getPath as returned by CXF begins with a slash ("/") so "resolve" doesn't do what we want here. (maybe another bug ? tell me and I'll create another issue) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.