[opencms-dev] How to send XML data from browser to jsp

Ilya S. Ahimov cms at isu.ru
Fri Oct 24 05:46:46 CEST 2008


Hello,
I have a problem with sending XML data from browser to my JSP:

//OpenCMS 7.04, JSP code :
org.opencms.jsp.CmsJspActionElement cms = new 
org.opencms.jsp.CmsJspActionElement(pageContext, request, response);

HttpServletRequest req = cms.getRequest();

String contentType = req.getContentType() ;
int contentLength = req.getContentLength() ;
String encoding = req.getCharacterEncoding() ;

StringBuffer xml = new StringBuffer();
String line = null;

try {
BufferedReader reader = req.getReader();
out.println("reader.readLine()=" + reader.readLine());
while((line = reader.readLine()) != null) {
xml.append(line);
}
}
catch(Exception e) {
out.println("Error reading XML: " + e.toString());
}

out.println( "contentType=" + contentType + "! " );
out.println( "contentLength=" + contentLength + "! " );
out.println( "encoding=" + encoding + "! " );
//End JSP code

Result:
reader.readLine()=null
contentType=null!
contentLength=-1!
encoding=UTF-8!

In other my web-applications (without OpenCMS) this jsp working without 
problems.

Any ideas how to solve this ptoblem?

Regards Ilya 




More information about the opencms-dev mailing list