You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stanbol.apache.org by Reto Bachmann-Gmür <re...@apache.org> on 2012/11/30 10:43:06 UTC

"Static" resources

Hello

At Apacheconeu I've been talking with Rupert and others on how static
resources should be handles. We agreed that they should no longer need to
be referenced in the webfragment. I was in favour of just having a fixed
location in the jar but Rupert convinced me that this default location
should be overwritable with a value in the MANIFEST.MF file. In the long
term it should be possible to have file-backed resources at any location in
the URI space but as a first step only the architecture for the resources
below "/static/" shall be changed.

E.g:

MANIFEST.MF
Stanbol-Static: /META-INF/stanbol-static

The jar contains

/META-INF/stanbol-static/static/hello.txt

Stanbol will serve that file at

http://<host>/static/hello.txt

if the jar contains

/META-INF/stanbol-static/hello.txt

this will for now generate a warning that currently the files must be in a
subfolder called "static" to be served (in future it should be served at
http://<host>/hello.txt).

Any thoughts? Any volunteers?

Cheers,
Reto

Re: "Static" resources

Posted by Reto Bachmann-Gmür <re...@wymiwyg.com>.
On Fri, Dec 14, 2012 at 11:57 AM, Alessandro Adamou <ad...@cs.unibo.it>wrote:

> Hi Reto,
>
>
> On 12/13/12 10:29 PM, Reto Bachmann-Gmür wrote:
>
>> I see 3 templates by that name:
>>
>> ./ontologymanager/web/src/**main/resources/templates/html/**
>> org/apache/stanbol/**ontologymanager/web/resources/**
>> ScopeResource/ontology.ftl
>> ./ontologymanager/web/src/**main/resources/templates/html/**
>> org/apache/stanbol/**ontologymanager/web/resources/**
>> OntoNetRootResource/ontology.**ftl
>> ./ontologymanager/web/src/**main/resources/templates/html/**
>> org/apache/stanbol/**ontologymanager/web/resources/**
>> SessionResource/ontology.ftl
>>
>>
>> is any of these to be used for the resource served by the the resource
>> class OntologyStatsResource ?
>>
>
> the second one certainly does. a GET returns a
>
>     Response.ok(new Viewable("ontology", new OntologyStatsResource(...)));
>

Ok, there is a slight discrepancy between the behaviour of the old jersey
viewable and the new stanbol one. The stanbol creates the path to locate
the template based on the class of the pojo with data. If another class
should be used this can be passed as a third argument to the constructor,
e.g.

Response.ok(new Viewable("ontology", new OntologyStatsResource(...),
OntoNetRootResource.class));

Reto

>
> The other two require an OntologyPrettyPrintResource instead, but I plan
> to replace it with the OntologyStatsResource anyway.
>
> Anyway because I was really in a hurry getting it to work, I reverted my
> working copy back to r1410428 (my latest commit), I can tell it works there
> if it helps. I can get back to it in a few days.
>
> Alessandro
>
>
>  On Thu, Dec 13, 2012 at 8:41 PM, Alessandro Adamou <adamou@cs.unibo.it
>> >wrote:
>>
>>  Uhm... something seems to be lost in the move.
>>>
>>> I loaded an ontology on the dev-iks sandbox and cannot visualize it
>>> anymore. Requesting text/html on
>>>
>>> http://dev.iks-project.eu:****8081/ontonet/http://www.cs.**
>>> unibo.it/~adamou/ontologies/****patterns/distribution/A-split/****<http://unibo.it/~adamou/ontologies/**patterns/distribution/A-split/**>
>>> op_declusage1.owl<http://dev.**iks-project.eu:8081/ontonet/**
>>> http://www.cs.unibo.it/~**adamou/ontologies/patterns/**
>>> distribution/A-split/op_**declusage1.owl<http://dev.iks-project.eu:8081/ontonet/http://www.cs.unibo.it/~adamou/ontologies/patterns/distribution/A-split/op_declusage1.owl>
>>> >
>>>
>>> gets me a 500 :
>>>
>>>      java.io.FileNotFoundException: Template html/org/apache/stanbol/**
>>> ontologymanager/web/util/****OntologyStatsResource/ontology not found.
>>>
>>>
>>> I still get the expected resource if I request some other mimetype, say
>>> text/turtle.
>>>
>>> But this can spoil apps such as Protege, which gives up if it receives a
>>> 500 on an import request with no Accept header.
>>>
>>> I found this out when re-running some test for my thesis
>>>
>>> Any clue?
>>>
>>> Thanks
>>>
>>> Alessandro
>>>
>>>
>>>
>>>
>>> On 11/30/12 10:43 AM, Reto Bachmann-Gmür wrote:
>>>
>>>  Hello
>>>>
>>>> At Apacheconeu I've been talking with Rupert and others on how static
>>>> resources should be handles. We agreed that they should no longer need
>>>> to
>>>> be referenced in the webfragment. I was in favour of just having a fixed
>>>> location in the jar but Rupert convinced me that this default location
>>>> should be overwritable with a value in the MANIFEST.MF file. In the long
>>>> term it should be possible to have file-backed resources at any location
>>>> in
>>>> the URI space but as a first step only the architecture for the
>>>> resources
>>>> below "/static/" shall be changed.
>>>>
>>>> E.g:
>>>>
>>>> MANIFEST.MF
>>>> Stanbol-Static: /META-INF/stanbol-static
>>>>
>>>> The jar contains
>>>>
>>>> /META-INF/stanbol-static/****static/hello.txt
>>>>
>>>>
>>>> Stanbol will serve that file at
>>>>
>>>> http://<host>/static/hello.txt
>>>>
>>>> if the jar contains
>>>>
>>>> /META-INF/stanbol-static/****hello.txt
>>>>
>>>>
>>>> this will for now generate a warning that currently the files must be
>>>> in a
>>>> subfolder called "static" to be served (in future it should be served at
>>>> http://<host>/hello.txt).
>>>>
>>>> Any thoughts? Any volunteers?
>>>>
>>>> Cheers,
>>>> Reto
>>>>
>>>>
>>>>  --
>>> M.Sc. Alessandro Adamou
>>>
>>> Alma Mater Studiorum - Università di Bologna
>>> Department of Computer Science
>>> Mura Anteo Zamboni 7, 40127 Bologna - Italy
>>>
>>> Semantic Technology Laboratory (STLab)
>>> Institute for Cognitive Science and Technology (ISTC)
>>> National Research Council (CNR)
>>> Via Nomentana 56, 00161 Rome - Italy
>>>
>>>
>>> "I will give you everything, just don't demand anything."
>>> (Ettore Petrolini, 1917)
>>>
>>> Not sent from my iSnobTechDevice
>>>
>>>
>>>
>
> --
> M.Sc. Alessandro Adamou
>
> Alma Mater Studiorum - Università di Bologna
> Department of Computer Science
> Mura Anteo Zamboni 7, 40127 Bologna - Italy
>
> Semantic Technology Laboratory (STLab)
> Institute for Cognitive Science and Technology (ISTC)
> National Research Council (CNR)
> Via Nomentana 56, 00161 Rome - Italy
>
>
> "I will give you everything, just don't demand anything."
> (Ettore Petrolini, 1917)
>
> Not sent from my iSnobTechDevice
>
>

Re: "Static" resources

Posted by Alessandro Adamou <ad...@cs.unibo.it>.
Hi Reto,

On 12/13/12 10:29 PM, Reto Bachmann-Gmür wrote:
> I see 3 templates by that name:
>
> ./ontologymanager/web/src/main/resources/templates/html/org/apache/stanbol/ontologymanager/web/resources/ScopeResource/ontology.ftl
> ./ontologymanager/web/src/main/resources/templates/html/org/apache/stanbol/ontologymanager/web/resources/OntoNetRootResource/ontology.ftl
> ./ontologymanager/web/src/main/resources/templates/html/org/apache/stanbol/ontologymanager/web/resources/SessionResource/ontology.ftl
>
>
> is any of these to be used for the resource served by the the resource
> class OntologyStatsResource ?

the second one certainly does. a GET returns a

     Response.ok(new Viewable("ontology", new OntologyStatsResource(...)));

The other two require an OntologyPrettyPrintResource instead, but I plan 
to replace it with the OntologyStatsResource anyway.

Anyway because I was really in a hurry getting it to work, I reverted my 
working copy back to r1410428 (my latest commit), I can tell it works 
there if it helps. I can get back to it in a few days.

Alessandro


> On Thu, Dec 13, 2012 at 8:41 PM, Alessandro Adamou <ad...@cs.unibo.it>wrote:
>
>> Uhm... something seems to be lost in the move.
>>
>> I loaded an ontology on the dev-iks sandbox and cannot visualize it
>> anymore. Requesting text/html on
>>
>> http://dev.iks-project.eu:**8081/ontonet/http://www.cs.**
>> unibo.it/~adamou/ontologies/**patterns/distribution/A-split/**
>> op_declusage1.owl<http://dev.iks-project.eu:8081/ontonet/http://www.cs.unibo.it/~adamou/ontologies/patterns/distribution/A-split/op_declusage1.owl>
>>
>> gets me a 500 :
>>
>>      java.io.FileNotFoundException: Template html/org/apache/stanbol/**
>> ontologymanager/web/util/**OntologyStatsResource/ontology not found.
>>
>> I still get the expected resource if I request some other mimetype, say
>> text/turtle.
>>
>> But this can spoil apps such as Protege, which gives up if it receives a
>> 500 on an import request with no Accept header.
>>
>> I found this out when re-running some test for my thesis
>>
>> Any clue?
>>
>> Thanks
>>
>> Alessandro
>>
>>
>>
>>
>> On 11/30/12 10:43 AM, Reto Bachmann-Gmür wrote:
>>
>>> Hello
>>>
>>> At Apacheconeu I've been talking with Rupert and others on how static
>>> resources should be handles. We agreed that they should no longer need to
>>> be referenced in the webfragment. I was in favour of just having a fixed
>>> location in the jar but Rupert convinced me that this default location
>>> should be overwritable with a value in the MANIFEST.MF file. In the long
>>> term it should be possible to have file-backed resources at any location
>>> in
>>> the URI space but as a first step only the architecture for the resources
>>> below "/static/" shall be changed.
>>>
>>> E.g:
>>>
>>> MANIFEST.MF
>>> Stanbol-Static: /META-INF/stanbol-static
>>>
>>> The jar contains
>>>
>>> /META-INF/stanbol-static/**static/hello.txt
>>>
>>> Stanbol will serve that file at
>>>
>>> http://<host>/static/hello.txt
>>>
>>> if the jar contains
>>>
>>> /META-INF/stanbol-static/**hello.txt
>>>
>>> this will for now generate a warning that currently the files must be in a
>>> subfolder called "static" to be served (in future it should be served at
>>> http://<host>/hello.txt).
>>>
>>> Any thoughts? Any volunteers?
>>>
>>> Cheers,
>>> Reto
>>>
>>>
>> --
>> M.Sc. Alessandro Adamou
>>
>> Alma Mater Studiorum - Università di Bologna
>> Department of Computer Science
>> Mura Anteo Zamboni 7, 40127 Bologna - Italy
>>
>> Semantic Technology Laboratory (STLab)
>> Institute for Cognitive Science and Technology (ISTC)
>> National Research Council (CNR)
>> Via Nomentana 56, 00161 Rome - Italy
>>
>>
>> "I will give you everything, just don't demand anything."
>> (Ettore Petrolini, 1917)
>>
>> Not sent from my iSnobTechDevice
>>
>>


-- 
M.Sc. Alessandro Adamou

Alma Mater Studiorum - Università di Bologna
Department of Computer Science
Mura Anteo Zamboni 7, 40127 Bologna - Italy

Semantic Technology Laboratory (STLab)
Institute for Cognitive Science and Technology (ISTC)
National Research Council (CNR)
Via Nomentana 56, 00161 Rome - Italy


"I will give you everything, just don't demand anything."
(Ettore Petrolini, 1917)

Not sent from my iSnobTechDevice


Re: "Static" resources

Posted by Reto Bachmann-Gmür <re...@apache.org>.
Hi Alessandro

So this is unrelated to the static resources. The templates got moved
around independently and before the static resources. Apparently
ontology.ftl didn't make it to the right place. I see 3 templates by that
name:

./ontologymanager/web/src/main/resources/templates/html/org/apache/stanbol/ontologymanager/web/resources/ScopeResource/ontology.ftl
./ontologymanager/web/src/main/resources/templates/html/org/apache/stanbol/ontologymanager/web/resources/OntoNetRootResource/ontology.ftl
./ontologymanager/web/src/main/resources/templates/html/org/apache/stanbol/ontologymanager/web/resources/SessionResource/ontology.ftl


is any of these to be used for the resource served by the the resource
class OntologyStatsResource ?

Cheers,
Reto

On Thu, Dec 13, 2012 at 8:41 PM, Alessandro Adamou <ad...@cs.unibo.it>wrote:

> Uhm... something seems to be lost in the move.
>
> I loaded an ontology on the dev-iks sandbox and cannot visualize it
> anymore. Requesting text/html on
>
> http://dev.iks-project.eu:**8081/ontonet/http://www.cs.**
> unibo.it/~adamou/ontologies/**patterns/distribution/A-split/**
> op_declusage1.owl<http://dev.iks-project.eu:8081/ontonet/http://www.cs.unibo.it/~adamou/ontologies/patterns/distribution/A-split/op_declusage1.owl>
>
> gets me a 500 :
>
>     java.io.FileNotFoundException: Template html/org/apache/stanbol/**
> ontologymanager/web/util/**OntologyStatsResource/ontology not found.
>
> I still get the expected resource if I request some other mimetype, say
> text/turtle.
>
> But this can spoil apps such as Protege, which gives up if it receives a
> 500 on an import request with no Accept header.
>
> I found this out when re-running some test for my thesis
>
> Any clue?
>
> Thanks
>
> Alessandro
>
>
>
>
> On 11/30/12 10:43 AM, Reto Bachmann-Gmür wrote:
>
>> Hello
>>
>> At Apacheconeu I've been talking with Rupert and others on how static
>> resources should be handles. We agreed that they should no longer need to
>> be referenced in the webfragment. I was in favour of just having a fixed
>> location in the jar but Rupert convinced me that this default location
>> should be overwritable with a value in the MANIFEST.MF file. In the long
>> term it should be possible to have file-backed resources at any location
>> in
>> the URI space but as a first step only the architecture for the resources
>> below "/static/" shall be changed.
>>
>> E.g:
>>
>> MANIFEST.MF
>> Stanbol-Static: /META-INF/stanbol-static
>>
>> The jar contains
>>
>> /META-INF/stanbol-static/**static/hello.txt
>>
>> Stanbol will serve that file at
>>
>> http://<host>/static/hello.txt
>>
>> if the jar contains
>>
>> /META-INF/stanbol-static/**hello.txt
>>
>> this will for now generate a warning that currently the files must be in a
>> subfolder called "static" to be served (in future it should be served at
>> http://<host>/hello.txt).
>>
>> Any thoughts? Any volunteers?
>>
>> Cheers,
>> Reto
>>
>>
>
> --
> M.Sc. Alessandro Adamou
>
> Alma Mater Studiorum - Università di Bologna
> Department of Computer Science
> Mura Anteo Zamboni 7, 40127 Bologna - Italy
>
> Semantic Technology Laboratory (STLab)
> Institute for Cognitive Science and Technology (ISTC)
> National Research Council (CNR)
> Via Nomentana 56, 00161 Rome - Italy
>
>
> "I will give you everything, just don't demand anything."
> (Ettore Petrolini, 1917)
>
> Not sent from my iSnobTechDevice
>
>

Re: "Static" resources

Posted by Alessandro Adamou <ad...@cs.unibo.it>.
Uhm... something seems to be lost in the move.

I loaded an ontology on the dev-iks sandbox and cannot visualize it 
anymore. Requesting text/html on

http://dev.iks-project.eu:8081/ontonet/http://www.cs.unibo.it/~adamou/ontologies/patterns/distribution/A-split/op_declusage1.owl

gets me a 500 :

     java.io.FileNotFoundException: Template 
html/org/apache/stanbol/ontologymanager/web/util/OntologyStatsResource/ontology 
not found.

I still get the expected resource if I request some other mimetype, say 
text/turtle.

But this can spoil apps such as Protege, which gives up if it receives a 
500 on an import request with no Accept header.

I found this out when re-running some test for my thesis

Any clue?

Thanks

Alessandro



On 11/30/12 10:43 AM, Reto Bachmann-Gmür wrote:
> Hello
>
> At Apacheconeu I've been talking with Rupert and others on how static
> resources should be handles. We agreed that they should no longer need to
> be referenced in the webfragment. I was in favour of just having a fixed
> location in the jar but Rupert convinced me that this default location
> should be overwritable with a value in the MANIFEST.MF file. In the long
> term it should be possible to have file-backed resources at any location in
> the URI space but as a first step only the architecture for the resources
> below "/static/" shall be changed.
>
> E.g:
>
> MANIFEST.MF
> Stanbol-Static: /META-INF/stanbol-static
>
> The jar contains
>
> /META-INF/stanbol-static/static/hello.txt
>
> Stanbol will serve that file at
>
> http://<host>/static/hello.txt
>
> if the jar contains
>
> /META-INF/stanbol-static/hello.txt
>
> this will for now generate a warning that currently the files must be in a
> subfolder called "static" to be served (in future it should be served at
> http://<host>/hello.txt).
>
> Any thoughts? Any volunteers?
>
> Cheers,
> Reto
>


-- 
M.Sc. Alessandro Adamou

Alma Mater Studiorum - Università di Bologna
Department of Computer Science
Mura Anteo Zamboni 7, 40127 Bologna - Italy

Semantic Technology Laboratory (STLab)
Institute for Cognitive Science and Technology (ISTC)
National Research Council (CNR)
Via Nomentana 56, 00161 Rome - Italy


"I will give you everything, just don't demand anything."
(Ettore Petrolini, 1917)

Not sent from my iSnobTechDevice


Re: "Static" resources

Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi,

On Fri, Nov 30, 2012 at 10:43 AM, Reto Bachmann-Gmür <re...@apache.org> wrote:
> ...In the long
> term it should be possible to have file-backed resources at any location in
> the URI space but as a first step only the architecture for the resources
> below "/static/" shall be changed...

Sling handles this by allowing static resources provided by bundles to
be mapped to a different location in the URI space, see
http://sling.apache.org/site/bundle-resources-extensionsbundleresource.html

For example:
Sling-Bundle-Resources: /somepath/inthe/resourcetree;path:=/path/inthe/bundle

-Bertrand

Re: "Static" resources

Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi (back to list, I assume that was the intention),

On Fri, Nov 30, 2012 at 2:10 PM, Reto Bachmann-Gmür <re...@apache.org> wrote:
> On Nov 30, 2012 1:54 PM, "Bertrand Delacretaz" <bd...@apache.org>
> wrote:
>>...I wouldn't blindly expose
>> everything that's under /resources, either use a stanbol-specific name
>> or a bundle header, to avoid surprises.
>
> It's META-INF/resources so its unlikely you choose this as alocation for
> your private key and if that's the standard introduced by servlet 3.0 spec I
> wouldn't why stanbol should be more restrictive. I'd suggest to just add
> support for this ans expose this dir for all bundles (but not for jars
> netsted in bundles)....

Fine with me - it's not me who cares much about Stanbol security anyway ;-)

-Bertrand

Re: "Static" resources

Posted by Bertrand Delacretaz <bd...@apache.org>.
On Fri, Nov 30, 2012 at 12:14 PM, Sergio Fernández
<se...@salzburgresearch.at> wrote:
> ...With any Servlet >= 3.0 compatible container, anything in a
> META-INF/resources directory in a JAR in WEB-INF/lib is automatically
> exposed as a static resource.
>
> Not sure how this could be applied in the current setup of Stanbol...

You could do this pretty easily with a BundleListener that gets those
resources when a bundle appears - but I wouldn't blindly expose
everything that's under /resources, either use a stanbol-specific name
or a bundle header, to avoid surprises.

-Bertrand

Re: "Static" resources

Posted by Sergio Fernández <se...@salzburgresearch.at>.
Hi,

my two cents just in case you are not aware of this feature:

With any Servlet >= 3.0 compatible container, anything in a 
META-INF/resources directory in a JAR in WEB-INF/lib is automatically 
exposed as a static resource.

Not sure how this could be applied in the current setup of Stanbol. But 
if this also works somehow in OSGi, definitely a pretty nice way to 
solve this issue.

Best,
Sergio


On 30/11/12 10:43, Reto Bachmann-Gmür wrote:
> Hello
>
> At Apacheconeu I've been talking with Rupert and others on how static
> resources should be handles. We agreed that they should no longer need to
> be referenced in the webfragment. I was in favour of just having a fixed
> location in the jar but Rupert convinced me that this default location
> should be overwritable with a value in the MANIFEST.MF file. In the long
> term it should be possible to have file-backed resources at any location in
> the URI space but as a first step only the architecture for the resources
> below "/static/" shall be changed.
>
> E.g:
>
> MANIFEST.MF
> Stanbol-Static: /META-INF/stanbol-static
>
> The jar contains
>
> /META-INF/stanbol-static/static/hello.txt
>
> Stanbol will serve that file at
>
> http://<host>/static/hello.txt
>
> if the jar contains
>
> /META-INF/stanbol-static/hello.txt
>
> this will for now generate a warning that currently the files must be in a
> subfolder called "static" to be served (in future it should be served at
> http://<host>/hello.txt).
>
> Any thoughts? Any volunteers?
>
> Cheers,
> Reto
>

-- 
Sergio Fernández
Salzburg Research
+43 662 2288 318
Jakob-Haringer Strasse 5/II
A-5020 Salzburg (Austria)
http://www.salzburgresearch.at