14 Commits

Author SHA1 Message Date
Adrien Grand
e589301806 Make Releasable extend AutoCloseable.
Java7's AutoCloseable allows to manage resources more nicely using
try-with-resources statements. Since the semantics of our Releasable interface
are very close to a Closeable, let's switch to it.

Close #5689
2014-04-14 17:21:42 +02:00
Shay Banon
705c7e2469 Recycled bytes in http + rest layer refactoring phase 2
Refactor the rest layer handlers to simplify common code paths (like handling) failures, and introduce optional (enabled for netty) rest channel bytes recycling
2014-04-07 15:29:04 +02:00
Shay Banon
f19f729498 Cleanup Rest Response
simplify rest response class hierarchy, by using BytesReference for content, and handling JSONP internally in the respective channel that sends the response.
Also, handle the future case where bytes might be releasable, when we start to potentially recycle bytes output stream.
2014-03-31 17:24:02 +02:00
Simon Willnauer
10ec2e948a Fix ASL Header in source files to reflect s/ElasticSearch/Elasticsearch
This commit also removes the license to Shay Banon in favor of soley
Elasticsearch. Thanks Shay for this awesome product you took it far!

Closes #4636
2014-01-07 11:22:01 +01:00
Shay Banon
a1ee68a145 fix usage of deprecated netty header method 2013-12-17 10:59:27 +01:00
Shay Banon
6a5d2bf767 remove cached stream output
start to build the infra for simpler migration to netty 4, starting with removing the cache stream output handling as it will come built in
2013-07-23 15:56:48 +02:00
Alexander Reelsen
21fcc482eb Allow to set headers in HTTP response
This commit allows to set custom headers in HTTP responses (like
setting the WWW-Authenticate header for basic auth) by adding
RestRequest.addHeader() method.

Closes #2936
Closes #2540

To get the history right: This is based on PR #2723
2013-05-10 17:58:46 +02:00
Igor Motov
a49078dfc1 lucene 4: replace UnicodeUtil.UTF8Result with BytesRef 2012-11-12 13:44:33 +01:00
Shay Banon
b26fd600f0 allow to configure cors on http
Allow to configure cors on http, if its enabled or not, and what it should output
2012-09-06 20:35:36 +02:00
Karel Minarik
f659cad8d6 Added proper headers for cross-origin resource sharing (CORS) with Ajax
Previously, when responding to Ajax requests, elasticsearch did not send proper headers for
cross-origin resource sharing (CORS) -- see issues #828, #2186.

With this commit, Ajax requests should be working. Example:

    jQuery.ajax({
      url: "http://localhost:9200/_search",
      type: "POST",
      contentType: 'application/json; charset=UTF-8',
      success: function(data) { console.log(data) }
    });

See:

* http://www.nczonline.net/blog/2010/05/25/cross-domain-ajax-with-cross-origin-resource-sharing/
* http://www.w3.org/TR/cors/#access-control-allow-headers-response-header

Closes #2186, fixes #828
2012-09-06 17:14:55 +02:00
Shay Banon
408a74206f bytes reference to know how to convert to channel buffer, so it can be used directly when sending it over with netty 2012-07-29 16:50:43 +02:00
Shay Banon
35233564fd buffer management refactoring
First phase at improving buffer management and reducing even further buffer copies. Introduce a BytesReference abstraction, allowing to more easily slice and "read/write references" from streams. This is the foundation for later using it to create smarter buffers on top of composite netty channels for example (which http now produces) as well as reducing buffer copies when sending transport/rest responses.
2012-07-07 01:26:41 +02:00
Shay Banon
6a71eab51f finalize structure, tests pass 2011-12-06 02:43:17 +02:00
Shay Banon
a8fd2d48b8 first cleanup phase, move to single src 2011-12-06 00:59:23 +02:00