You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Felix Meschberger (JIRA)" <ji...@apache.org> on 2009/06/10 08:19:07 UTC

[jira] Created: (FELIX-1211) How to provide resources like CSS or JavaScript files for plugins

How to provide resources like CSS or JavaScript files for plugins
-----------------------------------------------------------------

                 Key: FELIX-1211
                 URL: https://issues.apache.org/jira/browse/FELIX-1211
             Project: Felix
          Issue Type: Sub-task
            Reporter: Felix Meschberger




-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (FELIX-1211) How to provide resources like CSS or JavaScript files for plugins

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1211?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger reassigned FELIX-1211:
----------------------------------------

    Assignee: Felix Meschberger

> How to provide resources like CSS or JavaScript files for plugins
> -----------------------------------------------------------------
>
>                 Key: FELIX-1211
>                 URL: https://issues.apache.org/jira/browse/FELIX-1211
>             Project: Felix
>          Issue Type: Sub-task
>          Components: Web Console
>    Affects Versions: webconsole-1.2.10
>            Reporter: Felix Meschberger
>            Assignee: Felix Meschberger
>         Attachments: FELIX-1211-getResource.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (FELIX-1211) How to provide resources like CSS or JavaScript files for plugins

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1211?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger updated FELIX-1211:
-------------------------------------

    Attachment: FELIX-1211-getResource.patch

Untested patch implementing option 2b in the AbstractWebConsolePlugin. This might possible be needed to be refined for FELIX-1043.

> How to provide resources like CSS or JavaScript files for plugins
> -----------------------------------------------------------------
>
>                 Key: FELIX-1211
>                 URL: https://issues.apache.org/jira/browse/FELIX-1211
>             Project: Felix
>          Issue Type: Sub-task
>          Components: Web Console
>    Affects Versions: webconsole-1.2.10
>            Reporter: Felix Meschberger
>         Attachments: FELIX-1211-getResource.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (FELIX-1211) How to provide resources like CSS or JavaScript files for plugins

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-1211?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12725052#action_12725052 ] 

Felix Meschberger commented on FELIX-1211:
------------------------------------------

Thanks for testing will fix this NPE before applying the patch.

> How to provide resources like CSS or JavaScript files for plugins
> -----------------------------------------------------------------
>
>                 Key: FELIX-1211
>                 URL: https://issues.apache.org/jira/browse/FELIX-1211
>             Project: Felix
>          Issue Type: Sub-task
>          Components: Web Console
>    Affects Versions: webconsole-1.2.10
>            Reporter: Felix Meschberger
>            Assignee: Felix Meschberger
>         Attachments: FELIX-1211-getResource.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (FELIX-1211) How to provide resources like CSS or JavaScript files for plugins

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-1211?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12717951#action_12717951 ] 

Felix Meschberger commented on FELIX-1211:
------------------------------------------

The Web Console bundle itself registers a path with the OSGi HttpService as resources. This makes it easy to supply resources, since the Web Console just has to provide an URL to the resource, while the HttpService itself spools the resource with the correct response headers to the client.

For plugins various options exist:

(1) Plugins register resources with HttpService
I am not sure, whether it is a good idea to create dependencies on the HttpService for web console plugins

(2) The plugins spool the resource themselves
This option is implemented by the Apache Sling Commons MIME console plugin in the MimeTypeWebConsolePlugin [1] class. This plugin overwrites the doGet method and checks whether the request is for a "/res/*" resource below the plugins own page.

(2a) Approach (2) could be enhanced by abstracting the spoolResource method into the AbstractWebConsolePlugin and define a new abstract getResource method, which returns an URL to a resource, should the request address an URL. This method would be implemented in the AbstractWebConsolePlugin extension

(2b) The drawback of approach (2a) is, that it requires a plugin to extend the AbstractWebConsolePlugin to provide resources. Going in the direction of the Declarative Services specification, the web console looks for a "URL getResource(String)" method in the plugin class (and its ancestor classes) to call to resolve resources. This would allow for automatic support for resources. The method must be public or protected, but may be private if it is declared in the plugin class itself.

(3) Plugin lists resource paths in Manifest
The bundle manifest of the plugin could provide a manifest header listing resource-paths. The Web Console would then use the providing bundle to access resources. The drawback of this approach is, that it detaches the plugin from the resource it needs.


In light of FELIX-1043 (not requiring to extend AbstractWebConsolePlugin to extend the web console) I prefer approach 2b.


[1] https://svn.apache.org/repos/asf/incubator/sling/trunk/bundles/commons/mime/src/main/java/org/apache/sling/commons/mime/internal/MimeTypeWebConsolePlugin.java

> How to provide resources like CSS or JavaScript files for plugins
> -----------------------------------------------------------------
>
>                 Key: FELIX-1211
>                 URL: https://issues.apache.org/jira/browse/FELIX-1211
>             Project: Felix
>          Issue Type: Sub-task
>            Reporter: Felix Meschberger
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (FELIX-1211) How to provide resources like CSS or JavaScript files for plugins

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1211?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger updated FELIX-1211:
-------------------------------------

          Component/s: Web Console
    Affects Version/s: webconsole-1.2.10

> How to provide resources like CSS or JavaScript files for plugins
> -----------------------------------------------------------------
>
>                 Key: FELIX-1211
>                 URL: https://issues.apache.org/jira/browse/FELIX-1211
>             Project: Felix
>          Issue Type: Sub-task
>          Components: Web Console
>    Affects Versions: webconsole-1.2.10
>            Reporter: Felix Meschberger
>         Attachments: FELIX-1211-getResource.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (FELIX-1211) How to provide resources like CSS or JavaScript files for plugins

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-1211?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12725072#action_12725072 ] 

Felix Meschberger commented on FELIX-1211:
------------------------------------------

Applied slightly modified patch in Rev. 789246.

The modifications are :

  * Prevent an NPE from being thrown as indicated by Tim Moloney (Thanks)
  * Add support for the WebConsolePluginAdapter to have the wrapped plugin to provide resources

> How to provide resources like CSS or JavaScript files for plugins
> -----------------------------------------------------------------
>
>                 Key: FELIX-1211
>                 URL: https://issues.apache.org/jira/browse/FELIX-1211
>             Project: Felix
>          Issue Type: Sub-task
>          Components: Web Console
>    Affects Versions: webconsole-1.2.10
>            Reporter: Felix Meschberger
>            Assignee: Felix Meschberger
>         Attachments: FELIX-1211-getResource.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (FELIX-1211) How to provide resources like CSS or JavaScript files for plugins

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1211?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger closed FELIX-1211.
------------------------------------

       Resolution: Fixed
    Fix Version/s: webconsole-1.2.12

Fixed a small glitch in Rev. 789288.

Previously the getResource method has been looked up when the AbstractWebConsolePlugin class has been initialized. This causes the method to no be found for wrapped plugins because the field value returned by the getResourceProvider method is not set at the time of the initialization of the AbstractWebConsolePlugin instance.

Apart from this minor glitch, this mechanis works and this issue can be closed.

> How to provide resources like CSS or JavaScript files for plugins
> -----------------------------------------------------------------
>
>                 Key: FELIX-1211
>                 URL: https://issues.apache.org/jira/browse/FELIX-1211
>             Project: Felix
>          Issue Type: Sub-task
>          Components: Web Console
>    Affects Versions: webconsole-1.2.10
>            Reporter: Felix Meschberger
>            Assignee: Felix Meschberger
>             Fix For: webconsole-1.2.12
>
>         Attachments: FELIX-1211-getResource.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (FELIX-1211) How to provide resources like CSS or JavaScript files for plugins

Posted by "Tim Moloney (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-1211?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12723633#action_12723633 ] 

Tim Moloney commented on FELIX-1211:
------------------------------------

The patch works well.

However, if the resource is not found, there is a NPE when attempting to execute ins.close() in the finally clause of spoolResource().


> How to provide resources like CSS or JavaScript files for plugins
> -----------------------------------------------------------------
>
>                 Key: FELIX-1211
>                 URL: https://issues.apache.org/jira/browse/FELIX-1211
>             Project: Felix
>          Issue Type: Sub-task
>          Components: Web Console
>    Affects Versions: webconsole-1.2.10
>            Reporter: Felix Meschberger
>         Attachments: FELIX-1211-getResource.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.