TIKA - Compute Content-Encoding of a document - apache-tika

I'm using Tika 1.26 in order to extract metadata of a document.
I first gave a try to the Tika Server and then I switched to programmatic API. Nevertheless, even if the documentation states that the Content-Encoding of a document should be returned via the /meta API or the MetadataParser, the property is not actually returned.
I found that the API that actually returns a Charset is the CharsetDetector, but I don't know how to invoke this same API via the Tika Server.
I don't have any clue right now.
Can someone point me out what's the correct way to model this use case or if I'm doing something wrong?

Related

Does YouTube Data API Client Library for Java implement optimize traffic using etags or gzip?

Does the YouTube Data API Client Library for Java use Etags and/or gzip, as described at Getting started page?
Documentation is short (only find java docs) and don't say anything about it, so i guess is just a wrapper.
Based from this link, Etags are supported by youtube but it depends on what kind of data you are asking.
To use the etag, create a header request and put "If-None-Match" equal to your etag value. Note this should be a request header and not appended to the endpoint call. You can also use "If-Match".
Depending on what kind of API you are using, the way of inserting a new value to the request header may differ slightly. The ETag response-header field provides the current value of the entity tag for the requested variant.
You may also check on this related thread.

Posting form-data and binary data through AWS API Gateway

I'm trying to POST "mutlipart\form-data" to my EC2 instance through AWS API Gateway, but I couldn't find a way to this. There is a way to post data using "application/x-www-form-urlencoded" and Mapping Tamplate to convert it to JSON but still posting a binary data like an image file is missing I guess. Is there anything I'm missing ?
EDIT:
I have found another way:
I convert the image to base64 string then POST it as with content type "application/x-www-form-urlencoded". By this way I'm sending whole image as string. After I got the message I can convert it back to image in PHP. Only down side of this I could find is when I convert image to base64 its size gets a bit bigger. Other than that, I couldnt find any other downside. If there is could you please share with me ?
Api Gateway team here.
Binary data isn't supported at the moment, but it's on our backlog. Several customers have requested this.
Some customers have had success using the base64 util in the mapping templates which may get it working for you: http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html#util-template-reference
Other than that you'll have to wait for official support.
Edit
Binary support is finally here!!

Getting a compressed Neo4j response

I'm using Transactional Cypher HTTP endpoint from my application to execute queries in Neo4j. I was wondering if there is a way to get zipped response from server.
I read some threads about it but they mentioned to create unmanaged extensions for it:
http://www.markhneedham.com/blog/2013/07/08/neo4j-unmanaged-extension-creating-gzipped-streamed-responses-with-jetty/
I just want the zipped response using HTTP endpoints that I'm already using.
I guess setting http parameter in request to tell the server to compress response will not work.
Is there any configuration that can enable the response to get compressed?
Any ideas for unzipping response as well?
Regards,
Rahul
You can run Neo4j behind a proxy caring about compression. One example would be using Apache httpd with mod_deflate for compression and mod_proxy_http for the communication with Neo4j.
I've played around some time ago with a mod_proxy setup, see https://github.com/sarmbruster/vagrant_neo4j_modproxy/blob/master/etc/apache2/sites-available/default as a starting point. Be aware this example does not use mod_deflate yet.
Mark Needham implemented it once, it was not a lot of effort, so you can just take his code build it and put it into your server:
http://www.markhneedham.com/blog/2013/07/08/neo4j-unmanaged-extension-creating-gzipped-streamed-responses-with-jetty/

EBAY - Sending a file via http post?

I've a file I want to send to the ebay system to support the LMS.
All the samples I've found include the use of the API, but the environment I'm working in doesn't have the ability to use it (the api).
So I'm forced to send the file with an HTTP post. But the doc's seem lacking.
Has anyone constructed/found an example of a HTTP post that will send a given file.
EDIT:
Oh.. what I see in the samples I have found is an area that seems it's supposed to have the data, but in the sample, there's nothing I'd consider real data.
Are you talking about the file transfer service or the bulk upload service? Don't you just generate an xml document and post the url like in this example:
http://developer.ebay.com/DevZone/file-transfer/CallRef/uploadFile.html#Samples

Can ServletFileUpload.parseRequest() only be called once per request?

I'm working a custom SpringSecurityFilter for my Grails application and I'm trying to use the commons upload library to process the request. I'm able to process the request in the filter but once it gets to my controller, none of the values are available.
Can the HttpRequest only be processed once by the upload library? I'm guessing it's cleaning up the temp files. Is there a way to keep them around so they can be processed again at the controller level?
I need to interrogate a form parameter for the security (due to the client I can't add it to the http headers) but once I get the value, it seems to wipe the request for further processing.
Yes. A Request can only be parsed once.
I saw this answer on Apache's FAQ page for FileUpload.
Question: Why is parseRequest() returning no items?
Answer: "This most commonly happens when the request has already been parsed, or processed in some other way. Since the input stream has aleady been consumed by that earlier process, it is no longer available for parsing by Commons FileUpload."
Reference: http://commons.apache.org/fileupload/faq.html

Resources