java - How to read and change body of a HTTP request? -
i want perform rest operation on request gets generated user. trying read contents of request body using this:
bufferedreader reader = null; string info =null; try { reader = httprequest.getreader(); } catch (ioexception e1) { // todo auto-generated catch block e1.printstacktrace(); e1.getmessage(); } i keep getting exception:
<b>exception</b> <pre>java.lang.reflect.undeclaredthrowableexception com.sun.proxy.$proxy88.getreader(unknown source) sun.reflect.nativemethodaccessorimpl.invoke0(native method) sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) java.lang.reflect.method.invoke(method.java:606) it on getreader line. after want like:
try { while((data =reader.readline()) != null){ logger.debug("line read data is: "+ info); buffer.append(data); } } catch (ioexception e1) { e1.printstacktrace(); } i cant around exception. appreciated. thanks.
so looks service reference (the restful service you're connecting to) throwing exception program isn't ready nor understands. or @ least that's how understand docs on undeclaredthrowableexception.
https://docs.oracle.com/javase/7/docs/api/java/lang/reflect/undeclaredthrowableexception.html
Comments
Post a Comment