こんにちは
、Odata4j を使用して Odata Service を作成し、Tomcat にデプロイしました。Sesame Data Browserを使用すると、ヘッダーを持つテーブル( THREAD をクリックすると) が表示されます。私の質問は、web ブラウザーで同じデータを表示するための URL は何ですか? これをサービスで利用したいのでURLを知りたいです。
これをhttp://localhost:8888/OdataEx/example.svc
ブラウザに入力すると、XMLが表示されます
<?xml version="1.0" encoding="utf-8" ?>
<service xmlns="http://www.w3.org/2007/app" xml:base="http://localhost:8888/OdataEx/example.svc/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app">
<workspace>
<atom:title>Default</atom:title>
<collection href="Threads">
<atom:title>Threads</atom:title>
</collection>
</workspace>
</service>
そしてJavaコード生成サービスは
public class ExampleProducerFactory implements ODataProducerFactory {
public ODataProducer create(Properties properties) {
InMemoryProducer producer = new InMemoryProducer("example");
// expose this jvm's thread information (Thread instances) as an entity-set called "Threads"
producer.register(Thread.class, Long.class, "Threads", new Func<Iterable<Thread>>() {
public Iterable<Thread> apply() {
ThreadGroup tg = Thread.currentThread().getThreadGroup();
while (tg.getParent() != null)
tg = tg.getParent();
Thread[] threads = new Thread[50];
int count = tg.enumerate(threads, true);
return Enumerable.create(threads).take(count);
}
}, Funcs.method(Thread.class, Long.class, "getId"));
return producer;
}
}