org.apache.http.protocol.HTTP类的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(9.4k)|赞(0)|评价(0)|浏览(392)

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

HTTP介绍

[英]Constants and static helpers related to the HTTP protocol.
[中]与HTTP协议相关的常量和静态帮助程序。

代码示例

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

int pos;
if (header instanceof FormattedHeader) {
  buffer = ((FormattedHeader) header).getBuffer();
  pos = ((FormattedHeader) header).getValuePos();
} else {
  String s = header.getValue();
  if (s == null) {
    throw new MalformedChallengeException("Header value is null");
  buffer = new CharArrayBuffer(s.length());
  buffer.append(s);
  pos = 0;
while (pos < buffer.length() && HTTP.isWhitespace(buffer.charAt(pos))) {
  pos++;
while (pos < buffer.length() && !HTTP.isWhitespace(buffer.charAt(pos))) {
  pos++;

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

/**
 * Helper to skip whitespace.
 */
protected void skipWhitespace(final CharArrayBuffer buffer, final ParserCursor cursor) {
  int pos = cursor.getPos();
  int indexTo = cursor.getUpperBound();
  while ((pos < indexTo) &&
      HTTP.isWhitespace(buffer.charAt(pos))) {
    pos++;
  }
  cursor.updatePos(pos);
}

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

int pos = cursor.getPos();
int indexFrom = cursor.getPos();
int indexTo = cursor.getUpperBound();
  char ch = buffer.charAt(pos);
  if (ch == '=') {
    break;
  name = buffer.substringTrimmed(indexFrom, indexTo);
} else {
  name = buffer.substringTrimmed(indexFrom, pos);
  pos++;
while (i1 < i2 && (HTTP.isWhitespace(buffer.charAt(i1)))) {
  i1++;
while ((i2 > i1) && (HTTP.isWhitespace(buffer.charAt(i2 - 1)))) {
  i2--;

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

throw new IllegalArgumentException("Parser cursor may not be null");
int index = cursor.getPos();
if (buffer.length() < protolength+4)
  return false; // not long enough for "HTTP/1.1"
  index = buffer.length() -4 -protolength;
} else if (index == 0) {
  while ((index < buffer.length()) &&
      HTTP.isWhitespace(buffer.charAt(index))) {
     index++;

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

public String substringTrimmed(int beginIndex, int endIndex) {
  if (beginIndex < 0) {
    throw new IndexOutOfBoundsException();
  }
  if (endIndex > this.len) {
    throw new IndexOutOfBoundsException();
  }
  if (beginIndex > endIndex) {
    throw new IndexOutOfBoundsException();
  }
  while (beginIndex < endIndex && HTTP.isWhitespace(this.buffer[beginIndex])) {
    beginIndex++;
  }
  while (endIndex > beginIndex && HTTP.isWhitespace(this.buffer[endIndex - 1])) {
    endIndex--;
  }
  return new String(this.buffer, beginIndex, endIndex - beginIndex);
}

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

int pos = cursor.getPos();
int indexTo = cursor.getUpperBound();
  char ch = buffer.charAt(pos);
  if (HTTP.isWhitespace(ch)) {
    pos++;
  } else {
cursor.updatePos(pos);
if (cursor.atEnd()) {
  return new NameValuePair[] {};
  NameValuePair param = parseNameValuePair(buffer, cursor);
  params.add(param);
  char ch = buffer.charAt(cursor.getPos() - 1);
  if (ch == ELEM_DELIMITER) {
    break;

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.httpcomponents.httpclient

boolean terminated = false;
int pos = cursor.getPos();
final int indexFrom = cursor.getPos();
final int indexTo = cursor.getUpperBound();
  final char ch = buffer.charAt(pos);
  if (ch == '=') {
    break;
  name = buffer.substringTrimmed(indexFrom, indexTo);
} else {
  name = buffer.substringTrimmed(indexFrom, pos);
  pos++;
while (i1 < i2 && (HTTP.isWhitespace(buffer.charAt(i1)))) {
  i1++;
while ((i2 > i1) && (HTTP.isWhitespace(buffer.charAt(i2 - 1)))) {
  i2--;

代码示例来源:origin: MobiVM/robovm

throw new IllegalArgumentException("Parser cursor may not be null");
int index = cursor.getPos();
if (buffer.length() < protolength+4)
  return false; // not long enough for "HTTP/1.1"
  index = buffer.length() -4 -protolength;
} else if (index == 0) {
  while ((index < buffer.length()) &&
      HTTP.isWhitespace(buffer.charAt(index))) {
     index++;

代码示例来源:origin: MobiVM/robovm

public String substringTrimmed(int beginIndex, int endIndex) {
  if (beginIndex < 0) {
    throw new IndexOutOfBoundsException();
  }
  if (endIndex > this.len) {
    throw new IndexOutOfBoundsException();
  }
  if (beginIndex > endIndex) {
    throw new IndexOutOfBoundsException();
  }
  while (beginIndex < endIndex && HTTP.isWhitespace(this.buffer[beginIndex])) {
    beginIndex++;
  }
  while (endIndex > beginIndex && HTTP.isWhitespace(this.buffer[endIndex - 1])) {
    endIndex--;
  }
  return new String(this.buffer, beginIndex, endIndex - beginIndex);
}

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

throw new IllegalArgumentException("Header may not be null");
String authheader = header.getName();
if (authheader.equalsIgnoreCase(AUTH.WWW_AUTH)) {
  this.proxy = false;
  this.proxy = true;
} else {
  throw new MalformedChallengeException("Unexpected header name: " + authheader);
  buffer = new CharArrayBuffer(s.length());
  buffer.append(s);
  pos = 0;
while (pos < buffer.length() && HTTP.isWhitespace(buffer.charAt(pos))) {
  pos++;
while (pos < buffer.length() && !HTTP.isWhitespace(buffer.charAt(pos))) {
  pos++;
String s = buffer.substring(beginIndex, endIndex);
if (!s.equalsIgnoreCase(getSchemeName())) {
  throw new MalformedChallengeException("Invalid scheme identifier: " + s);

代码示例来源:origin: MobiVM/robovm

/**
 * Helper to skip whitespace.
 */
protected void skipWhitespace(final CharArrayBuffer buffer, final ParserCursor cursor) {
  int pos = cursor.getPos();
  int indexTo = cursor.getUpperBound();
  while ((pos < indexTo) &&
      HTTP.isWhitespace(buffer.charAt(pos))) {
    pos++;
  }
  cursor.updatePos(pos);
}

代码示例来源:origin: org.apache.httpcomponents/httpclient-android

boolean terminated = false;
int pos = cursor.getPos();
final int indexFrom = cursor.getPos();
final int indexTo = cursor.getUpperBound();
  final char ch = buffer.charAt(pos);
  if (ch == '=') {
    break;
  name = buffer.substringTrimmed(indexFrom, indexTo);
} else {
  name = buffer.substringTrimmed(indexFrom, pos);
  pos++;
while (i1 < i2 && (HTTP.isWhitespace(buffer.charAt(i1)))) {
  i1++;
while ((i2 > i1) && (HTTP.isWhitespace(buffer.charAt(i2 - 1)))) {
  i2--;

代码示例来源:origin: ibinti/bugvm

@Override
public boolean hasProtocolVersion(final CharArrayBuffer buffer,
                 final ParserCursor cursor) {
  Args.notNull(buffer, "Char array buffer");
  Args.notNull(cursor, "Parser cursor");
  int index = cursor.getPos();
  if (buffer.length() < protolength+4)
    index = buffer.length() -4 -protolength;
  } else if (index == 0) {
    while ((index < buffer.length()) &&
        HTTP.isWhitespace(buffer.charAt(index))) {
       index++;

代码示例来源:origin: com.gluonhq/robovm-rt

public String substringTrimmed(int beginIndex, int endIndex) {
  if (beginIndex < 0) {
    throw new IndexOutOfBoundsException();
  }
  if (endIndex > this.len) {
    throw new IndexOutOfBoundsException();
  }
  if (beginIndex > endIndex) {
    throw new IndexOutOfBoundsException();
  }
  while (beginIndex < endIndex && HTTP.isWhitespace(this.buffer[beginIndex])) {
    beginIndex++;
  }
  while (endIndex > beginIndex && HTTP.isWhitespace(this.buffer[endIndex - 1])) {
    endIndex--;
  }
  return new String(this.buffer, beginIndex, endIndex - beginIndex);
}

代码示例来源:origin: MobiVM/robovm

int pos;
if (header instanceof FormattedHeader) {
  buffer = ((FormattedHeader) header).getBuffer();
  pos = ((FormattedHeader) header).getValuePos();
} else {
  String s = header.getValue();
  if (s == null) {
    throw new MalformedChallengeException("Header value is null");
  buffer = new CharArrayBuffer(s.length());
  buffer.append(s);
  pos = 0;
while (pos < buffer.length() && HTTP.isWhitespace(buffer.charAt(pos))) {
  pos++;
while (pos < buffer.length() && !HTTP.isWhitespace(buffer.charAt(pos))) {
  pos++;

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Helper to skip whitespace.
 */
protected void skipWhitespace(final CharArrayBuffer buffer, final ParserCursor cursor) {
  int pos = cursor.getPos();
  final int indexTo = cursor.getUpperBound();
  while ((pos < indexTo) &&
      HTTP.isWhitespace(buffer.charAt(pos))) {
    pos++;
  }
  cursor.updatePos(pos);
}

代码示例来源:origin: org.apache.httpcomponents/httpclient-android

public NameValuePair parseNameValuePair(final CharArrayBuffer buffer,
                    final ParserCursor cursor,
                    final char[] delimiters) {
  Args.notNull(buffer, "Char array buffer");
  Args.notNull(cursor, "Parser cursor");
  int pos = cursor.getPos();
  final int indexFrom = cursor.getPos();
  final int indexTo = cursor.getUpperBound();
    final char ch = buffer.charAt(pos);
    if (ch == '=') {
      break;
    name = buffer.substringTrimmed(indexFrom, indexTo);
  } else {
    name = buffer.substringTrimmed(indexFrom, pos);
    pos++;
  while (i1 < i2 && (HTTP.isWhitespace(buffer.charAt(i1)))) {
    i1++;
  while ((i2 > i1) && (HTTP.isWhitespace(buffer.charAt(i2 - 1)))) {
    i2--;

代码示例来源:origin: com.bugvm/bugvm-rt

@Override
public boolean hasProtocolVersion(final CharArrayBuffer buffer,
                 final ParserCursor cursor) {
  Args.notNull(buffer, "Char array buffer");
  Args.notNull(cursor, "Parser cursor");
  int index = cursor.getPos();
  if (buffer.length() < protolength+4)
    index = buffer.length() -4 -protolength;
  } else if (index == 0) {
    while ((index < buffer.length()) &&
        HTTP.isWhitespace(buffer.charAt(index))) {
       index++;

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

public String substringTrimmed(int beginIndex, int endIndex) {
  if (beginIndex < 0) {
    throw new IndexOutOfBoundsException();
  }
  if (endIndex > this.len) {
    throw new IndexOutOfBoundsException();
  }
  if (beginIndex > endIndex) {
    throw new IndexOutOfBoundsException();
  }
  while (beginIndex < endIndex && HTTP.isWhitespace(this.buffer[beginIndex])) {
    beginIndex++;
  }
  while (endIndex > beginIndex && HTTP.isWhitespace(this.buffer[endIndex - 1])) {
    endIndex--;
  }
  return new String(this.buffer, beginIndex, endIndex - beginIndex);
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

int pos;
if (header instanceof FormattedHeader) {
  buffer = ((FormattedHeader) header).getBuffer();
  pos = ((FormattedHeader) header).getValuePos();
} else {
  String s = header.getValue();
  if (s == null) {
    throw new MalformedChallengeException("Header value is null");
  buffer = new CharArrayBuffer(s.length());
  buffer.append(s);
  pos = 0;
while (pos < buffer.length() && HTTP.isWhitespace(buffer.charAt(pos))) {
  pos++;
while (pos < buffer.length() && !HTTP.isWhitespace(buffer.charAt(pos))) {
  pos++;

相关文章

HTTP类方法