Example usage for io.netty.handler.codec.http HttpHeaders getHost

List of usage examples for io.netty.handler.codec.http HttpHeaders getHost

Introduction

In this page you can find the example usage for io.netty.handler.codec.http HttpHeaders getHost.

Prototype

@Deprecated
public static String getHost(HttpMessage message) 

Source Link

Usage

From source file:com.barchart.http.server.PooledServerRequest.java

License:BSD License

@Override
public String getServerHost() {
    return HttpHeaders.getHost(nettyRequest);
}

From source file:com.netflix.recipes.rss.netty.NettyHandlerContainer.java

License:Open Source License

private String getBaseUri(HttpMessage httpMessage) {
    if (baseUri != null) {
        return baseUri;
    }/* ww  w. j a  v a  2 s  .c om*/
    return "http://" + HttpHeaders.getHost(httpMessage) + "/";
}

From source file:com.titilink.camel.rest.common.RestletServerCall.java

License:LGPL

@Override
public String getServerAddress() {
    String[] result = HttpHeaders.getHost(getRequest()).split(":", HOST_SPLIT_LIMIT);
    if (result.length > 0) {
        return result[0];
    }/* ww  w .  j a v  a2s .c  om*/
    return null;
}

From source file:com.titilink.camel.rest.common.RestletServerCall.java

License:LGPL

@Override
public int getServerPort() {
    String[] result = HttpHeaders.getHost(getRequest()).split(":", HOST_SPLIT_LIMIT);
    if (result.length > 1) {
        return Integer.parseInt(result[1]);
    }//  ww w . j  a va  2 s  .  c  o  m
    //equalsequalsIgnoreCase
    if (Protocol.HTTPS.equals(getRequest().getProtocolVersion().protocolName())) {
        return HTTPS_PORT;
    }
    return HTTP_PORT;
}

From source file:io.advantageous.conekt.http.impl.HttpServerImpl.java

License:Open Source License

private String getWebSocketLocation(ChannelPipeline pipeline, HttpRequest req) throws Exception {
    String prefix;//from w  w w. j a v  a  2s  . co m
    if (pipeline.get(SslHandler.class) == null) {
        prefix = "ws://";
    } else {
        prefix = "wss://";
    }
    URI uri = new URI(req.getUri());
    String path = uri.getRawPath();
    String loc = prefix + HttpHeaders.getHost(req) + path;
    String query = uri.getRawQuery();
    if (query != null) {
        loc += "?" + query;
    }
    return loc;
}

From source file:io.cettia.asity.bridge.netty4.AsityServerCodec.java

License:Apache License

private String getWebSocketLocation(ChannelPipeline pipeline, HttpRequest req) {
    return (pipeline.get(SslHandler.class) == null ? "ws://" : "wss://") + HttpHeaders.getHost(req)
            + req.getUri();//from  w w  w  .  j a v a  2s .  c om
}

From source file:io.reactivex.netty.protocol.http.client.HttpRequestHeaders.java

License:Apache License

public String getHost() {
    return HttpHeaders.getHost(nettyRequest);
}

From source file:io.reactivex.netty.protocol.http.client.HttpResponseHeaders.java

License:Apache License

public String getHost() {
    return HttpHeaders.getHost(nettyResponse);
}

From source file:malcolm.HttpUtil.java

License:Open Source License

public static Optional<Endpoint> getEndpoint(final HttpMessage msg) {
    String hostHeader = HttpHeaders.getHost(msg);
    if (hostHeader == null) {
        return Optional.empty();
    }//from ww w  .j a  v a  2s  .  co  m
    final String[] hostAndPort = hostHeader.split(":");
    return Optional.of(new Endpoint(getHost(hostAndPort), getPort(hostAndPort)));
}

From source file:org.ebayopensource.scc.cache.RequestKeyGenerator.java

License:Apache License

private String getRequestURI(FullHttpRequest request) {
    String uri = request.getUri();
    if (uri.startsWith("/")) {
        String host = HttpHeaders.getHost(request);
        if (host != null && !host.isEmpty()) {
            uri = "https://" + host + uri;
        }//  w w  w . j  av a  2  s. c o  m
    }
    return uri;
}