Quote response = new Quote();
response.setPrice(PRICES[i % 4]);
ServletContext servletContext = (ServletContext)context.getMessageContext().get(MessageContext.SERVLET_CONTEXT);
if (servletContext != null) {
String carName = "/images/" + carname(i) + ".jpg";
System.out.println("Car name is: " + carName);
InputStream is = servletContext.getResourceAsStream(carName);
try {
BufferedImage bi = ImageIO.read(is);
response.setPhoto(bi);
System.out.println(getClass().getName() + ": Added the photo");
} catch (IOException e) {
throw new WebServiceException(e);
}
}
return response;