jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Nuescheler <david.nuesche...@gmail.com>
Subject Re: examples of writing binary data to JCR
Date Fri, 29 Apr 2005 14:32:22 GMT
hi dave,

thanks, looks great.
do you think you could send a patch?

regards,
david

On 4/29/05, Dave Sag <dsag@visualitylife.com> wrote:
> hey David that's great and many thanks.  I was very close with my own
> code but your example filled in the blanks for me.  ta.  sorry for the
> delay but i went off on holiday for a few days.  ahh yorkshire is
> beautiful.
> 
> I updated it slightly to extract the actual mime type...  see methods
> below.
> 
> used the sun.net.www.MimeTable
> 
>     //
> ------------------------------------------------------------------------
> --
>     /**
>      * Return the filename without any path data, but with the suffix.
>      *
>      * @param   url  the url or path of the file
>      *
>      * @return  filename without any path data but including the suffix.
>      */
>     public static String getFilename(String url) {
>         int i = url.lastIndexOf(File.separator);
> 
>         if (i == -1) {
>             return url;
>         } else {
>             return url.substring(i + 1);
>         }
>     }
> 
>     //
> ------------------------------------------------------------------------
> --
>     /**
>      * gets the correct MIME content type for the given file.
>      *
>      * @param   url  the url of the file.
>      *
>      * @return  the mime type.
>      */
>     public static String getContentType(String url) {
>         // get the mime type
>         MimeTable mt = MimeTable.getDefaultTable();
> 
>         String mime = mt.getContentTypeFor(getFilename(url));
> 
>         return mime;
>     }
> 
> cheers and thanks
> 
> dave
> 
> 
> On 26/04/2005, at 12:48 AM, David Nuescheler wrote:
> 
> > hi dave,
> >
> > with respect to the question about importing binaries
> > into the repository, i checked-in a simple fs-import example into
> > the "examples"-contrib.
> >
> > http://svn.apache.org/repos/asf/incubator/jackrabbit/trunk/contrib/
> > examples/src/java/org/apache/jackrabbit/examples/FSImport.java
> >
> > its main method takes one command-line argument specifying a
> > path to a directory to be imported into the repositories root node.
> >
> > let me know if this is helpful at all...
> > extensions, fixes and clean-up are very welcome ;)
> >
> > regards,
> > david
> 
> 


-- 
----------------------------------------------------------------------
standardize your content-repository !
                               http://www.jcp.org/en/jsr/detail?id=170
---------------------------------------< david.nuescheler@day.com >---

This message is a private communication. If you are not the intended
recipient, please do not read, copy, or use it, and do not disclose it
to others. Please notify the sender of the delivery error by replying
to this message, and then delete it from your system. Thank you.

The sender does not assume any liability for timely, trouble free,
complete, virus free, secure, error free or uninterrupted arrival of
this e-mail. For verification please request a hard copy version.


mailto:david.nuescheler@day.com
http://www.day.com

David Nuescheler
Chief Technology Officer
Day Software AG
Barfuesserplatz 6 / Postfach
4001 Basel
Switzerland

T  41 61 226 98 98
F  41 61 226 98 97

Mime
View raw message