<commit_before># Thick

Thick is very lightweight web server for JRuby based on excellent Netty library.

## Status

Works on several Sinatra and Rails applications. No real testing, yet.

## Speed

see PERFORMANCE.md

## Interfaces

Thick provides interfaces to control it's behaviour.

### Asynchronous responses

Asynchronous responses provide functionality to stream response to the client by chunks.

The most basic API looks

    env['thick.async'].async!(*params, &block)

the application has to respond in a standard manner

    [status, headers, body]

the response will be processed and send to the client, however the connection is not closed, instead the block is
executed with parameters passed as params. From the block the application can stream data to the client

    env['thick.async'].call(chunk)

after the response is completed the application has to close the connection

    env['thick.async'].close

In more complex scenarios the params and block may be omitted. It's up to the application to wait till the response
header is sent to the client and stream it's data. To simplify the signalization the application may check if it's safe
to send it's data by.

    env['thick.async'].ready?

if the method's response is positive it's safe to stream the data.

In the most complex cases it might be necessary to completely bypass default HTTP response generated by the server. In
those cases the application calls

    env['thick.async'].custom!(*params, &block)

the method informs the server to not send any response on the connection and do not close the connection.
The contract is the same as with async! mechanism. The block with parameters params is triggered by the server when
it's safe to stream data. If the block is not given it's completely up to the application to stream the data.
The application may check whether the server considers safe to stream data by the same way as with async! response

    env['thick.async'].ready?

In the case of custom responses it should be safe to stream right away without checking the server's opinion. Also with
custom responses it's not necessary to return standard rack response.

## Starting

    thick [-o <interface>] [-p <port>] [-E <environment>]

## Installation

    gem install thick

## License

MIT ... let me know if that's a problem for you.<commit_msg>Image<commit_after># Thick

Thick is very lightweight web server for JRuby based on excellent Netty library.

[![Build Status](https://secure.travis-ci.org/marekjelen/thick.png?branch=master)](http://travis-ci.org/marekjelen/thick)

## Status

Works on several Sinatra and Rails applications. No real testing, yet.

## Speed

see PERFORMANCE.md

## Interfaces

Thick provides interfaces to control it's behaviour.

### Asynchronous responses

Asynchronous responses provide functionality to stream response to the client by chunks.

The most basic API looks

    env['thick.async'].async!(*params, &block)

the application has to respond in a standard manner

    [status, headers, body]

the response will be processed and send to the client, however the connection is not closed, instead the block is
executed with parameters passed as params. From the block the application can stream data to the client

    env['thick.async'].call(chunk)

after the response is completed the application has to close the connection

    env['thick.async'].close

In more complex scenarios the params and block may be omitted. It's up to the application to wait till the response
header is sent to the client and stream it's data. To simplify the signalization the application may check if it's safe
to send it's data by.

    env['thick.async'].ready?

if the method's response is positive it's safe to stream the data.

In the most complex cases it might be necessary to completely bypass default HTTP response generated by the server. In
those cases the application calls

    env['thick.async'].custom!(*params, &block)

the method informs the server to not send any response on the connection and do not close the connection.
The contract is the same as with async! mechanism. The block with parameters params is triggered by the server when
it's safe to stream data. If the block is not given it's completely up to the application to stream the data.
The application may check whether the server considers safe to stream data by the same way as with async! response

    env['thick.async'].ready?

In the case of custom responses it should be safe to stream right away without checking the server's opinion. Also with
custom responses it's not necessary to return standard rack response.

## Starting

    thick [-o <interface>] [-p <port>] [-E <environment>]

## Installation

    gem install thick

## License

MIT ... let me know if that's a problem for you.
{'fraction_non_alphanumeric': 0.059461715001043185, 'fraction_numerical': 0.0, 'mean_word_length': 4.165948275862069, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4450307', 'n_tokens_mistral': 1230, 'n_tokens_neox': 1146, 'n_words': 689}