List of usage examples for javax.servlet ServletInputStream markSupported
public boolean markSupported()
mark
and reset
methods. From source file:org.apache.falcon.resource.AbstractInstanceManager.java
private Properties getProperties(HttpServletRequest request) throws IOException { Properties props = new Properties(); ServletInputStream xmlStream = request == null ? null : request.getInputStream(); if (xmlStream != null) { if (xmlStream.markSupported()) { xmlStream.mark(XML_DEBUG_LEN); // mark up to debug len }// ww w . j a va 2 s . c o m props.load(xmlStream); } return props; }
From source file:org.openrepose.powerfilter.intrafilterlogging.RequestLog.java
public RequestLog(HttpServletRequest httpServletRequest, Filter filter) throws IOException { preamble = "Intrafilter Request Log"; timestamp = new DateTime().toString(); currentFilter = StringUtils.isEmpty(filter.getId()) ? filter.getName() : filter.getId() + "-" + filter.getName(); httpMethod = httpServletRequest.getMethod(); requestURI = httpServletRequest.getRequestURI(); headers = convertRequestHeadersToMap(httpServletRequest); try {//from w w w .ja v a2 s . co m ServletInputStream inputStream = httpServletRequest.getInputStream(); if (inputStream.markSupported()) { inputStream.mark(Integer.MAX_VALUE); requestBody = IOUtils.toString(inputStream); //http://stackoverflow.com/a/309448 inputStream.reset(); } else { LOG.warn("Unable to populate request body - {} does not support mark/reset.", inputStream); } } catch (IOException e) { LOG.warn("Unable to populate request body.", e); } }