/** * Deserializes the input stream to a Java object * * @param is input stream for the Java object * @return the java object, or <tt>null</tt> if input stream was <tt>null</tt> * @throws ClassNotFoundException is thrown if class not found * @throws IOException can be thrown * @deprecated Camel 3.0 * Please use the one which has the parameter of camel context */ @Deprecated public static Object deserializeJavaObjectFromStream(InputStream is) throws ClassNotFoundException, IOException { return deserializeJavaObjectFromStream(is, null); }
protected void readBody(HttpServletRequest request, HttpMessage message) { LOG.trace("readBody {}", request); // lets parse the body Object body = message.getBody(); // reset the stream cache if the body is the instance of StreamCache if (body instanceof StreamCache) { ((StreamCache) body).reset(); } // if content type is serialized java object, then de-serialize it to a Java object if (request.getContentType() != null && HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT.equals(request.getContentType())) { // only deserialize java if allowed if (allowJavaSerializedObject || isTransferException()) { try { InputStream is = message.getExchange().getContext().getTypeConverter().mandatoryConvertTo(InputStream.class, body); Object object = HttpHelper.deserializeJavaObjectFromStream(is, message.getExchange().getContext()); if (object != null) { message.setBody(object); } } catch (Exception e) { throw new RuntimeCamelException("Cannot deserialize body to Java object", e); } } else { // set empty body message.setBody(null); } } populateAttachments(request, message); }
return HttpHelper.deserializeJavaObjectFromStream(is, exchange.getContext()); } else {