Hi Sergey,

I have two root resources: Fleet and Bus. I want to be able to list all
Buses or all Busses by Fleet. I had expected to expose URLs such as:

#All Busses
/busses
# Busses by Fleet
/fleets/{fleet_id}/busses

My Bus resource looks like this:

@Path("/busses")
@Component
public class BusResource {

        @PathParam(fleet_id)
        private String fleetId;

        public List<Bus> getBusses() {
                //sercice call: lookup busses for fleetId, or all if none 
provided
        }
}


My Fleet resource looks like this:

@Path("/fleets")
@Component
public class FleetResource {

        //TODO inject/lookup with jax-rs context resources
        @Autowired
        BusResource busResource

        @Path("/{fleet_id}/busses")
        public Object getBusses() {
                return busResource
        }
}

I realise I'm actually (ab)using a root resource as a sub-resource, but I
can't see a nice way to use the same code to access resources with and
without context (Fleet).

Thanks again,
Pat

--
View this message in context: 
http://cxf.547215.n5.nabble.com/Injecting-jax-rs-PathParam-into-sub-resource-fields-tp5013364p5013741.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to