com.meterware.httpunit.WebResponse.readTags()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(111)

本文整理了Java中com.meterware.httpunit.WebResponse.readTags()方法的一些代码示例,展示了WebResponse.readTags()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebResponse.readTags()方法的具体详情如下:
包路径:com.meterware.httpunit.WebResponse
类名称:WebResponse
方法名:readTags

WebResponse.readTags介绍

暂无

代码示例

代码示例来源:origin: javanettasks/httpunit

public boolean replaceText( String text, String contentType ) {
  if (_parsingPage) return false;
  _responseText = text;
  _inputStream = null;
  _page = null;
  _contentType = contentType;
  _baseURL = null;
  _baseTarget = _frame.getName();
  _refreshHeader = null;
  try {
    readTags( text.getBytes() );
  } catch (UnsupportedEncodingException e) {
    throw new RuntimeException( "Failure while attempting to reparse text: " + e );
  } catch (MalformedURLException e) {
    throw new RuntimeException( "Failure while attempting to reparse text: " + e );
  }
  return true;
}

代码示例来源:origin: httpunit/httpunit

public boolean replaceText( String text, String contentType ) {
  if (_parsingPage) return false;
  _responseText = text;
  _inputStream = null;
  _page = null;
  _contentType = contentType;
  _baseURL = null;
  _baseTarget = _frame.getName();
  _refreshHeader = null;
  try {
    readTags( text.getBytes() );
  } catch (UnsupportedEncodingException e) {
    throw new RuntimeException( "Failure while attempting to reparse text: " + e );
  } catch (MalformedURLException e) {
    throw new RuntimeException( "Failure while attempting to reparse text: " + e );
  }
  return true;
}

代码示例来源:origin: org.kohsuke.httpunit/httpunit

public boolean replaceText( String text, String contentType ) {
  if (_parsingPage) return false;
  _responseText = text;
  _inputStream = null;
  _page = null;
  _contentType = contentType;
  _baseURL = null;
  _baseTarget = _frame.getName();
  _refreshHeader = null;
  try {
    readTags( text.getBytes() );
  } catch (UnsupportedEncodingException e) {
    throw new RuntimeException( "Failure while attempting to reparse text: " + e );
  } catch (MalformedURLException e) {
    throw new RuntimeException( "Failure while attempting to reparse text: " + e );
  }
  return true;
}

代码示例来源:origin: httpunit/httpunit

protected void loadResponseText() throws IOException {
  if (_responseText != null) throw new IllegalStateException( "May only invoke loadResponseText once" );
  _responseText = "";
  InputStream inputStream = getInputStream();
  try {
    final int contentLength = this.encodedUsingGZIP() ? -1 : getContentLength();
    int bytesRemaining = contentLength < 0 ? Integer.MAX_VALUE : contentLength;
    byte[] bytes = readFromStream( inputStream, bytesRemaining );
    readTags( bytes );
    _responseText = new String( bytes, getCharacterSet() );
    _inputStream  = new ByteArrayInputStream( bytes );
    if (HttpUnitOptions.isCheckContentLength() && contentLength >= 0 && bytes.length != contentLength) {
      throw new IOException("Truncated message. Expected length: " + contentLength +
                          ", Actual length: " + bytes.length);
    }
  } finally {
    inputStream.close();
  }
}

代码示例来源:origin: javanettasks/httpunit

protected void loadResponseText() throws IOException {
  if (_responseText != null) throw new IllegalStateException( "May only invoke loadResponseText once" );
  _responseText = "";
  InputStream inputStream = getInputStream();
  try {
    final int contentLength = this.encodedUsingGZIP() ? -1 : getContentLength();
    int bytesRemaining = contentLength < 0 ? Integer.MAX_VALUE : contentLength;
    byte[] bytes = readFromStream( inputStream, bytesRemaining );
    readTags( bytes );
    _responseText = new String( bytes, getCharacterSet() );
    _inputStream  = new ByteArrayInputStream( bytes );
    if (HttpUnitOptions.isCheckContentLength() && contentLength >= 0 && bytes.length != contentLength) {
      throw new IOException("Truncated message. Expected length: " + contentLength +
                          ", Actual length: " + bytes.length);
    }
  } finally {
    inputStream.close();
  }
}

代码示例来源:origin: org.kohsuke.httpunit/httpunit

protected void loadResponseText() throws IOException {
  if (_responseText != null) throw new IllegalStateException( "May only invoke loadResponseText once" );
  _responseText = "";
  InputStream inputStream = getInputStream();
  try {
    final int contentLength = this.encodedUsingGZIP() ? -1 : getContentLength();
    int bytesRemaining = contentLength < 0 ? Integer.MAX_VALUE : contentLength;
    byte[] bytes = readFromStream( inputStream, bytesRemaining );
    readTags( bytes );
    _responseText = new String( bytes, getCharacterSet() );
    _inputStream  = new ByteArrayInputStream( bytes );
    if (HttpUnitOptions.isCheckContentLength() && contentLength >= 0 && bytes.length != contentLength) {
      throw new IOException("Truncated message. Expected length: " + contentLength +
                          ", Actual length: " + bytes.length);
    }
  } finally {
    inputStream.close();
  }
}

相关文章

微信公众号

最新文章

更多

WebResponse类方法