org.apache.http.ParseException.getMessage()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(10.1k)|赞(0)|评价(0)|浏览(103)

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

ParseException.getMessage介绍

暂无

代码示例

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

public HttpMessage parse() throws IOException, HttpException {
  HttpMessage message = null;
  try {
    message = parseHead(this.sessionBuffer);
  } catch (ParseException px) {
    throw new ProtocolException(px.getMessage(), px);
  }
  Header[] headers = AbstractMessageParser.parseHeaders(
      this.sessionBuffer, 
      this.maxHeaderCount,
      this.maxLineLen,
      this.lineParser);
  message.setHeaders(headers);
  return message;
}

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

headers[i] = parser.parseHeader(buffer);
} catch (ParseException ex) {
  throw new ProtocolException(ex.getMessage());

代码示例来源:origin: com.myjeeva.digitalocean/digitalocean-api-client

private String httpResponseToString(HttpResponse httpResponse) {
 String response = StringUtils.EMPTY;
 if (null != httpResponse.getEntity()) {
  try {
   response = EntityUtils.toString(httpResponse.getEntity(), UTF_8);
  } catch (ParseException pe) {
   log.error(pe.getMessage(), pe);
  } catch (IOException ioe) {
   log.error(ioe.getMessage(), ioe);
  }
 }
 return response;
}

代码示例来源:origin: jeevatkm/digitalocean-api-java

private String httpResponseToString(HttpResponse httpResponse) {
 String response = StringUtils.EMPTY;
 if (null != httpResponse.getEntity()) {
  try {
   response = EntityUtils.toString(httpResponse.getEntity(), UTF_8);
  } catch (ParseException pe) {
   log.error(pe.getMessage(), pe);
  } catch (IOException ioe) {
   log.error(ioe.getMessage(), ioe);
  }
 }
 return response;
}

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

private void processFooters() throws IOException {
  final int count = this.trailerBufs.size();
  if (count > 0) {
    this.footers = new Header[this.trailerBufs.size()];
    for (int i = 0; i < this.trailerBufs.size(); i++) {
      try {
        this.footers[i] = new BufferedHeader(this.trailerBufs.get(i));
      } catch (final ParseException ex) {
        throw new IOException(ex.getMessage());
      }
    }
  }
  this.trailerBufs.clear();
}

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

private void processFooters() throws IOException {
  final int count = this.trailerBufs.size();
  if (count > 0) {
    this.footers = new Header[this.trailerBufs.size()];
    for (int i = 0; i < this.trailerBufs.size(); i++) {
      try {
        this.footers[i] = new BufferedHeader(this.trailerBufs.get(i));
      } catch (final ParseException ex) {
        throw new IOException(ex.getMessage());
      }
    }
  }
  this.trailerBufs.clear();
}

代码示例来源:origin: tmobile/pacbot

public String doHttpGet(String url, Map<String, String> headers) {
 try {
     HttpClient client = HttpClientBuilder.create().build();
     HttpGet httpget = new HttpGet(url);
     for (Map.Entry<String, String> entry : headers.entrySet()) {
       httpget.addHeader(entry.getKey(), entry.getValue());
     }
     HttpResponse httpresponse = client.execute(httpget);
     if(httpresponse.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
       return EntityUtils.toString(httpresponse.getEntity());
     }
  } catch (org.apache.http.ParseException parseException) {
    log.error("ParseException : "+parseException.getMessage());
  } catch (IOException ioException) {
    log.error("IOException : "+ioException.getMessage());
  }
  return null;
}

代码示例来源:origin: tmobile/pacbot

/**
 * 
 * @param url
 * @param requestBody
 * @param headers
 * @return
 */
public String doHttpPost(final String url, final String requestBody, final Map<String, String> headers)
{
   try {
     HttpClient client = HttpClientBuilder.create().build();
     HttpPost httppost = new HttpPost(url);
     for (Map.Entry<String, String> entry : headers.entrySet()) {
       httppost.addHeader(entry.getKey(), entry.getValue());
     }
     StringEntity jsonEntity = new StringEntity(requestBody);
     httppost.setEntity(jsonEntity);
     HttpResponse httpresponse = client.execute(httppost);
     return EntityUtils.toString(httpresponse.getEntity());
  } catch (org.apache.http.ParseException parseException) {
    log.error("ParseException : "+parseException.getMessage());
  } catch (IOException ioException) {
    log.error("IOException : "+ioException.getMessage());
  }
  return null;
}

代码示例来源:origin: tmobile/pacbot

LOGGER.error("ParseException in getHttpPut :" + parseException.getMessage());
} catch (IOException ioException) {
  LOGGER.error("IOException in getHttpPut :" + ioException.getMessage());

代码示例来源:origin: tmobile/pacbot

logger.error("ParseException in getHttpPost :"+parseException.getMessage());
  throw parseException;
} catch (Exception exception) {

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

public HttpMessage parse() throws IOException, HttpException {
  HttpMessage message = null;
  try {
    message = parseHead(this.sessionBuffer);
  } catch (ParseException px) {
    throw new ProtocolException(px.getMessage(), px);
  }
  Header[] headers = AbstractMessageParser.parseHeaders(
      this.sessionBuffer, 
      this.maxHeaderCount,
      this.maxLineLen,
      this.lineParser);
  message.setHeaders(headers);
  return message;
}

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

public HttpMessage parse() throws IOException, HttpException {
  HttpMessage message = null;
  try {
    message = parseHead(this.sessionBuffer);
  } catch (ParseException px) {
    throw new ProtocolException(px.getMessage(), px);
  }
  Header[] headers = AbstractMessageParser.parseHeaders(
      this.sessionBuffer, 
      this.maxHeaderCount,
      this.maxLineLen,
      this.lineParser);
  message.setHeaders(headers);
  return message;
}

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

public HttpMessage parse() throws IOException, HttpException {
  HttpMessage message = null;
  try {
    message = parseHead(this.sessionBuffer);
  } catch (ParseException px) {
    throw new ProtocolException(px.getMessage(), px);
  }
  Header[] headers = AbstractMessageParser.parseHeaders(
      this.sessionBuffer, 
      this.maxHeaderCount,
      this.maxLineLen,
      this.lineParser);
  message.setHeaders(headers);
  return message;
}

代码示例来源:origin: FlexoVM/flexovm

public HttpMessage parse() throws IOException, HttpException {
  HttpMessage message = null;
  try {
    message = parseHead(this.sessionBuffer);
  } catch (ParseException px) {
    throw new ProtocolException(px.getMessage(), px);
  }
  Header[] headers = AbstractMessageParser.parseHeaders(
      this.sessionBuffer, 
      this.maxHeaderCount,
      this.maxLineLen,
      this.lineParser);
  message.setHeaders(headers);
  return message;
}

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

@Override
public T parse() throws IOException, HttpException {
  final int st = this.state;
  switch (st) {
  case HEAD_LINE:
    try {
      this.message = parseHead(this.sessionBuffer);
    } catch (final ParseException px) {
      throw new ProtocolException(px.getMessage(), px);
    }
    this.state = HEADERS;
    //$FALL-THROUGH$
  case HEADERS:
    final Header[] headers = AbstractMessageParser.parseHeaders(
        this.sessionBuffer,
        this.messageConstraints.getMaxHeaderCount(),
        this.messageConstraints.getMaxLineLength(),
        this.lineParser,
        this.headerLines);
    this.message.setHeaders(headers);
    final T result = this.message;
    this.message = null;
    this.headerLines.clear();
    this.state = HEAD_LINE;
    return result;
  default:
    throw new IllegalStateException("Inconsistent parser state");
  }
}

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

public T parse() throws IOException, HttpException {
  final int st = this.state;
  switch (st) {
  case HEAD_LINE:
    try {
      this.message = parseHead(this.sessionBuffer);
    } catch (final ParseException px) {
      throw new ProtocolException(px.getMessage(), px);
    }
    this.state = HEADERS;
    //$FALL-THROUGH$
  case HEADERS:
    final Header[] headers = AbstractMessageParser.parseHeaders(
        this.sessionBuffer,
        this.messageConstraints.getMaxHeaderCount(),
        this.messageConstraints.getMaxLineLength(),
        this.lineParser,
        this.headerLines);
    this.message.setHeaders(headers);
    final T result = this.message;
    this.message = null;
    this.headerLines.clear();
    this.state = HEAD_LINE;
    return result;
  default:
    throw new IllegalStateException("Inconsistent parser state");
  }
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

@Override
public T parse() throws IOException, HttpException {
  final int st = this.state;
  switch (st) {
  case HEAD_LINE:
    try {
      this.message = parseHead(this.sessionBuffer);
    } catch (final ParseException px) {
      throw new ProtocolException(px.getMessage(), px);
    }
    this.state = HEADERS;
    //$FALL-THROUGH$
  case HEADERS:
    final Header[] headers = AbstractMessageParser.parseHeaders(
        this.sessionBuffer,
        this.messageConstraints.getMaxHeaderCount(),
        this.messageConstraints.getMaxLineLength(),
        this.lineParser,
        this.headerLines);
    this.message.setHeaders(headers);
    final T result = this.message;
    this.message = null;
    this.headerLines.clear();
    this.state = HEAD_LINE;
    return result;
  default:
    throw new IllegalStateException("Inconsistent parser state");
  }
}

代码示例来源:origin: Nextdoor/bender

@Override
public T parse() throws IOException, HttpException {
  final int st = this.state;
  switch (st) {
  case HEAD_LINE:
    try {
      this.message = parseHead(this.sessionBuffer);
    } catch (final ParseException px) {
      throw new ProtocolException(px.getMessage(), px);
    }
    this.state = HEADERS;
    //$FALL-THROUGH$
  case HEADERS:
    final Header[] headers = AbstractMessageParser.parseHeaders(
        this.sessionBuffer,
        this.messageConstraints.getMaxHeaderCount(),
        this.messageConstraints.getMaxLineLength(),
        this.lineParser,
        this.headerLines);
    this.message.setHeaders(headers);
    final T result = this.message;
    this.message = null;
    this.headerLines.clear();
    this.state = HEAD_LINE;
    return result;
  default:
    throw new IllegalStateException("Inconsistent parser state");
  }
}

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

public T parse() throws IOException, HttpException {
  final int st = this.state;
  switch (st) {
  case HEAD_LINE:
    try {
      this.message = parseHead(this.sessionBuffer);
    } catch (final ParseException px) {
      throw new ProtocolException(px.getMessage(), px);
    }
    this.state = HEADERS;
    //$FALL-THROUGH$
  case HEADERS:
    final Header[] headers = AbstractMessageParserHC4.parseHeaders(
        this.sessionBuffer,
        this.messageConstraints.getMaxHeaderCount(),
        this.messageConstraints.getMaxLineLength(),
        this.lineParser,
        this.headerLines);
    this.message.setHeaders(headers);
    final T result = this.message;
    this.message = null;
    this.headerLines.clear();
    this.state = HEAD_LINE;
    return result;
  default:
    throw new IllegalStateException("Inconsistent parser state");
  }
}

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

@Override
public T parse() throws IOException, HttpException {
  final int st = this.state;
  switch (st) {
  case HEAD_LINE:
    try {
      this.message = parseHead(this.sessionBuffer);
    } catch (final ParseException px) {
      throw new ProtocolException(px.getMessage(), px);
    }
    this.state = HEADERS;
    //$FALL-THROUGH$
  case HEADERS:
    final Header[] headers = AbstractMessageParser.parseHeaders(
        this.sessionBuffer,
        this.messageConstraints.getMaxHeaderCount(),
        this.messageConstraints.getMaxLineLength(),
        this.lineParser,
        this.headerLines);
    this.message.setHeaders(headers);
    final T result = this.message;
    this.message = null;
    this.headerLines.clear();
    this.state = HEAD_LINE;
    return result;
  default:
    throw new IllegalStateException("Inconsistent parser state");
  }
}

相关文章