Thanks very much, the archetype does work but it uses the byte array from FormFile.getContent() rather than trying to create a File object.

Now that I'm checking it, FormFile.getFileName() is really just the filename without a local path, so I guess it needs a tad different handling than the old Jersey implementation. I'll patch the ontologymanager.web resources to use byte arrays instead, looks like the way to go.

Many Thanks

Alessandro


On 30/10/2014 07:49, Reto Gmür wrote:
Hi Alessandro

Just from the code of your email you seem to be doing things right. The method you're using should work both with 0.12 as well as with 1.0.0 (in 0.12 it was still possible to use a jersey specific method, but thta's not what you're doing).

For a working example of file upload try out the stanbol-stateless-webapp maven archetype (if this doesn't work, then it's definitively a bug).

Cheers,
Reto

On Thu, Oct 30, 2014 at 8:39 AM, Rupert Westenthaler <[email protected] <mailto:[email protected]>> wrote:

    Hi Alessandro,

    AFAIK the multipart mime code in 0.12 depends on a Jersey specific
    extension to JAX-RS. Because of this Stanbol could only be used with
    Jersey and no other JAX-RS implementation. This was the reason why
    Reto chanted this in the stabbol-ng branch to use the Clerezza
    implementation for handling multipart requests.

    I have never used this, as the Stanbol Enhancer consumes multipart
    requests using custom code that does allow streaming of the request
    data.  Reto should be able to answer your question. Maybe you want
    also to ask your question on the Clerezza Mailing list.

    best
    Rupert

    On Wed, Oct 29, 2014 at 4:39 PM, Alessandro Adamou
    <[email protected]
    <mailto:[email protected]>> wrote:
    > Hi all,
    >
    > I was reviewing the state of ontologymanager Web resources and
    others after
    > the Clerezza Jena TDB bundlelist was added (thanks Rupert!).
    >
    > I'm almost sure it's unrelated to the above, but most
    OntologyManager
    > ontology loading service (via POST Multipart Form Data) seem to
    fail on my
    > setting. Uploaded files do not seem to be created locally.
    >
    > If I look at:
    >
    >
    
https://svn.apache.org/repos/asf/stanbol/trunk/ontologymanager/web/src/main/java/org/apache/stanbol/ontologymanager/web/resources/OntoNetRootResource.java
    >
    > in the performLoadOntology() method I used to be able to get a
    POSTed File
    > like this.
    >
    > file = new
    File(data.getFormFileParameterValues("file")[0].getFileName())
    >
    > where data is a
    org.apache.clerezza.jaxrs.utils.form.MultiPartBody - one of
    > the things that I guess must have changed during the commons-ng
    move.
    >
    > Trying that again now, both file.exists() and file.canRead()
    return false -
    > even after launching Stanbol with -no-security . No idea where
    POSTdata from
    > a file input are going.
    >
    > I cannot find other Stanbol Web services that support fileupload
    so I can
    > compare against them. Do we have any others currently in trunk?
    >
    > Many Thanks
    >
    > Alessandro



    --
    | Rupert Westenthaler [email protected]
    <mailto:[email protected]>
    | Bodenlehenstraße 11 ++43-699-11108907 <tel:%2B%2B43-699-11108907>
    | A-5500 Bischofshofen
    | REDLINK.CO <http://REDLINK.CO>
    ..........................................................................
    | http://redlink.co/



Reply via email to