Java Code Examples for org.jboss.netty.handler.codec.http.HttpRequest#getHeader()

The following examples show how to use org.jboss.netty.handler.codec.http.HttpRequest#getHeader() . 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: NettyAsyncHttpProvider.java    From ck with Apache License 2.0 5 votes vote down vote up
private final static int computeAndSetContentLength(Request request, HttpRequest r) {
	int lenght = (int) request.getLength();
	if (lenght == -1 && r.getHeader(HttpHeaders.Names.CONTENT_LENGTH) != null) {
		lenght = Integer.valueOf(r.getHeader(HttpHeaders.Names.CONTENT_LENGTH));
	}

	if (lenght != -1) {
		r.setHeader(HttpHeaders.Names.CONTENT_LENGTH, String.valueOf(lenght));
	}
	return lenght;
}
 
Example 2
Source File: WebSocketChannelHandler.java    From usergrid with Apache License 2.0 5 votes vote down vote up
private String getWebSocketLocation( HttpRequest req ) {
    String path = req.getUri();
    if ( path.equals( "/" ) ) {
        path = null;
    }
    if ( path != null ) {
        path = removeEnd( path, "/" );
    }
    String location =
            ( ssl ? "wss://" : "ws://" ) + req.getHeader( HttpHeaders.Names.HOST ) + ( path != null ? path : "" );
    logger.info( location );
    return location;
}