[ 
https://issues.apache.org/jira/browse/STANBOL-352?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13128914#comment-13128914
 ] 

Reto Bachmann-Gmür commented on STANBOL-352:
--------------------------------------------

The root resources I have looked at were all thread-safe insofar as the 
resource methods do not modify the state of the instance, so here using a 
singleton actually has a positive impact on performance. Do you have example 
for root-resource classes you believe would become more complex?

As for the separation of the html ui I think there is one design issue that in 
stanbol often the resource method cares about content negotiation, imho the 
resource method should be be agnostic on how the entity is serialized, this 
should be the business of the MessageBodyWriter. It is not possible (according 
to the jax-rs spec) for two classes to handle different verbs for the same 
uri-path. 

Inheritance works with the jax-rs annotation so having subclasses providing 
freemarker based UI would be a solution. But I think the best solution  would 
be to make the freemarker support independent on jersey jax-rs implementation, 
we can use classes (like MessageBodyWriters) from jersey as long as they run on 
any spec compliant jax-rs implementation.
                
> make stanbol web services (root resource classes) more portable
> ---------------------------------------------------------------
>
>                 Key: STANBOL-352
>                 URL: https://issues.apache.org/jira/browse/STANBOL-352
>             Project: Stanbol
>          Issue Type: Improvement
>            Reporter: Reto Bachmann-Gmür
>
> Despite using the jax-rs (jsr 311) standard stanbol web components aren't 
> very portable. The components depend on jersey mostly for producing html 
> representation (using freemarker) furthermore they user the ServletContext to 
> access osgi services (while this should work with other servlet based jax-rs 
> implementation the standard osgi/osgi-ds mechanism should be used). There are 
> also some apparent jersey dependencies that in fact aren't, for instance 
> org.apache.stanbol.entityhub.jersey.utils.JerseyUtils doesn't depend on 
> jersey.
> To improve portability I suggest to:
> - let all root resources be osgi-ds components and have their dependencies 
> injected
> And either:
> - extract Viewable and the respective MessageBodyWriter from Jersey to a 
> separate bundle so that they can be used on any compliant jax-rs 
> implementation
> - separate rest interfaces that do not need rendering from the ui produced 
> using freemarker. This would allow to at least run the REST-endpoint for 
> machines on other platform.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to