webDAVのファイル一覧取得処理について

1,296 views
Skip to first unread message

木戸恵

unread,
Jan 11, 2011, 10:17:16 AM1/11/11
to android-g...@googlegroups.com
初めまして、いつもMLを参考にさせていただいております。

自分ではどうしても解決できず、皆様のお知恵を貸していただければと思います。

現在webDAVサーバーとやり取りを行うためのアプリを実装しているのですが、まずwebDAV内のファイル及びディレクトリの一覧を取得するところで躓いてしまっています。
イメージとしましては、WebDavDroid Liteのようにサーバーのファイル及びディレクトリの一覧を出したいのです。
サーバーのプロパティ取得のため「PROPFIND」メソッドでリクエストを投げなければなりません。
しかし、HttpPostクラスやHttpGetクラス等とHttpClientクラスを使用するサンプルは多かったのですが、PROPFINDを使用する場合は見つかりませんでした。
HttpRequestクラスを初期化する際にBasicHttpRequestを使用すれば、独自のメソッド定義ができるようなのですが、HttpClient クラスのインスタンスを使用してリクエストを投げようとするとエラーが出てしまいまして、どのように進めていいのかがわからない状態になってしまっています。

もしどなたかご存じであれば、webDAV内のファイル及びディレクトリの一覧の取得方法について教えていただけますと幸いです。

以上、宜しくお願いいたします。

--
------------------------------------------------
木戸 恵
E-Mail:megmeg...@gmail.com
------------------------------------------------

megmegfive

unread,
Jan 11, 2011, 8:06:15 PM1/11/11
to 日本Androidの会
初めまして、いつもMLを参考にさせていただいております。

自分ではどうしても解決できず、皆様のお知恵を貸していただければと思います。

現在webDAVサーバーとやり取りを行うためのアプリを実装しているのですが、まずwebDAV内のファイル及びディレクトリの一覧を取得するところ
で躓いてしまっています。
イメージとしましては、WebDavDroid Liteのようにサーバーのファイル及びディレクトリの一覧を出したいのです。
サーバーのプロパティ取得のため「PROPFIND」メソッドでリクエストを投げなければなりません。
しかし、HttpPostクラスやHttpGetクラス等とHttpClientクラスを使用するサンプルは多かったのですが、PROPFINDを使用
する場合は見つかりませんでした。
HttpRequestクラスを初期化する際にBasicHttpRequestを使用すれば、独自のメソッド定義ができるようなのですが、
HttpClient クラスのインスタンスを使用してリクエストを投げようとするとエラーが出てしまいまして、どのように進めていいのかがわからない
状態になってしまっています。

もしどなたかご存じであれば、webDAV内のファイル及びディレクトリの一覧の取得方法について教えていただけますと幸いです。

以上、宜しくお願いいたします。

木戸

l.b.

unread,
Jan 11, 2011, 8:22:35 PM1/11/11
to 日本Androidの会

 村上です。

 ライセンス的な問題がなければ、Jakarta Slide(http://slide.jakarta.jp/)などのオープンソースなJava
WebDAVクライアントライブラリを使用するのはいかがでしょうか。
> E-Mail:megmegfiv...@gmail.com <E-Mail%3Amegmegfiv...@gmail.com>
> ------------------------------------------------

megmegfive

unread,
Jan 11, 2011, 9:05:18 PM1/11/11
to 日本Androidの会
村上様

さっそくの返信ありがとうございます。

昨日、下記のURLを参考にしてJackrabbitを外部JARとして参照してみましたが、エラーが出てしまったのです。
http://syo.cocolog-nifty.com/freely/2010/10/javawebdav-8cd5.html

コンソールに表示されたエラーの内容は下記の通りです。
----------
[2011-01-12 10:21:35 - photoViewer]: Dxwarning: Ignoring InnerClasses
attribute for an anonymous inner class
(EDU.oswego.cs.dl.util.concurrent.FutureResult$1) that doesn't come
with an
associated EnclosingMethod attribute. This class was probably produced
by a
compiler that did not target the modern .class file format. The
recommended
solution is to recompile the class from source, using an up-to-date
compiler
and without specifying any "-target" type options. The consequence of
ignoring
this warning is that reflective operations on this class will
incorrectly
indicate that it is *not* an inner class.

*上記の内容が違うクラスに対して繰り返し表示されます

Ill-advised or mistaken usage of a core class (java.* or javax.*)
when not building a core library.

This is often due to inadvertently including a core library file
in your application's project, when using an IDE (such as
Eclipse). If you are sure you're not intentionally defining a
core class, then this is the most likely explanation of what's
going on.

However, you might actually be trying to define a class in a core
namespace, the source of which you may have taken, for example,
from a non-Android virtual machine project. This will most
assuredly not work. At a minimum, it jeopardizes the
compatibility of your app with future versions of the platform.
It is also often of questionable legality.

If you really intend to build a core library -- which is only
appropriate as part of creating a full virtual machine
distribution, as opposed to compiling an application -- then use
the "--core-library" option to suppress this error message.

If you go ahead and use "--core-library" but are in fact
building an application, then be forewarned that your application
will still fail to build or run, at some point. Please be
prepared for angry customers who find, for example, that your
application ceases to function once they upgrade their operating
system. You will be to blame for this problem.

If you are legitimately using some code that happens to be in a
core package, then the easiest safe alternative you have is to
repackage that code. That is, move the classes in question into
your own package namespace. This means that they will never be in
conflict with core system classes. JarJar is a tool that may help
you in this endeavor. If you find that you cannot do this, then
that is an indication that the path you are on will ultimately
lead to pain, suffering, grief, and lamentation.

[2011-01-12 10:21:40 - photoViewer]: Dx1 error; aborting
[2011-01-12 10:21:40 - photoViewer] Conversion to Dalvik format failed
with error 1
----------

「Conversion to Dalvik format failed with error 1」というエラーが出てしまっています。
プロジェクトをクリーンを行いましても、解決できませんでした。
元々のプロジェクトでは「Conversion to Dalvik format failed with error 1」は出ていませんでしたの
で、おそらくサイトからダウンロードしたJackrabbitのJARファイルの影響だと思われます…。

もう少し調査を行ってみようかと考えておりますが、もし何か解決方法をご存知でしたら、教えていただけますでしょうか。

木戸

l.b.

unread,
Jan 11, 2011, 9:29:19 PM1/11/11
to 日本Androidの会

 村上です。

 エラーメッセージを見る限り、Jackrabbitのサイトにあるjarに含まれるクラスフォーマットが古く、Dalvikのdexフォーマットに変
換できずにエラーとなっているようです。
 エラーメッセージにあるように、Jackrabbitのソースをダウンロードし、Androidをビルドするときに使っているJavaコンパイラの
バージョンでビルドしてできたjarファイルを使用してはいかがでしょうか。

 p.s. Jakarta Slideってディスコンになっていたんですね。

megmegfive

unread,
Jan 11, 2011, 11:36:52 PM1/11/11
to 日本Androidの会
村上様

返信ありがとうございます。

Jackrabbitのソースをダウンロードしてみて、私の環境でビルドを行ってみます。
そこで生成できたjarファイルを使用してもエラーが出てしまう場合は、改めて質問させていただきます。
エラーが出ないことを本当に祈っています…!

木戸
Reply all
Reply to author
Forward
0 new messages