class WilmaHttpRequestWriter extends WilmaHttpEntityWriter<WilmaHttpRequest> {

    @Override
    public boolean write(final WilmaHttpRequest request, final boolean bodyDecompressed) {
        boolean successful = false;
        String outputFile = INITIAL_FILENAME;
        try {
            String messageLoggerId = request.getWilmaMessageLoggerId();
            String messageId = request.getWilmaMessageId();
            outputFile = getOutputFileName(messageLoggerId, bodyDecompressed);
            BufferedWriter writer = bufferedWriterFactory.createBufferedWriter(outputFile, OUTPUT_BUFFER_SIZE);
            if (writer != null) {
                String requestLine = request.getRemoteAddr() + " " + request.getRequestLine();
                writeRequestLine(requestLine, writer);
                writeWilmaLoggerId(writer, messageId);
                String headers = prepareHeadersInfo(request);
                writeHeaders(writer, headers);
                String body = request.getBody();
                writeBody(writer, body);
                writer.close();
                successful = true;
            }
        } catch (IOException e) {
            logger.error("Could not write message to file:" + outputFile + "!", e);
        }
        return successful;
    }

}