3 Replies Latest reply on Jul 13, 2007 9:50 AM by cpage

    how to get LayoutService in a external webapp (not portlet)

      hi,

      i have my own theme for my portlet.
      this theme is packaged in a webapp. (i override the tag region and make custom tag)

      i would like to get the LayoutService in this web app, but i don't know how to retrieve it.
      i know that it's possible to inject services into portlet context with jboss-portlet.xml but how to achieve that with a simple web app ?

      i tried:

      [...]new initialContext.lookup("java:/portal/LayoutService")
      without succes, i can't see the mbean LayoutService in the jndi view.

      i also tried to get the mbean with the platformMBeanServer, he find the bean with its name but i can't retrieve the instance.


      i'm sure there is an easy way to do this but i don't find it :D

      thanks for help
      regards

        • 1. Re: how to get LayoutService in a external webapp (not portl
          theute

          I'm curous, why do you need to access the LayoutService in your layout webapp ?

          It's supposed to manage your layouts, but your layout shouldn't need to access it.

          • 2. Re: how to get LayoutService in a external webapp (not portl

            i have one generic jsp for all of my layouts. (to make easiest the maintenability)

            so, instead of something like that in many jsp

            <p:region regionName='left' regionID='regionA'/>
            <p:region regionName='center' regionID='regionB'/>
            ....
            


            i have a custom tag who generate the good tags p:region :
            <cp:myownregionTag>


            public class MyOwnRegionTagHandler extends RegionTagHandler{
            ...
            for each regions ....
            {
            setRegionID(layoutName + "-" + region.getId());
            setRegionName(region.getId());
            super.doTag();
            }

            i get the list of the regions from the pageResult
            but page.getRegions don't get the empty regions
            PageContext app = (PageContext) getJspContext();
            HttpServletRequest request = (HttpServletRequest) app.getRequest();
            PageResult page = (PageResult) request.getAttribute(LayoutConstants.ATTR_PAGE);
            
            String layoutName = page.getProperty("layout.id");


            most of the times, this works well because i don't have empty regions.
            but in the dashboard, users could move portlets and make empty regions and when they reconnect, they can't move back there portlets because region is no longer in the page layout.

            • 3. Re: how to get LayoutService in a external webapp (not portl

              ok, temporarelly, i register the layoutservice with jndi to get the service outside portal or portlet context.

              I will look at a better way later ...

              regards