Code example for Element

Methods: setTextContent

0
 
                faultEl.appendChild(timestamptEl);
                faultEl.appendChild(detailsEl);
 
                timestamptEl.setTextContent("" + System.currentTimeMillis());
                detailsEl.setTextContent("Fake fault with the expected xml body.");
 
                response.getOutputStream().print(DOMUtils.domToString(faultEl));
                response.setStatus(500);
            } else { 
                response.setStatus(200);
            } 
        } 
 
        private void doDelete(HttpServletRequest request, HttpServletResponse response, String articleId) {
            response.setHeader("TimestampHeader", request.getHeader("TimestampHeader"));
            response.setHeader("User-Agent", request.getHeader("User-Agent"));
            response.setStatus(204); // No content
        } 
    }