public static void checkHTTPRequestLength(HttpServletRequest request) throws ServletException {
  int maxContentLength=SAMLUtils.getMaxContentLength();
  if (maxContentLength != 0) {
    int length=request.getContentLength();
    if (length == -1) {
      throw new ServletException(bundle.getString("unknownLength"));
    }
    if (length > maxContentLength) {
      if (debug.messageEnabled()) {
        debug.message("FSUtils.checkHTTPRequestLength: " + "content length too large" + length);
      }
      throw new ServletException(bundle.getString("largeContentLength"));
    }
  }
}

public static void checkHTTPRequestLength ( HttpServletRequest request ) throws ServletException { int maxContentLength = SAMLUtils . getMaxContentLength ( ) ; if ( maxContentLength != 0 ) { int length = request . getContentLength ( ) ; if ( length == - 1 ) { throw new ServletException ( bundle . getString ( "unknownLength" ) ) ; } if ( length > maxContentLength ) { if ( debug . messageEnabled ( ) ) { debug . message ( "FSUtils.checkHTTPRequestLength: " + "content length too large" + length ) ; } throw new ServletException ( bundle . getString ( "largeContentLength" ) ) ; } } }
checks content length of a http request to avoid dos attack . in case idff inter - op with other idff vendor who may not provide content length in httpservletrequest . we decide to support no length restriction for http communication . here , we use a special value ( e . g . 0 ) to indicate that no enforcement is required .
