cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leszek Gawron <o...@vip.net.pl>
Subject logging request body
Date Wed, 05 Mar 2003 10:50:19 GMT
need help again:

I'm parsing my request body like this:

public Document GetInputStreamDocument() throws IOException {
    int contentLength = request.getContentLength();
    boolean failure = false;
    if ( contentLength > 0 ) {
        DOMBuilder builder = null;
        Parser newParser = null;
            try {
            HttpServletRequest request =
            (HttpServletRequest) objectModel.get( HttpEnvironment.HTTP_REQUEST_OBJECT );

            PostInputStream anStream = new PostInputStream( request.getInputStream(), contentLength
);
            InputSource contentSource = new InputSource( anStream );

            newParser = (Parser) this.manager.lookup(Parser.ROLE);
            //document = newParser.newDocument();
            builder = new DOMBuilder(newParser);
            newParser.setContentHandler(builder);
            newParser.setLexicalHandler(builder);
            newParser.parse( contentSource );
        } catch (Exception e) {
            // ignore - return null
            failure = true;
        } finally {
            if ( newParser != null )
                this.manager.release((Component) newParser);
        }
        if ( failure )
            return null;
        else
            return builder.getDocument();
    }
    return null;
}

I hope this is the proper way to do it but that is not the matter.
How can I put all the contents of request body into cocoon log file?
	ouzo

-- 
            __
         | /  \ |        Leszek Gawron            //  \\
        \_\\  //_/      ouzo@vip.net.pl          _\\()//_
         .'/()\'.     Phone: +48(600)341118     / //  \\ \
          \\  //  recursive: adj; see recursive  | \__/ |


Mime
View raw message