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; }
headers[i] = parser.parseHeader(buffer); } catch (ParseException ex) { throw new ProtocolException(ex.getMessage());
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; }
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; }
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(); }
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(); }
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; }
/** * * @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; }
LOGGER.error("ParseException in getHttpPut :" + parseException.getMessage()); } catch (IOException ioException) { LOGGER.error("IOException in getHttpPut :" + ioException.getMessage());
logger.error("ParseException in getHttpPost :"+parseException.getMessage()); throw parseException; } catch (Exception exception) {
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; }
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; }
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; }
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; }
@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"); } }
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"); } }
@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"); } }
@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"); } }
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"); } }
@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"); } }