org.apache.http.message.BasicLineParser Java Examples

The following examples show how to use org.apache.http.message.BasicLineParser. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WebSocketClient.java    From SoloPi with Apache License 2.0 4 votes vote down vote up
private StatusLine parseStatusLine(String line) {
    if (TextUtils.isEmpty(line)) {
        return null;
    }
    return BasicLineParser.parseStatusLine(line, new BasicLineParser());
}
 
Example #2
Source File: WebSocketClient.java    From SoloPi with Apache License 2.0 4 votes vote down vote up
private Header parseHeader(String line) {
    return BasicLineParser.parseHeader(line, new BasicLineParser());
}
 
Example #3
Source File: WebSocketClient.java    From Leanplum-Android-SDK with Apache License 2.0 4 votes vote down vote up
private StatusLine parseStatusLine(String line) {
  if (TextUtils.isEmpty(line)) {
    return null;
  }
  return BasicLineParser.parseStatusLine(line, new BasicLineParser());
}
 
Example #4
Source File: WebSocketClient.java    From Leanplum-Android-SDK with Apache License 2.0 4 votes vote down vote up
private Header parseHeader(String line) {
  return BasicLineParser.parseHeader(line, new BasicLineParser());
}
 
Example #5
Source File: WebSocketClient.java    From aptoide-client with GNU General Public License v2.0 4 votes vote down vote up
private StatusLine parseStatusLine(String line) {
    if (TextUtils.isEmpty(line)) {
        return null;
    }
    return BasicLineParser.parseStatusLine(line, new BasicLineParser());
}
 
Example #6
Source File: WebSocketClient.java    From aptoide-client with GNU General Public License v2.0 4 votes vote down vote up
private Header parseHeader(String line) {
    return BasicLineParser.parseHeader(line, new BasicLineParser());
}
 
Example #7
Source File: WebSocketClient.java    From Yahala-Messenger with MIT License 4 votes vote down vote up
private StatusLine parseStatusLine(String line) {
    if (TextUtils.isEmpty(line)) {
        return null;
    }
    return BasicLineParser.parseStatusLine(line, new BasicLineParser());
}
 
Example #8
Source File: WebSocketClient.java    From Yahala-Messenger with MIT License 4 votes vote down vote up
private Header parseHeader(String line) {
    return BasicLineParser.parseHeader(line, new BasicLineParser());
}
 
Example #9
Source File: WebSocketClient.java    From hack.chat-android with MIT License 4 votes vote down vote up
private StatusLine parseStatusLine(String line) {
    if (TextUtils.isEmpty(line)) {
        return null;
    }
    return BasicLineParser.parseStatusLine(line, new BasicLineParser());
}
 
Example #10
Source File: WebSocketClient.java    From hack.chat-android with MIT License 4 votes vote down vote up
private Header parseHeader(String line) {
    return BasicLineParser.parseHeader(line, new BasicLineParser());
}
 
Example #11
Source File: RequestFactory.java    From esigate with Apache License 2.0 4 votes vote down vote up
public IncomingRequest create(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
        throws IOException {
    HttpServletRequestContext context =
            new HttpServletRequestContext(request, response, servletContext, filterChain);
    // create request line
    String uri =
            UriUtils.createURI(request.getScheme(), request.getServerName(), request.getServerPort(),
                    request.getRequestURI(), request.getQueryString(), null);
    ProtocolVersion protocolVersion = BasicLineParser.parseProtocolVersion(request.getProtocol(), null);
    IncomingRequest.Builder builder =
            IncomingRequest.builder(new BasicRequestLine(request.getMethod(), uri, protocolVersion));
    builder.setContext(context);
    // copy headers
    @SuppressWarnings("rawtypes")
    Enumeration names = request.getHeaderNames();
    while (names.hasMoreElements()) {
        String name = (String) names.nextElement();
        @SuppressWarnings("rawtypes")
        Enumeration values = request.getHeaders(name);
        while (values.hasMoreElements()) {
            String value = (String) values.nextElement();
            builder.addHeader(name, value);
        }
    }
    // create entity
    HttpServletRequestEntity entity = new HttpServletRequestEntity(request);
    builder.setEntity(entity);

    builder.setRemoteAddr(request.getRemoteAddr());
    builder.setRemoteUser(request.getRemoteUser());
    HttpSession session = request.getSession(false);
    if (session != null) {
        builder.setSessionId(session.getId());
    }
    builder.setUserPrincipal(request.getUserPrincipal());

    // Copy cookies
    // As cookie header contains only name=value so we don't need to copy
    // all attributes!
    javax.servlet.http.Cookie[] src = request.getCookies();
    if (src != null) {
        for (Cookie c : src) {
            BasicClientCookie dest = new BasicClientCookie(c.getName(), c.getValue());
            builder.addCookie(dest);
        }
    }
    builder.setSession(new HttpServletSession(request));
    builder.setContextPath(request.getContextPath());
    return builder.build();
}