On 7/20/22 2:13 PM, Tilman Hausherr wrote:
I noticed you have "Accept: text/plain"

When I try this:

curl -T Get_Started_With_Smallpdf.pdf http://localhost:9998/tika --header "Accept: 
text/plain"

I get

Caused by: java.util.NoSuchElementException: No value present
         at java.util.OptionalInt.getAsInt(OptionalInt.java:130) ~[?:?]
         at 
org.apache.tika.server.core.ProduceTypeResourceComparator.compareProduceTypes(ProduceTypeResourceComparator.java:136)
 ~[tika-server-standard-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]
         at 
org.apache.tika.server.core.ProduceTypeResourceComparator.compare(ProduceTypeResourceComparator.java:97)
 ~[tika-server-standard-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]
         at 
org.apache.cxf.jaxrs.model.OperationResourceInfoComparator.compare(OperationResourceInfoComparator.java:69)
 ~[tika-server-standard-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]
         at 
org.apache.cxf.jaxrs.model.OperationResourceInfoComparator.compare(OperationResourceInfoComparator.java:31)
 ~[tika-server-standard-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]
         at java.util.TreeMap.put(TreeMap.java:795) ~[?:?]
         at java.util.TreeMap.put(TreeMap.java:534) ~[?:?]
         at 
org.apache.cxf.jaxrs.utils.JAXRSUtils.findTargetMethod(JAXRSUtils.java:551) 
~[tika-server-standard-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]

without the header, I get the html output.

i don't see your error with curl, with or without header spec'm

here, *with* 'text/plain' header specified,

        curl -v  --header "Accept: text/plain" -T 
~/Get_Started_With_Smallpdf.pdf http://127.0.0.1:9998/tika
                *   Trying 127.0.0.1:9998...
                * Connected to 127.0.0.1 (127.0.0.1) port 9998 (#0)
                > PUT /tika HTTP/1.1
                > Host: 127.0.0.1:9998
                > User-Agent: curl/7.82.0
                > Accept: text/plain
                > Content-Length: 69451
                > Expect: 100-continue
                >
                * Mark bundle as not supporting multiuse
                < HTTP/1.1 100 Continue
                * We are completely uploaded and fine
                * Mark bundle as not supporting multiuse
                < HTTP/1.1 200 OK
                < Date: Wed, 20 Jul 2022 20:27:25 GMT
                < Content-Type: text/plain
                < Transfer-Encoding: chunked
                < Server: Jetty(9.4.48.v20220622)
                <

                Welcome to Smallpdf

                Digital Documents—All In One Place

                Access Files Anytime, Anywhere

                Enhance Documents in One Click

                Collaborate With Others

                With the new Smallpdf experience, you can
                freely upload, organize, and share digital
                documents. When you enable the ‘Storage’
                option, we’ll also store all processed files here.

                You can access files stored on Smallpdf from
                your computer, phone, or tablet. We’ll also
                sync files from the Smallpdf Mobile App to our
                online portal

                When you right-click on a file, we’ll present
                you with an array of options to convert,
                compress, or modify it.

                Forget mundane administrative tasks. With
                Smallpdf, you can request e-signatures, send
                large files, or even enable the Smallpdf G Suite
                App for your entire organization.

                Ready to take document management to the next level?

                https://bit.ly/smallpdf-preferences-en
                https://bit.ly/smallpdf-preferences-en
                https://bit.ly/smallpdf-download-en
                https://bit.ly/smallpdf-chrome-extension
                https://bit.ly/smallpdf-chrome-extension

                * Connection #0 to host 127.0.0.1 left intact

it requests & returns text, no error.

and withOUT,

        curl -v  -T ~/Get_Started_With_Smallpdf.pdf http://127.0.0.1:9998/tika

                *   Trying 127.0.0.1:9998...
                * Connected to 127.0.0.1 (127.0.0.1) port 9998 (#0)
                > PUT /tika HTTP/1.1
                > Host: 127.0.0.1:9998
                > User-Agent: curl/7.82.0
                > Accept: */*
                > Content-Length: 69451
                > Expect: 100-continue
                >
                * Mark bundle as not supporting multiuse
                < HTTP/1.1 100 Continue
                * We are completely uploaded and fine
                * Mark bundle as not supporting multiuse
                < HTTP/1.1 200 OK
                < Date: Wed, 20 Jul 2022 20:28:56 GMT
                < Content-Type: text/xml
                < Transfer-Encoding: chunked
                < Server: Jetty(9.4.48.v20220622)
                <
                <?xml version="1.0" encoding="UTF-8"?><html 
xmlns="http://www.w3.org/1999/xhtml";>
                
                    <head>
                
                        <meta name="pdf:PDFVersion" content="1.7"/>
                
                        <meta name="xmp:CreatorTool" content="Adobe InDesign 15.1 
(Macintosh)"/>
                
                        <meta name="pdf:hasXFA" content="false"/>
                
                        <meta name="access_permission:modify_annotations" 
content="true"/>
                
                        <meta name="access_permission:can_print_degraded" 
content="true"/>
                
                        <meta name="dcterms:created" 
content="2020-10-14T15:08:10Z"/>
                
                        <meta name="dcterms:modified" 
content="2020-10-14T15:08:10Z"/>
                
                        <meta name="dc:format" content="application/pdf; 
version=1.7"/>
                
                        <meta name="xmpMM:DocumentID" 
content="xmp.id:7a865d84-8dbf-4015-96b7-fdae89a9603b"/>
                
                        <meta name="pdf:docinfo:creator_tool" content="Adobe InDesign 
15.1 (Macintosh)"/>
                
                        <meta name="access_permission:fill_in_form" 
content="true"/>
                
                        <meta name="pdf:docinfo:modified" 
content="2020-10-14T15:08:10Z"/>
                
                        <meta name="pdf:hasCollection" content="false"/>
                
                        <meta name="pdf:encrypted" content="false"/>
                
                        <meta name="xmp:CreateDate" 
content="2020-10-14T17:08:10Z"/>
                
                        <meta name="Content-Length" content="69451"/>
                
                        <meta name="pdf:hasMarkedContent" content="false"/>
                
                        <meta name="Content-Type" content="application/pdf"/>
                
                        <meta name="xmp:ModifyDate" 
content="2020-10-14T17:08:10Z"/>
                
                        <meta name="xmp:MetadataDate" 
content="2020-10-14T17:08:10Z"/>
                
                        <meta name="dc:language" content="en-US"/>
                
                        <meta name="pdf:producer" content="Adobe PDF Library 
15.0"/>
                
                        <meta name="X-TIKA:digest:SHA256" 
content="91184c3c4db0d5d6fdac1d33a220f208e29df1b4c06daebc0591ff6447bcfed2"/>
                
                        <meta name="access_permission:extract_for_accessibility" 
content="true"/>
                
                        <meta name="access_permission:assemble_document" 
content="true"/>
                
                        <meta name="xmpTPg:NPages" content="1"/>
                
                        <meta name="pdf:hasXMP" content="true"/>
                
                        <meta name="access_permission:extract_content" 
content="true"/>
                
                        <meta name="xmpMM:DerivedFrom:DocumentID" 
content="xmp.did:b47e2f57-0029-45c5-8e1d-97f7c1535615"/>
                
                        <meta name="access_permission:can_print" 
content="true"/>
                
                        <meta name="pdf:docinfo:trapped" content="False"/>
                
                        <meta name="X-TIKA:Parsed-By" 
content="org.apache.tika.parser.DefaultParser"/>
                
                        <meta name="X-TIKA:Parsed-By" 
content="org.apache.tika.parser.pdf.PDFParser"/>
                
                        <meta name="xmpMM:DerivedFrom:InstanceID" 
content="xmp.iid:20710a9c-3691-41fa-bd81-adf858100386"/>
                
                        <meta name="access_permission:can_modify" 
content="true"/>
                
                        <meta name="pdf:docinfo:producer" content="Adobe PDF Library 
15.0"/>
                
                        <meta name="pdf:docinfo:created" 
content="2020-10-14T15:08:10Z"/>
                
                        <title>&#0;</title>
                
                    </head>
                
                    <body>
                        <div class="page">
                            <p/>
                
                            <p>Welcome to Smallpdf
                </p>
                
                            <p>Digital Documents—All In One Place
                </p>
                
                            <p>Access Files Anytime, Anywhere
                </p>
                
                            <p>Enhance Documents in One Click
                </p>
                
                            <p>Collaborate With Others
                </p>
                
                            <p>With the new Smallpdf experience, you can
                freely upload, organize, and share digital
                documents. When you enable the ‘Storage’
                option, we’ll also store all processed files here.
                </p>

                            <p>You can access files stored on Smallpdf from
                your computer, phone, or tablet. We’ll also
                sync files from the Smallpdf Mobile App to our
                online portal
                </p>

                            <p>When you right-click on a file, we’ll present
                you with an array of options to convert,
                compress, or modify it.
                </p>

                            <p>Forget mundane administrative tasks. With
                Smallpdf, you can request e-signatures, send
                large files, or even enable the Smallpdf G Suite
                App for your entire organization.
                </p>

                            <p>Ready to take document management to the next level? 
</p>

                            <p/>

                            <div class="annotation">
                                <a 
href="https://bit.ly/smallpdf-preferences-en";>https://bit.ly/smallpdf-preferences-en</a>
                            </div>

                            <div class="annotation">
                                <a 
href="https://bit.ly/smallpdf-preferences-en";>https://bit.ly/smallpdf-preferences-en</a>
                            </div>

                            <div class="annotation">
                                <a 
href="https://bit.ly/smallpdf-download-en";>https://bit.ly/smallpdf-download-en</a>
                            </div>

                            <div class="annotation">
                                <a 
href="https://bit.ly/smallpdf-chrome-extension";>https://bit.ly/smallpdf-chrome-extension</a>
                            </div>

                            <div class="annotation">
                                <a 
href="https://bit.ly/smallpdf-chrome-extension";>https://bit.ly/smallpdf-chrome-extension</a>
                            </div>

                        </div>

                    </body>
                </html>
                * Connection #0 to host 127.0.0.1 left intact

, requests '*/*' and returns "text/xml'

just to check, if I use your at-the-end header arg placement

        curl -v -T ~/Get_Started_With_Smallpdf.pdf http://127.0.0.1:9998/tika --header 
"Accept: text/plain"

i again see no error,

        *   Trying 127.0.0.1:9998...
        * Connected to 127.0.0.1 (127.0.0.1) port 9998 (#0)
        > PUT /tika HTTP/1.1
        > Host: 127.0.0.1:9998
        > User-Agent: curl/7.82.0
        > Accept: text/plain
        > Content-Length: 69451
        > Expect: 100-continue
        >
        * Mark bundle as not supporting multiuse
        < HTTP/1.1 100 Continue
        * We are completely uploaded and fine
        * Mark bundle as not supporting multiuse
        < HTTP/1.1 200 OK
        < Date: Wed, 20 Jul 2022 20:32:00 GMT
        < Content-Type: text/plain
        < Transfer-Encoding: chunked
        < Server: Jetty(9.4.48.v20220622)
        <

        Welcome to Smallpdf

        Digital Documents—All In One Place

        Access Files Anytime, Anywhere

        Enhance Documents in One Click

        Collaborate With Others

        With the new Smallpdf experience, you can
        freely upload, organize, and share digital
        documents. When you enable the ‘Storage’
        option, we’ll also store all processed files here.

        You can access files stored on Smallpdf from
        your computer, phone, or tablet. We’ll also
        sync files from the Smallpdf Mobile App to our
        online portal

        When you right-click on a file, we’ll present
        you with an array of options to convert,
        compress, or modify it.

        Forget mundane administrative tasks. With
        Smallpdf, you can request e-signatures, send
        large files, or even enable the Smallpdf G Suite
        App for your entire organization.

        Ready to take document management to the next level?

        https://bit.ly/smallpdf-preferences-en
        https://bit.ly/smallpdf-preferences-en
        https://bit.ly/smallpdf-download-en
        https://bit.ly/smallpdf-chrome-extension
        https://bit.ly/smallpdf-chrome-extension

        * Connection #0 to host 127.0.0.1 left intact


this is with

        curl -V
                curl 7.82.0 (x86_64-redhat-linux-gnu) libcurl/7.82.0 
OpenSSL/3.0.5 zlib/1.2.11 brotli/1.0.9 libidn2/2.3.3 libpsl/0.21.1 
(+libidn2/2.3.2) libssh/0.9.6/openssl/zlib nghttp2/1.46.0 OpenLDAP/2.6.2
                Release-Date: 2022-03-05
                Protocols: dict file ftp ftps gopher gophers http https imap 
imaps ldap ldaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
                Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 
HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL 
TLS-SRP UnixSockets

and

        tika-server-standard-2.4.2-20220720.025305-98.jar



Reply via email to