Hi Sanjaya,

when you get a chance could you write a KB entry on the topic?

--Srinath

On Wed, Oct 20, 2010 at 12:32 PM, Sanjaya Vithanagama <[email protected]> wrote:
>
>
> On Tue, Oct 19, 2010 at 11:50 PM, Sameera Jayasoma <[email protected]> wrote:
>>
>> Hi devs,
>>
>> On Tue, Oct 12, 2010 at 12:20 PM, Sameera Jayasoma <[email protected]>
>> wrote:
>>>
>>>
>>> On Tue, Oct 12, 2010 at 10:30 AM, Sanjaya Vithanagama <[email protected]>
>>> wrote:
>>>>
>>>> Hi All,
>>>>
>>>> In human task implementation we came across a requirement to deploy user
>>>> uploaded custom jsps. We tried to use the webapp management feature in
>>>> carbon. But as the uploaded war files are deployed in a different
>>>> application context, we are unable to include the jsps in Cabon context. We
>>>> need a change in the carbon UI framework to support loading of external jsp
>>>> pages.
>>>>
>>>> Carbon UI bundle's JspServlet class loads jsp files based on the
>>>> resource name [in getResource() method]. Currently it tries to resolve the
>>>> resource bundle using the resource path and then loads the jsp from the
>>>> particular bundle. Sameera suggested that we can have a list of jsp
>>>> providers where they implement a common interface. So if a bundle cannot be
>>>> resolved for a particular jsp page (which is the case for a user uploaded
>>>> jsp), we check whether there are any implementers of this provider
>>>> interface. If there are any, the jsp's URL can be retrieved from that
>>>> provider.
>>>>
>>>> Feedback appreciated on this approach.
>>>
>>> Yeah. At the moment, we load UI resources only from bundles. Here the
>>> idea is to introduce UIResourceProviders concept to our UI framework. The
>>> default UIResourceProvider loads resources from bundles. But others can
>>> write their own providers also. i.e. loading resources from the file system,
>>> registry.
>>>
>>> I will update UI framework to support different UIResourceProviders
>>> Others can register their UIResourceProviders as OSGi services.
>>
>> This facility is now available in the Carbon UI framework. If you want to
>> plug a different UI resource provider, please implement the following
>> interface and registers an instance of your implementation as an OSGi
>> service. When you register the OSGi service, use the fully qualified class
>> name of this interface as the key.
>
> I tested this with a simple class which implemented UIResourceProvider and
> it worked. Thank you Sameera.
>
>>
>> package org.wso2.carbon.ui.util;
>>
>> import java.net.URL;
>> import java.util.Set;
>>
>> /**
>>  * Defines a set of methos to load UI resources and resource paths from
>> resource providers such as OSGi Bundles,
>>  * registry, file system, etc.
>>  */
>> public interface UIResourceProvider {
>>
>>     /**
>>      * Returns a URL to the resource that is mapped to a specified path.
>> The path must begin with a "/" and is
>>      * interpreted as relative to the current context root.
>>      *
>>      * This method returns null  if no resource is mapped to the pathname.
>>      *
>>      * @param path a String specifying the path to the resource
>>      * @return the resource located at the named path, or null if there is
>> no resource at that path
>>      */
>>     public URL getUIResource(String path);
>>
>>     /**
>>      * Returns a directory-like listing of all the paths to resources
>> within the web application whose longest sub-path
>>      * matches the supplied path argument. Paths indicating subdirectory
>> paths end with a '/'. The returned paths are
>>      * all relative to the root of resource provider and have a leading
>> '/'. For example, for a resource provider
>>      * containing
>>      *
>>      * /welcome.html
>>      * /WEB_INF
>>      * /WEB-INF/web.xml
>>      * /WEB-INF/tiles
>>      * /WEB-INF/tiles/main_defs.xml
>>      *
>>      * getResourcePaths("/") returns {"/welcome.html", "/WEB_INF"}.
>>      * getResourcePaths("/WEB_INF/") returns {"/WEB-INF/web.xml",
>> "/WEB-INF/tiles/"}.
>>      * getResourcePaths("/WEB-INF/tiles/") returns
>> {"/WEB-INF/tiles/main_defs.xml"}.
>>      *
>>      * @param path partial path used to match the resources, which must
>> start with a /
>>      * @return a Set containing the directory listing, or null if there
>> are no resources whose path begins with the
>>      *          supplied path.
>>      */
>>     public Set<String> getUIResourcePaths(String path);
>> }
>>
>>
>> Thanks
>> Sameera
>>
>>>
>>> WDYT?
>>>
>>> Thanks
>>> Sameera
>>>>
>>>> Regards,
>>>> SanjayaV.
>>>>
>>>> _______________________________________________
>>>> Carbon-dev mailing list
>>>> [email protected]
>>>> https://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
>>>>
>>>
>>>
>>>
>>> --
>>> Sameera Jayasoma
>>> Technical Lead and Product Manager, WSO2 Carbon
>>>
>>> WSO2, Inc. (http://wso2.com)
>>> email: [email protected]
>>> blog: http://tech.jayasoma.org
>>>
>>> Lean . Enterprise . Middleware
>>
>>
>>
>> --
>> Sameera Jayasoma
>> Technical Lead and Product Manager, WSO2 Carbon
>>
>> WSO2, Inc. (http://wso2.com)
>> email: [email protected]
>> blog: http://tech.jayasoma.org
>>
>> Lean . Enterprise . Middleware
>>
>> _______________________________________________
>> Carbon-dev mailing list
>> [email protected]
>> https://wso2.org/cgi-bin/mailman/listinfo/carbon-dev
>>
>
>
> _______________________________________________
> Carbon-dev mailing list
> [email protected]
> https://wso2.org/cgi-bin/mailman/listinfo/carbon-dev
>
>



-- 
============================
Srinath Perera, Ph.D.
  Senior Software Architect, WSO2 Inc.
  Visiting Lecturer, University of Moratuwa
  Member, Apache Software Foundation
  Member, Lanka Software Foundation
  Blog: http://srinathsview.blogspot.com/

_______________________________________________
Carbon-dev mailing list
[email protected]
https://wso2.org/cgi-bin/mailman/listinfo/carbon-dev

Reply via email to