@ Deprecated @ RequestMapping ( value = "/layoutDoc" , method = RequestMethod . GET ) public ModelAndView getRESTController ( HttpServletRequest request , @ RequestParam ( value = "tab" , required = false ) String tab ) { final IPerson person = personManager . getPerson ( request ) ; List < LayoutPortlet > portlets = new ArrayList < LayoutPortlet > ( ) ; try { final IUserInstance ui = userInstanceManager . getUserInstance ( request ) ; final IUserPreferencesManager upm = ui . getPreferencesManager ( ) ; final IUserProfile profile = upm . getUserProfile ( ) ; final DistributedUserLayout userLayout = userLayoutStore . getUserLayout ( person , profile ) ; Document document = userLayout . getLayout ( ) ; NodeList portletNodes = null ; if ( tab != null ) { NodeList folders = document . getElementsByTagName ( "folder" ) ; for ( int i = 0 ; i < folders . getLength ( ) ; i ++ ) { Node node = folders . item ( i ) ; if ( tab . equalsIgnoreCase ( node . getAttributes ( ) . getNamedItem ( "name" ) . getNodeValue ( ) ) ) { TabListOfNodes tabNodes = new TabListOfNodes ( ) ; tabNodes . addAllChannels ( node . getChildNodes ( ) ) ; portletNodes = tabNodes ; break ; } } } else { portletNodes = document . getElementsByTagName ( "channel" ) ; } for ( int i = 0 ; i < portletNodes . getLength ( ) ; i ++ ) { try { NamedNodeMap attributes = portletNodes . item ( i ) . getAttributes ( ) ; IPortletDefinition def = portletDao . getPortletDefinitionByFname ( attributes . getNamedItem ( "fname" ) . getNodeValue ( ) ) ; LayoutPortlet portlet = new LayoutPortlet ( def ) ; portlet . setNodeId ( attributes . getNamedItem ( "ID" ) . getNodeValue ( ) ) ; // get alt max URL String alternativeMaximizedLink = def . getAlternativeMaximizedLink ( ) ; if ( alternativeMaximizedLink != null ) { portlet . setUrl ( alternativeMaximizedLink ) ; portlet . setAltMaxUrl ( true ) ; } else { // get the maximized URL for this portlet final IPortalUrlBuilder portalUrlBuilder = urlProvider . getPortalUrlBuilderByLayoutNode ( request , attributes . getNamedItem ( "ID" ) . getNodeValue ( ) , UrlType . RENDER ) ; final IPortletWindowId targetPortletWindowId = portalUrlBuilder . getTargetPortletWindowId ( ) ; if ( targetPortletWindowId != null ) { final IPortletUrlBuilder portletUrlBuilder = portalUrlBuilder . getPortletUrlBuilder ( targetPortletWindowId ) ; portletUrlBuilder . setWindowState ( WindowState . MAXIMIZED ) ; } portlet . setUrl ( portalUrlBuilder . getUrlString ( ) ) ; portlet . setAltMaxUrl ( false ) ; } portlets . add ( portlet ) ; } catch ( Exception e ) { log . warn ( "Exception construction JSON representation of mobile portlet" , e ) ; } } ModelAndView mv = new ModelAndView ( ) ; mv . addObject ( "layout" , portlets ) ; mv . setViewName ( "json" ) ; return mv ; } catch ( Exception e ) { log . error ( "Error retrieving user layout document" , e ) ; } return null ; }
A REST call to get a json feed of the current users layout . Intent was to provide a layout document without per - tab information for mobile device rendering .