Return-Path: Delivered-To: apmail-cxf-users-archive@www.apache.org Received: (qmail 2824 invoked from network); 18 Feb 2009 11:41:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Feb 2009 11:41:39 -0000 Received: (qmail 25756 invoked by uid 500); 18 Feb 2009 11:41:35 -0000 Delivered-To: apmail-cxf-users-archive@cxf.apache.org Received: (qmail 25704 invoked by uid 500); 18 Feb 2009 11:41:35 -0000 Mailing-List: contact users-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@cxf.apache.org Delivered-To: mailing list users@cxf.apache.org Received: (qmail 25690 invoked by uid 99); 18 Feb 2009 11:41:35 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Feb 2009 03:41:34 -0800 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [70.42.72.23] (HELO mail.solegy.com) (70.42.72.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Feb 2009 11:41:22 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.solegy.com (Postfix) with ESMTP id F34252100036 for ; Wed, 18 Feb 2009 11:41:01 +0000 (GMT) Received: from mail.solegy.com ([127.0.0.1]) by localhost (mail.solegy.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fGq0d4NgLuey for ; Wed, 18 Feb 2009 11:41:01 +0000 (GMT) Received: from [192.168.0.112] (unknown [222.127.215.98]) by mail.solegy.com (Postfix) with ESMTP id D573C2100025 for ; Wed, 18 Feb 2009 11:41:00 +0000 (GMT) Message-ID: <499BF3CC.8060103@solegysystems.com> Date: Wed, 18 Feb 2009 11:41:00 +0000 From: Gabo Manuel User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: users@cxf.apache.org Subject: Re: [JAXRS][IE] subresource locator feature getting confused References: <499BC07F.6080207@solegysystems.com> <00bd01c991bc$a7cd7970$0c02050a@emea.progress.com> In-Reply-To: <00bd01c991bc$a7cd7970$0c02050a@emea.progress.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hi Sergey, I'll wait for the fix. I cannot move the path annotation from the object to the service since it is possible that the object involve has a whole set of other fields. I also tried the following: //an extra method @GET @Path("/search/") @WebMethod public MyObjects getObjects(){ //using a list wrapper as advised in the user's guide return new MyObjects(new MyObject()); } if I invoke http://localhost:8080/cxf/Objects/search/ , "getObject" gets invoked. Gabo Sergey Beryozkin wrote: > Hi Gabo > > What is happening is that with > >> Accept=[image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, >> application/x-shockwave-flash, */*] > > the wildcard is the less specific accept type which is checked last, > when selecting between multiple matching methods. > I think what is happening is that when the first specific accept value > is tried, the getObject() method is discarded is it inherits text/xml > but the subresource method is matched due to the fact the actual > method selection is done at a later stage. > > Actually, I think there's a flaw in this algorithm (in CXF JAXRS that > is), in that all accept types should be tried for all the methods, > even if the forst accept type has produced a candidate, in which case > */* will ensure that the getObject() is selected too and it will be > picked up first on the basis that it's a resource method. > > I'll get it fixed for 2.2, but in meantine please move /field1 from > MyObject.getField1() to ObjectService.getObjectProperty() and it > should fix the problem... > > Thanks, Sergey > >> Hi All, >> >> I was testing the web service I have created and it works without a >> hitch when using HttpClient as ... well client. However, if I use >> I.E. to check (haven't tested fire fox or any browser yet), I >> encounter the following error: >> >> javax.ws.rs.WebApplicationException >> at >> org.apache.cxf.jaxrs.utils.JAXRSUtils.findTargetMethod(JAXRSUtils.java:295) >> >> at >> org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:161) >> at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:67) >> at >> org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:56) >> >> at >> org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37) >> >> at >> org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:92) >> >> at >> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:226) >> >> at >> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:89) >> >> at >> org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:99) >> >> at >> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:305) >> >> at >> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:138) >> >> at >> org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:163) >> >> at >> org.apache.cxf.transport.servlet.AbstractCXFServlet.doGet(AbstractCXFServlet.java:145) >> >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) >> at >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) >> >> at >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) >> >> at >> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) >> >> at >> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) >> >> at >> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) >> >> at >> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) >> >> at >> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) >> >> at >> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261) >> >> at >> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) >> >> at >> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581) >> >> at >> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) >> at java.lang.Thread.run(Thread.java:619) >> >> Then I receive a runtime exception client side. What I find weird is >> that a method was properly invoked. More specifically, the >> subresource locator was used. There are two methods defined and >> annotated as follows: >> >> @Consumes("*/*") >> @Produces("text/xml") >> @Path("/Objects") >> public class ObjectService{ >> @GET >> @Path("/") >> @WebMethod >> public Object getObject( >> @QueryParam("id") >> @WebParam(name="id") >> long id) { >> //this is the method that I was invoking... supposedly >> logger.info("get Object received: " + id);//Note this >> return new MyObject(); >> } >> >> @Path("/") >> @WebMethod(exclude=true) >> public Object getObjectProperty( >> @QueryParam("id") >> @WebParam(name="id") >> long id) { >> //this got invoked ... but should not have been >> logger.info("get Object Property received: " + id);//Note this >> return getObject(id); >> } >> } >> >> @XmlType(name="MyObject") >> @XmlAccessorType(XmlAccessType.PROPERTY) >> @XmlRootElement(name="MyObject") >> public class MyObject { >> @GET >> @Path("/field1") >> public String getField1() { >> return "field1"; >> } >> public void setField1() { >> } >> } >> >> The debug log shows the following: >> >> 2009-02-18 07:38:17,640 | [INFO ][80-1] | get Object Property >> received: 1 >> 2009-02-18 07:38:17,640 | [INFO ][80-1] | get Object received: 1 >> >> I am assuming it is having a problem finding the subresource since >> technically, it shouldn't even be the method being invoked. URL being >> used is: >> >> http://localhost:8080/cxf/Objects/?id=1 >> >> I am not sure if it helps but maybe the extra headers affects this? >> These are not received when HttpClient is used. >> >> accept-language=[en-us], user-agent=[Mozilla/4.0 (compatible; MSIE >> 7.0; Windows NT 5.1)], accept-encoding=[gzip, deflate], ua-cpu=[x86], >> Accept=[image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, >> application/x-shockwave-flash, */*] >> >> I am using the following: >> tomcat 6.0.13 >> java 1.6 >> cxf 2.2-snapshot (Jan 27) >> >> Thanks in advance. >> >> Gabo > ------------------------------------------------------------------------ > > > No virus found in this incoming message. > Checked by AVG - www.avg.com > Version: 8.0.237 / Virus Database: 270.10.25/1957 - Release Date: 02/17/09 07:07:00 > >