Hi,

what about adding a new configuration property like WAR_ALIAS or
DEPLOY_ALIAS that is empty by default. This property can be concatenated at
the beginning of the resource path in BaseStanbolResource. In a WAR
environment this variable needs to be configured to be the WAR name where
Stanbol is deployed.

Any other ideas?

Best,
 - Fabian

Am Mittwoch, 19. Oktober 2011 schrieb Suat Gonul :

> Hi,
>
> I have a problem with the location of deployed static resources. I am
> trying the deploy the WAR file, generated after building the full-war
> launcher, on the Tomcat6. With default configurations of JerseyEndpoint
> static (ALIAS_PROPERTY=/, STATIC_RESOURCES_URL_ROOT_**PROPERTY=/static)
> and having 'stanbol' as war name, static resources are deployed under
> http://localhost:8080/stanbol/ e.g http://localhost:8080/stanbol/**
> static/home/style/stanbol.css<http://localhost:8080/stanbol/static/home/style/stanbol.css>.
> But in this case, this resource is searched under
> http://localhost:8080/static/**home/style/stanbol.css<http://localhost:8080/static/home/style/stanbol.css>as
>  its href is /static/home/style/stanbol.
> **css.
>
> When I update JerseyEndpoint configuration such that ALIAS_PROPERTY=/ and
> STATIC_RESOURCES_URL_ROOT_**PROPERTY=/stanbol/static, this time the
> resource is deployed under http://localhost:8080/stanbol/**
> stanbol/static/home/style/**stanbol.css<http://localhost:8080/stanbol/stanbol/static/home/style/stanbol.css>but
>  it is searched under
> http://localhost:8080/stanbol/**static/home/style/stanbol.css<http://localhost:8080/stanbol/static/home/style/stanbol.css>
> .
>
> As far as I understand, there won't be any problem if hrefs of static
> resources wouldn't start with a /. However, aliases should be started with a
> / when registering resources to http service.
>
> Therefore, the only solution we produced is to attach ALIAS_PROPERTY at the
> beginning of the resource aliases while registering and returning full URL
> of static resources in the BaseStanbolResource as previously done.
>
> Do you have any other suggestion to solve this problem in a better way?
>
> Thanks in advance,
> Suat
>
> On 10/18/2011 04:03 PM, Fabian Christ wrote:
>
>> Hi,
>>
>> I would like to vote -1 for this commit because this change seems to be
>> the
>> wrong solution and it breaks Stanbol instances which run on another alias
>> for static resources.
>>
>> The addressed problem is that the method getStaticRootURL returns by
>> default
>> a wrong value when Stanbol is deployed in a WAR context. But changing the
>> return value by adding the base URI string at the beginning is not
>> correct.
>> The alias and static root resource alias (STATIC_RESOURCES_ROOT_URL) of
>> Stanbol should be configured correctly when running in a WAR context. Then
>> this problem would not occur.
>>
>> I'm not sure about the procedure now. I think as soon as a committer votes
>> -1 for a commit the commit has to be reverted in first place. Should I do
>> that?
>>
>> Best,
>>  - Fabian
>>
>> Am Montag, 17. Oktober 2011 schrieb :
>>
>>  Author: suat
>>> Date: Mon Oct 17 11:17:26 2011
>>> New Revision: 1185105
>>>
>>> URL: 
>>> http://svn.apache.org/viewvc?**rev=1185105&view=rev<http://svn.apache.org/viewvc?rev=1185105&view=rev>
>>> Log:
>>> STANBOL-348:
>>> -Updated getStaticRootURL so that it returns the full URL of static
>>> resources. This change is done as static resources are deployed under the
>>> context of war file (e.g under
>>> http://localhost:8080/stanbol/**static/home/style/stanbol.css<http://localhost:8080/stanbol/static/home/style/stanbol.css>instead
>>>  of
>>> http://localhost:8090/static/**home/style/stanbol.css<http://localhost:8090/static/home/style/stanbol.css>
>>> ).
>>>
>>> Modified:
>>>
>>>  incubator/stanbol/trunk/**commons/web/base/src/main/**
>>> java/org/apache/stanbol/**commons/web/base/resource/**
>>> BaseStanbolResource.java
>>>
>>> Modified:
>>> incubator/stanbol/trunk/**commons/web/base/src/main/**
>>> java/org/apache/stanbol/**commons/web/base/resource/**
>>> BaseStanbolResource.java
>>> URL:
>>> http://svn.apache.org/viewvc/**incubator/stanbol/trunk/**
>>> commons/web/base/src/main/**java/org/apache/stanbol/**
>>> commons/web/base/resource/**BaseStanbolResource.java?rev=**
>>> 1185105&r1=1185104&r2=1185105&**view=diff<http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/base/src/main/java/org/apache/stanbol/commons/web/base/resource/BaseStanbolResource.java?rev=1185105&r1=1185104&r2=1185105&view=diff>
>>>
>>> ==============================**==============================**
>>> ==================
>>> ---
>>> incubator/stanbol/trunk/**commons/web/base/src/main/**
>>> java/org/apache/stanbol/**commons/web/base/resource/**
>>> BaseStanbolResource.java
>>> (original)
>>> +++
>>> incubator/stanbol/trunk/**commons/web/base/src/main/**
>>> java/org/apache/stanbol/**commons/web/base/resource/**
>>> BaseStanbolResource.java
>>> Mon Oct 17 11:17:26 2011
>>> @@ -111,7 +111,8 @@ public class BaseStanbolResource {
>>>     }
>>>
>>>     public String getStaticRootUrl() {
>>> -        return (String)
>>> servletContext.getAttribute(**STATIC_RESOURCES_ROOT_URL);
>>> +        String baseURIStr = uriInfo.getBaseUri().toString(**);
>>> +        return baseURIStr.substring(0, baseURIStr.length()-1) + (String)
>>> servletContext.getAttribute(**STATIC_RESOURCES_ROOT_URL);
>>>     }
>>>
>>>     @SuppressWarnings("unchecked")
>>>
>>>
>>>
>>>
>

-- 
Fabian
http://twitter.com/fctwitt

Reply via email to