You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stanbol.apache.org by Michal Krajňanský <mi...@gmail.com> on 2016/09/27 15:41:40 UTC

REST: How to extract plaintext+lang from any doc

Dear Stanbol Users,

I have been experimenting with Stanbol and run in some issues with doing
very basic REST calls. If there is anyone who can help, I would be very
grateful.

*(1) This works:*
curl -v -X POST -H "Accept: text/plain" -T some.pdf "
http://localhost:8080/enhancer/*engine/tika*
<http://localhost:8080/enhancer/engine/tika>"

*(2) This does not work:*
(I created a very simple chain that only contains a single engine -- Tika)
curl -v -X POST -H "Accept: text/plain" -T some.pdf "
http://localhost:8080/enhancer/*chain/tika-chain*
<http://localhost:8080/enhancer/engine/tika>"
gives the exception:
javax.servlet.ServletException: java.lang.IllegalStateException: The
@FormParam is utilized when the content type of the request entity is not
application/x-www-form-urlencoded

My goal is to build a chain that can take any file as an input, and returns
2 things:
- plain text
- detected language

The second setup (2) works, if I specify explicitly the "Content-type:
application/pdf". But it is my understanding that Tika is able to do this,
and the purpose is that the my client application should not need to know
the doc type in advance.

Thank you in advance for any help.


Michal