Closed wandongwd closed 8 years ago
REST interface(IOpenstackHostImageRest.java):
@Path("/roc/vim/api") public interface IOpenstackHostImageRest { @Path("/images/detail") @GET @Produces(MediaType.APPLICATION_JSON) public String getOpenstackImageList(@Context HttpHeaders head) throws Exception; } connector in a karaf instance (OpenstackServiceConsumer.java): public static List<HostImage> getOpenstackHostImageList(HttpHeaders head) { ClientConfig config = new ClientConfig(new OpenstackServiceHostImageProvider()); IOpenstackHostImageRest imageRest = ConsumerFactory .createConsumer(BASEURL, config, IOpenstackHostImageRest.class); List<HostImage> imageList = null; try { String imageStr = imageRest.getOpenstackImageList(head); imageList = OpenstackServiceUtil.getImageEntityByJson(imageStr); } catch (Exception e) { LOG.error("getHostImage error", e); e.printStackTrace(); } return imageList; }
problem: the server can't get the parameter @Context HttpHeaders head
hmm, this should work. Can you put your annotations on the implementation and run a test please?
No response so I will close the issue. Please feel free to reopen.
REST interface(IOpenstackHostImageRest.java):
problem: the server can't get the parameter @Context HttpHeaders head