Jetspeed REST API Overview

The Jetspeed REST API is an RESTful web services for clients (including AJAX clients) for making HTTP requests to Jetspeed services.

The URLs for the Jetspeed REST API starts with the following:

http://hostname/contextname/services/

Typical use cases:

  • Page Customization and Portlet Placement - To move, copy, add, or remove portlets on a page
  • Layout Selection - change the layout (number of rows and columns, size of columns) on a page
  • Theme and Decorator Selection - change the page theme and portlet decorators on a page.
  • Portlet Selectors - provide a select-list of portlets to the end user
  • Security Configuration - configure the security constraints or policy on a resource (page, portlet, folder, link, fragment), or portal wide
  • Menu Configuration - create and edit menus for the Jetspeed Site
  • General Administration - all use cases for general administration have not yet been explored.

Secured Access

All Jetspeed REST API requests run through a standard Jetspeed Pipeline request. This means that you can configure your web request with the usual array of Jetspeed components. The default REST services pipeline secures access to all requests. Each service may have its own security constraints. All requests made to a page will use the declarative security constraints configured for that page. REST request actions are enforced under edit or view mode, depending on the nature of the action.

Flexible Message Media Types for Message Producers and Consumers

All Jetspeed REST API support dual Message Media Types for Message producers and consumers: 'application/json' and 'application/xml' with help of the underlying Apache CXF JAX-RS Server. Typically, web client applications can use JSON marshaling/unmarshaling by adding '_type=json' parameter in the request URLs. If the parameter is '_type=xml', then the messages are marshaled/unmarshaled as XML messages. If the '_type' parameter is not set by the client, the Jetspeed REST API read the 'Accept' HTTP request header to decide which is proper for the web client. Please see the documents of Apache CXF for details.

WADL (Web Application Description Language) Support

You can retrieve WADL description for each service simply by adding '?_wadl' query string. Apache CXF JAX-RS server, on which Jetspeed REST API depends, generates the WADL description for the service automatically. For example, you can request the following URL for 'Get Portlet Application' service of 'Portlet Registry Service'.

GET http://localhost:8080/jetspeed/services/portletregistry/application/demo/?_wadl

Portlet Registry Service

The Portlet Registry Service is a HTTP request-based API, communicating over a simple REST (Representational State Transfer) protocol, providing information and management functionality on portlet applications and portlet definitions. This service is accessed over HTTP via the "/services/portletregistry" path on the portal URL:

http://hostname/contextname/services/portletregistry/

Get Portlet Applications

Entry path /application/
Description Get portlet applications based on the path parameter or search query parameter.
HTTP Method GET
Parameters
Type Name Required Default value Example value Description
PATH No /demo/ Portlet application name. If the portlet application name path parameter is not provided, then all portlet applications are retrieved.
QUERY query No demo Search query string to filter the results. If you want to use multiple terms for the search query, you need to separate each teram by ' | '. Because the URI should be encoded, the URI query value can be like 'demo%20%7C%20webcontent' when you try to use query with two terms, 'demo' and 'webcontent'.
QUERY begin No -1 0 The begin index of the page to be selected from the result. If the value is -1, then it chooses the search result from the first index inclusively.
QUERY max No -1 10 The maximum page size to be selected from the result. If the value is -1, then it chooses the search result to the last index inclusively.
REST API examples
GET http://localhost:8080/jetspeed/services/portletregistry/application/demo/?_type=json

GET http://localhost:8080/jetspeed/services/portletregistry/application/?_type=json&query=demo&begin=0&max=10
JSON Response Example
{
  "beginIndex":-1,
  "totalSize":1,
  "applications":[
    {
      "name":"demo",
      "contextPath":"/demo",
      "applicationType":0,
      "defaultNamespace":"",
      "revision":2,
      "checksum":2832348922,
      "displayNames":[
        {
          "value":"Demoportlets",
          "lang":"en",
          "localeString":"en"
        }
      ],
      "descriptions":[
        {
          "value":"Demo Portlets Applications",
          "lang":"en",
          "localeString":"en"
        }
      ],
      "metadata":
        {
          "fields":[
            {
              "name":"title",
              "value":"Title 1",
              "localeString":"en"
            },
            {
              "name":"title",
              "value":"Eng Title",
              "localeString":"en"
            }
          ]
        },
      "containerRuntimeOptions":[]
    }
  ]
}
XML Response Example
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<data>
  <beginIndex>-1</beginIndex>
  <totalSize>1</totalSize>
  <applications>
    <application>
      <applicationType>0</applicationType>
      <checksum>2832348922</checksum>
      <containerRuntimeOptions/>
      <contextPath>/demo</contextPath>
      <defaultNamespace/>
      <descriptions>
        <description>
          <lang>en</lang>
          <localeString>en</localeString>
          <value>Demo Portlets Applications</value>
        </description>
      </descriptions>
      <displayNames>
        <displayName>
          <lang>en</lang>
          <localeString>en</localeString>
          <value>Demoportlets</value>
        </displayName>
      </displayNames>
      <metadata>
        <fields>
          <field>
            <localeString>en</localeString>
            <name>title</name>
            <value>Title 1</value>
          </field>
          <field>
            <localeString>en</localeString>
            <name>title</name>
            <value>Eng Title</value>
          </field>
        </fields>
      </metadata>
      <name>demo</name>
      <revision>2</revision>
    </application>
  </applications>
</data>

Get Portlet Definitions

Entry path /definition/
Description Get portlet definitions based on the path parameter or query parameters.
HTTP Method GET
Parameters
Type Name Required Default value Example value Description
PATH No /demo/
or
/demo/PickANumberPortlet/
Portlet application name (and possibly followed by portlet definition name). If the portlet application name and portlet definition name path parameters are not provided, then all portlet definitions are retrieved. Also, if the portlet application name is provided but portlet definition name is not provided, then all protlet definitions of the portlet application are retrieved.
QUERY query No admin | management Search query string to filter the results. If you want to use multiple terms for the search query, you need to separate each teram by ' | '. Because the URI should be encoded, the URI query value can be like 'admin%20%7C%20management' when you try to use query with two terms, 'admin' and 'management'.
QUERY begin No -1 0 The begin index of the page to be selected from the result. If the value is -1, then it chooses the search result from the first index inclusively.
QUERY max No -1 10 The maximum page size to be selected from the result. If the value is -1, then it chooses the search result to the last index inclusively.
REST API examples
           
GET http://localhost:8080/jetspeed/services/portletregistry/definition/?_type=json

GET http://localhost:8080/jetspeed/services/portletregistry/definition/?_type=json&begin=0&max=5

GET http://localhost:8080/jetspeed/services/portletregistry/definition/?_type=json&begin=0&max=5&query=admin%20%7C%20management

GET http://localhost:8080/jetspeed/services/portletregistry/definition/demo/?_type=json

GET http://localhost:8080/jetspeed/services/portletregistry/definition/demo/?_type=json&begin=0&max=5

GET http://localhost:8080/jetspeed/services/portletregistry/definition/demo/PickANumberPortlet/?_type=json
JSON Response Example
{
  "beginIndex":-1,
  "totalSize":1,
  "definitions":[
    {
      "uniqueName":"demo::PickANumberPortlet",
      "portletName":"PickANumberPortlet",
      "applicationName":"demo",
      "portletIcon":"applications-games.png",
      "portletInfo":
        {
          "title":"Pick a Number",
          "keywords":"fun,game,pick"
        },
      "displayNames":[
        {
          "value":"Pick a number game",
          "lang":"en",
          "localeString":"en"
        }
      ],
      "descriptions":[
        {
          "value":"This portlet runs the popular 'Pick A Number' guessing game. The goal is to guess, in the least number of guesses, a number between [1..{Range}]",
          "lang":"en",
          "localeString":"en"
        }
      ],
      "supports":[
        {
          "mimeType":"text/html",
          "windowStates":[],
          "portletModes":["view","help","edit","about","edit_defaults","preview","print"]
        }
      ],
      "languages":[
        {
          "localeString":"en",
          "title":"Pick a Number",
          "keywords":"fun,game,pick"
        },
        {
          "localeString":"fr",
          "title":"Pick a Number",
          "keywords":"fun,game,pick"
        },
        {
          "localeString":"ja",
          "title":"数当てゲーム",
          "keywords":"fun,game,pick"
        }
      ],
      "metadata":
        {
          "fields":[
            {
              "name":"title",
              "value":"Pick a Number",
              "localeString":"en"
            },
            {
              "name":"creator",
              "value":"J2 Team",
              "localeString":"en"
            }
          ]
        },
      "containerRuntimeOptions":[],
      "initParams":[
        {
          "paramName":"ViewPage",
          "paramValue":"/WEB-INF/demo/simple/PickANumber.jsp",
          "descriptions":[]
        },
        {
          "paramName":"HelpPage",
          "paramValue":"/WEB-INF/demo/simple/PickANumberHelp.jsp",
          "descriptions":[]
        },
        {
          "paramName":"EditPage",
          "paramValue":"/WEB-INF/demo/simple/PickANumberEdit.jsp",
          "descriptions":[]
        },
        {
          "paramName":"portlet-icon",
          "paramValue":"applications-games.png",
          "descriptions":[]
        }
      ]
    }
  ]
}
XML Response Example
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<data>
  <beginIndex>-1</beginIndex>
  <totalSize>1</totalSize>
  <definitions>
    <definition>
      <applicationName>demo</applicationName>
      <containerRuntimeOptions/>
      <descriptions>
        <description>
          <lang>en</lang>
          <localeString>en</localeString>
          <value>
            This portlet runs the popular 'Pick A Number' guessing game. The goal is to guess, in the least number of guesses, a number between [1..{Range}]
          </value>
        </description>
      </descriptions>
      <displayNames>
        <displayName>
          <lang>en</lang>
          <localeString>en</localeString>
          <value>Pick a number game</value>
        </displayName>
      </displayNames>
      <initParams>
        <initParam>
          <descriptions/>
          <paramName>ViewPage</paramName>
          <paramValue>/WEB-INF/demo/simple/PickANumber.jsp</paramValue>
        </initParam>
        <initParam>
          <descriptions/>
          <paramName>HelpPage</paramName>
          <paramValue>/WEB-INF/demo/simple/PickANumberHelp.jsp</paramValue>
        </initParam>
        <initParam>
          <descriptions/>
          <paramName>EditPage</paramName>
          <paramValue>/WEB-INF/demo/simple/PickANumberEdit.jsp</paramValue>
        </initParam>
        <initParam>
          <descriptions/>
          <paramName>portlet-icon</paramName>
          <paramValue>applications-games.png</paramValue>
        </initParam>
      </initParams>
      <languages>
        <language>
          <keywords>fun,game,pick</keywords>
          <title>Pick a Number</title>
          <localeString>en</localeString>
        </language>
        <language>
          <keywords>fun,game,pick</keywords>
          <title>Pick a Number</title>
          <localeString>fr</localeString>
        </language>
        <language>
          <keywords>fun,game,pick</keywords>
          <title>数当てゲーム</title>
          <localeString>ja</localeString>
        </language>
      </languages>
      <metadata>
        <fields>
          <field>
            <localeString>en</localeString>
            <name>title</name>
            <value>Pick a Number</value>
          </field>
          <field>
            <localeString>en</localeString>
            <name>creator</name>
            <value>J2 Team</value>
          </field>
        </fields>
      </metadata>
      <portletIcon>applications-games.png</portletIcon>
      <portletInfo>
        <keywords>fun,game,pick</keywords>
        <title>Pick a Number</title>
      </portletInfo>
      <portletName>PickANumberPortlet</portletName>
      <supports>
        <support>
          <mimeType>text/html</mimeType>
          <portletModes>
            <portletMode>view</portletMode>
            <portletMode>help</portletMode>
            <portletMode>edit</portletMode>
            <portletMode>about</portletMode>
            <portletMode>edit_defaults</portletMode>
            <portletMode>preview</portletMode>
            <portletMode>print</portletMode>
          </portletModes>
          <windowStates/>
        </support>
      </supports>
      <uniqueName>demo::PickANumberPortlet</uniqueName>
    </definition>
  </definitions>
</data>

Page Layout Service

The Page Layout Service is a HTTP request-based API, communicating over a simple REST (Representational State Transfer) protocol, providing information and management functionality on the layout of the content page and its content fragments. This service is accessed over HTTP via the "/services/pagelayout" path on the portal URL:

http://hostname/contextname/services/pagelayout/

Get Content Page

Entry path /page/
Description Get content page of the current request context.
HTTP Method GET
Parameters
Type Name Required Default value Example value Description
HEADER X-Portal-Path No / /default-page.psml The current portal page path.
HTTP Errors HTTP Error 403 Forbidden when having no VIEW access on the current content page.
REST API examples
GET http://localhost:8080/jetspeed/services/pagelayout/page/?_type=json

With the following request header:
  X-Portal-Path: /jetspeed.psml
JSON Response Example
{
  "name":"default-page.psml",
  "id":"/default-page.psml",
  "path":"/default-page.psml",
  "url":"/default-page.psml",
  "title":"Dashboard",
  "shortTitle":"Dashboard",
  "fragment":
    {
      "name":"jetspeed-layouts::VelocityThreeColumns",
      "properties":{"sizes":"15%,70%,15%"},
      "id":"template-top2",
      "type":"layout",
      "locked":true,
      "fragments":[
        {
          "name":"j2-admin::SpaceNavigator",
          "properties":{"decorator":"clear","y":"80.0","x":"12.0","jsdesktop":"detached=true"},
          "id":"template-top2.jsSpaceNavigator",
          "type":"portlet",
          "locked":true,
          "decorator":"clear"
        },
        {
          "name":"j2-admin::PageNavigator",
          "properties":{"z":"201.0","row":"0","width":"40.0","height":"388.0","column":"0","y":"104.0","x":"1.0"},
          "id":"template-top2.jsPageNavigator",
          "type":"portlet",
          "locked":true
        },
        {
          "name":"jetspeed-layouts::VelocityOneColumn",
          "properties":{"row":"0","column":"1"},
          "id":"template-top2.page-template.dashboard-1000",
          "type":"layout",
          "locked":false,
          "fragments":[
            {
              "name":"j2-admin::LoginPortlet",
              "properties":{"row":"0","column":"0"},
              "id":"template-top2.page-template.dashboard-1000.dashboard-1003",
              "type":"portlet",
              "locked":false
            },
            {
              "name":"j2-admin::LocaleSelector",
              "properties":{"row":"1","column":"0"},
              "id":"template-top2.page-template.dashboard-1000.dashboard-1007",
              "type":"portlet",
              "locked":false
            }
          ]
        },
        {
          "name":"j2-admin::JetspeedToolbox",
          "properties":{"y":"10.0","x":"440.0","jsdesktop":"detached=true"},
          "id":"template-top2.jsToolbox",
          "type":"portlet",
          "locked":true
        }
      ]
    }
  }
XML Response Example
<page>
  <id>/default-page.psml</id>
  <name>default-page.psml</name>
  <path>/default-page.psml</path>
  <shortTitle>Dashboard</shortTitle>
  <title>Dashboard</title>
  <url>/default-page.psml</url>
  <fragment>
    <id>template-top2</id>
    <locked>true</locked>
    <name>jetspeed-layouts::VelocityThreeColumns</name>
    <type>layout</type>
    <properties>
      <entry>
        <key>sizes</key>
        <value>15%,70%,15%</value>
      </entry>
    </properties>
    <fragments>
      <fragment>
        <decorator>clear</decorator>
        <id>template-top2.jsSpaceNavigator</id>
        <locked>true</locked>
        <name>j2-admin::SpaceNavigator</name>
        <type>portlet</type>
        <properties>
          <entry>
            <key>decorator</key>
            <value>clear</value>
          </entry>
          <entry>
            <key>y</key>
            <value>80.0</value>
          </entry>
          <entry>
            <key>x</key>
            <value>12.0</value>
          </entry>
          <entry>
            <key>jsdesktop</key>
            <value>detached=true</value>
          </entry>
        </properties>
      </fragment>
      <fragment>
        <id>template-top2.jsPageNavigator</id>
        <locked>true</locked>
        <name>j2-admin::PageNavigator</name>
        <type>portlet</type>
        <properties>
          <entry>
            <key>z</key>
            <value>201.0</value>
          </entry>
          <entry>
            <key>row</key>
            <value>0</value>
          </entry>
          <entry>
            <key>width</key>
            <value>40.0</value>
          </entry>
          <entry>
            <key>height</key>
            <value>388.0</value>
          </entry>
          <entry>
            <key>column</key>
            <value>0</value>
          </entry>
          <entry>
            <key>y</key>
            <value>104.0</value>
          </entry>
          <entry>
            <key>x</key>
            <value>1.0</value>
          </entry>
        </properties>
      </fragment>
      <fragment>
        <id>template-top2.page-template.dashboard-1000</id>
        <locked>false</locked>
        <name>jetspeed-layouts::VelocityOneColumn</name>
        <type>layout</type>
        <properties>
          <entry>
            <key>row</key>
            <value>0</value>
          </entry>
          <entry>
            <key>column</key>
            <value>1</value>
          </entry>
        </properties>
        <fragments>
          <fragment>
            <id>template-top2.page-template.dashboard-1000.dashboard-1003</id>
            <locked>false</locked>
            <name>j2-admin::LoginPortlet</name>
            <type>portlet</type>
            <properties>
              <entry>
                <key>row</key>
                <value>0</value>
              </entry>
              <entry>
                <key>column</key>
                <value>0</value>
              </entry>
            </properties>
          </fragment>
          <fragment>
            <id>template-top2.page-template.dashboard-1000.dashboard-1007</id>
            <locked>false</locked>
            <name>j2-admin::LocaleSelector</name>
            <type>portlet</type>
            <properties>
              <entry>
                <key>row</key>
                <value>1</value>
              </entry>
              <entry>
                <key>column</key>
                <value>0</value>
              </entry>
            </properties>
          </fragment>
        </fragments>
      </fragment>
      <fragment>
        <id>template-top2.jsToolbox</id>
        <locked>true</locked>
        <name>j2-admin::JetspeedToolbox</name>
        <type>portlet</type>
        <properties>
          <entry>
            <key>y</key>
            <value>10.0</value>
          </entry>
          <entry>
            <key>x</key>
            <value>440.0</value>
          </entry>
          <entry>
            <key>jsdesktop</key>
            <value>detached=true</value>
          </entry>
        </properties>
      </fragment>
    </fragments>
  </fragment>
</page>

Get Content Fragment

Entry path /fragment/
Description Get content fragment based on the fragment ID path parameter.
HTTP Method GET
Parameters
Type Name Required Default value Example value Description
HEADER X-Portal-Path No / /default-page.psml The current portal page path.
PATH Yes /template-top2.page-template.dashboard-1000.dashboard-1003/ The ID of the fragment to retrieve.
HTTP Errors HTTP Error 403 Forbidden when having no VIEW access on the current content page.
REST API examples
GET http://localhost:8080/jetspeed/services/pagelayout/fragment/template-top2.page-template.dashboard-1000.dashboard-1003/?_type=json

With the following request header:
  X-Portal-Path: /jetspeed.psml
JSON Response Example
{
  "name":"j2-admin::LoginPortlet",
  "id":"template-top2.page-template.dashboard-1000.dashboard-1003",
  "type":"portlet",
  "locked":false,
  "properties":{"row":"0","column":"2"}
}
XML Response Example
<fragment>
  <id>template-top2.page-template.dashboard-1000.dashboard-1003</id>
  <locked>false</locked>
  <name>j2-admin::LoginPortlet</name>
  <type>portlet</type>
  <properties>
    <entry>
      <key>row</key>
      <value>0</value>
    </entry>
    <entry>
      <key>column</key>
      <value>2</value>
    </entry>
  </properties>
</fragment>

Add Content Fragment

Entry path /fragment/
Description Add a content fragment to the content page based on the fragment type path parameter and the portlet name path parameter.
HTTP Method POST
Parameters
Type Name Required Default value Example value Description
HEADER X-Portal-Path No / /default-page.psml The current portal page path.
PATH Yes /portlet/demo::PickANumberPortlet/ The fragment type and the portlet name to add. The first path part can be either 'portlet' or 'layout', and the second path part must be the portlet name.
QUERY row No -1 0 The row position of the added fragment.
QUERY col No -1 0 The column position of the added fragment.
QUERY minrowscol No false true The flag to use the least used column index to add the fragment.
HTTP Errors HTTP Error 403 Forbidden when having no EDIT access on the current content page.
REST API examples
POST http://localhost:8080/jetspeed/services/pagelayout/fragment/portlet/demo::PickANumberPortlet/?_type=json

With the following request header:
  X-Portal-Path: /default-page.psml
JSON Response Example
{
  "name":"demo::PickANumberPortlet",
  "id":"template-top2.page-template.dashboard-1000.P-125fec68f7c-10000",
  "type":"portlet",
  "locked":false,
  "properties":{"row":"2","column":"2"}
}
XML Response Example
<fragment>
  <id>template-top2.page-template.dashboard-1000.P-125fec68f7c-10000</id>
  <locked>false</locked>
  <name>demo::PickANumberPortlet</name>
  <type>portlet</type>
  <properties>
    <entry>
      <key>row</key>
      <value>2</value>
    </entry>
    <entry>
      <key>column</key>
      <value>2</value>
    </entry>
  </properties>
</fragment>

Delete Content Fragment

Entry path /fragment/
Description Deletes the content fragment of the content page based on the fragment ID path parameter.
HTTP Method DELETE
Parameters
Type Name Required Default value Example value Description
HEADER X-Portal-Path No / /default-page.psml The current portal page path.
PATH Yes /template-top2.page-template.dashboard-1000.dashboard-1003/ The ID of the fragment to delete.
HTTP Errors HTTP Error 403 Forbidden when having no EDIT access on the current content page.
REST API examples
DELETE http://localhost:8080/jetspeed/services/pagelayout/fragment/template-top2.page-template.dashboard-1000.P-125fac24b80-10000/?_type=json

With the following request header:
  X-Portal-Path: /default-page.psml
JSON Response Example
{
  "name":"demo::PickANumberPortlet",
  "id":"template-top2.page-template.dashboard-1000.P-125fec68f7c-10000",
  "type":"portlet",
  "locked":false,
  "properties":{"row":"2","column":"2"}
}
XML Response Example
<fragment>
  <id>template-top2.page-template.dashboard-1000.P-125fec68f7c-10000</id>
  <locked>false</locked>
  <name>demo::PickANumberPortlet</name>
  <type>portlet</type>
  <properties>
    <entry>
      <key>row</key>
      <value>2</value>
    </entry>
    <entry>
      <key>column</key>
      <value>2</value>
    </entry>
  </properties>
</fragment>

Move Content Fragment

Entry path /fragment/{id}/pos/

Note: The '{id}' must be replaced by the fragment ID path parameter.
Description Moves the content fragment based on the query parameters.
HTTP Method PUT
Parameters
Type Name Required Default value Example value Description
HEADER X-Portal-Path No / /default-page.psml The current portal page path.
PATH Yes /template-top2.page-template.dashboard-1000.dashboard-1003/ The ID of the fragment to move.
QUERY layout No template-top2.page-template.dashboard-1000 The ID of the target layout fragment to which the content fragment should be moved. If this is not provided, the current parent layout fragment is used.
QUERY dir No down The moving direction. This can be either 'up', 'down', 'left' or 'right'.
QUERY row No -1 0 The row position of the content fragment to move.
QUERY col No -1 0 The column position of the content fragment to move.
QUERY x No -1 20 The absolute left position of the content fragment to move.
QUERY y No -1 20 The absolute top position of the content fragment to move.
QUERY z No -1 1000 The Z-INDEX of the content fragment to move.
QUERY w No -1 400 The width of the content fragment to move.
QUERY h No -1 300 The height of the content fragment to move.
HTTP Errors HTTP Error 403 Forbidden when having no EDIT access on the current content page.
REST API examples
PUT http://localhost:8080/jetspeed/services/pagelayout/fragment/template-top2.page-template.dashboard-1000.dashboard-1007/pos/?_type=json&col=0&row=0

With the following request header:
  X-Portal-Path: /default-page.psml
JSON Response Example
{
  "name":"j2-admin::LocaleSelector",
  "id":"template-top2.page-template.dashboard-1000.dashboard-1007",
  "type":"portlet",
  "locked":false,
  "properties":{"row":"1","column":"2"}
}
XML Response Example
<fragment>
  <id>template-top2.page-template.dashboard-1000.dashboard-1007</id>
  <locked>false</locked>
  <name>j2-admin::LocaleSelector</name>
  <type>portlet</type>
  <properties>
    <entry>
      <key>row</key>
      <value>1</value>
    </entry>
    <entry>
      <key>column</key>
      <value>2</value>
    </entry>
  </properties>
</fragment>

Change the portlet mode and window state on Content Fragment

Entry path /fragment/{id}/mod/

Note: The '{id}' must be replaced by the fragment ID path parameter.
Description
HTTP Method PUT
Parameters
Type Name Required Default value Example value Description
HEADER X-Portal-Path No / /default-page.psml The current portal page path.
PATH Yes /template-top2.page-template.dashboard-1000.dashboard-1003/ The ID of the fragment to modify.
QUERY mode Yes View The portlet mode of the content fragment.
QUERY state Yes Normal The window state of the content fragment.
HTTP Errors HTTP Error 403 Forbidden when having no EDIT access on the current content page.
REST API examples
PUT http://localhost:8080/jetspeed/services/pagelayout/fragment/template-top2.page-template.dashboard-1000.dashboard-1007/mode/?_type=json&mode=View&state=Normal

With the following request header:
  X-Portal-Path: /default-page.psml
JSON Response Example
{
  "name":"j2-admin::LocaleSelector",
  "id":"template-top2.page-template.dashboard-1000.dashboard-1007",
  "type":"portlet",
  "mode":"View",
  "state":"Normal",
  "locked":false,
  "properties":{"row":"1","column":"2"}
}
XML Response Example
<fragment>
  <id>template-top2.page-template.dashboard-1000.dashboard-1007</id>
  <locked>false</locked>
  <name>j2-admin::LocaleSelector</name>
  <type>portlet</type>
  <mode>View</mode>
  <state>Normal</state>
  <properties>
    <entry>
      <key>row</key>
      <value>1</value>
    </entry>
    <entry>
      <key>column</key>
      <value>2</value>
    </entry>
  </properties>
</fragment>

Get Decoration of Content Fragment

Entry path /decoration/fragment/
Description Retrieves decoration of the content fragment based on the fragment ID path parameter.
HTTP Method GET
Parameters
Type Name Required Default value Example value Description
HEADER X-Portal-Path No / /default-page.psml The current portal page path.
PATH Yes /template-top2.page-template.dashboard-1000.dashboard-1003/ The ID of the fragment to retrieve.
HTTP Errors HTTP Error 403 Forbidden when having no VIEW access on the current content page.
REST API examples
GET http://localhost:8080/jetspeed/services/pagelayout/decoration/fragment/template-top2.page-template.dashboard-1000.dashboard-1007/pos/?_type=json

With the following request header:
  X-Portal-Path: /default-page.psml
JSON Response Example
{
  "name":"jetspeed",
  "basePath":"/decorations/portlet/jetspeed",
  "actionsOption":"SHOW",
  "styleSheet":"decorations/portlet/jetspeed/css/styles.css",
  "baseCSSClass":"jetspeed",
  "decoratorActions":[
    {
      "name":"Configure",
      "link":"decorations/portlet/jetspeed/images/config.gif",
      "action":"http://localhost:8080/jetspeed/services/_ns:YXRlbXBsYXRlLXRvcDIucGFnZS10ZW1wbGF0ZS5kYXNoYm9hcmQtMTAwMC5kYXNoYm9hcmQtMTAwM3xjNA__/",
      "actionType":"mode",
      "actionName":"config",
      "alt":"Configure"
    },
    {
      "name":"Minimize",
      "link":"decorations/portlet/jetspeed/images/minimized.gif",
      "action":"http://localhost:8080/jetspeed/services/_ns:YXRlbXBsYXRlLXRvcDIucGFnZS10ZW1wbGF0ZS5kYXNoYm9hcmQtMTAwMC5kYXNoYm9hcmQtMTAwM3xkMQ__/",
      "actionType":"state",
      "actionName":"minimized",
      "alt":"Minimize"
    },
    {
      "name":"Maximize",
      "link":"decorations/portlet/jetspeed/images/maximized.gif",
      "action":"http://localhost:8080/jetspeed/services/_ns:YXRlbXBsYXRlLXRvcDIucGFnZS10ZW1wbGF0ZS5kYXNoYm9hcmQtMTAwMC5kYXNoYm9hcmQtMTAwM3xkMg__/",
      "actionType":"state",
      "actionName":"maximized",
      "alt":"Maximize"
    }
  ]
}
XML Response Example
<decoration>
  <name>jetspeed</name>
  <actionsOption>SHOW</actionsOption>
  <baseCSSClass>jetspeed</baseCSSClass>
  <basePath>/decorations/portlet/jetspeed</basePath>
  <styleSheet>decorations/portlet/jetspeed/css/styles.css</styleSheet>
  <decoratorActions>
    <decoratorAction>
      <action>http://localhost:8080/jetspeed/services/_ns:YXRlbXBsYXRlLXRvcDIucGFnZS10ZW1wbGF0ZS5kYXNoYm9hcmQtMTAwMC5kYXNoYm9hcmQtMTAwM3xjNA__/</action>
      <actionName>config</actionName>
      <actionType>mode</actionType>
      <alt>Configure</alt>
      <link>decorations/portlet/jetspeed/images/config.gif</link>
      <name>Configure</name>
    </decoratorAction>
    <decoratorAction>
      <action>http://localhost:8080/jetspeed/services/_ns:YXRlbXBsYXRlLXRvcDIucGFnZS10ZW1wbGF0ZS5kYXNoYm9hcmQtMTAwMC5kYXNoYm9hcmQtMTAwM3xkMQ__/</action>
      <actionName>minimized</actionName>
      <actionType>state</actionType>
      <alt>Minimize</alt>
      <link>decorations/portlet/jetspeed/images/minimized.gif</link>
      <name>Minimize</name>
    </decoratorAction>
    <decoratorAction>
      <action>http://localhost:8080/jetspeed/services/_ns:YXRlbXBsYXRlLXRvcDIucGFnZS10ZW1wbGF0ZS5kYXNoYm9hcmQtMTAwMC5kYXNoYm9hcmQtMTAwM3xkMg__/</action>
      <actionName>maximized</actionName>
      <actionType>state</actionType>
      <alt>Maximize</alt>
      <link>decorations/portlet/jetspeed/images/maximized.gif</link>
      <name>Maximize</name>
    </decoratorAction>
  </decoratorActions>
</decoration>

Page Management Service

The Page Management Service is a HTTP request-based API, communicating over a simple REST (Representational State Transfer) protocol, providing information and management functionality on portal page nodes such as pages, folders and links. This service is accessed over HTTP via the "/services/pagemanagement" path on the portal URL:

http://hostname/contextname/services/pagemanagement/

Node: All operations of this service are allowed only to those who has the right to edit the target node. Those who has the right to view only will get the HTTP Error 403 Forbidden.

Get Node

Entry path /
Description Get node based on the type parameter and the path parameter.
HTTP Method GET
Parameters
Type Name Required Default value Example value Description
PATH Yes One of the following:
  • /.psml
  • /folder
  • /.link
The first path parameter is for the node type:
  • .psml : Page node
  • folder : Folder node
  • .link : Link node
PATH Yes /default-page.psml The node path to retrieve.
REST API examples
GET http://localhost:8080/jetspeed/services/pagemanagement/.psml/default-page.psml?_type=json
JSON Response Example
{
  "id":"/default-page.psml",
  "name":"default-page.psml",
  "type":".psml",
  "path":"/default-page.psml",
  "title":"Welcome to Jetspeed",
  "shortTitle":"Welcome to Jetspeed",
  "hidden":false,
  "url":"/default-page.psml",
  "constraintsEnabled":true,
  "permissionsEnabled":false,
  "effectiveDefaultLayoutDecorator":"jetspeed",
  "effectiveDefaultPortletDecorator":"jetspeed",
  "dirty":false,
  "metadata":
    {
      "fields":[
        {
          "name":"title",
          "value":"Welcome to Jetspeed",
          "localeString":"en"
        },
        {
          "name":"title",
          "value":"Bienvenido a Jetspeed 2",
          "localeString":"es"
        }
      ]
    }
}
XML Response Example
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<page>
  <id>/default-page.psml</id>
  <name>default-page.psml</name>
  <type>.psml</type>
  <path>/default-page.psml</path>
  <title>Welcome to Jetspeed</title>
  <shortTitle>Welcome to Jetspeed</shortTitle>
  <hidden>false</hidden>
  <url>/default-page.psml</url>
  <constraintsEnabled>true</constraintsEnabled>
  <permissionsEnabled>false</permissionsEnabled>
  <effectiveDefaultLayoutDecorator>jetspeed</effectiveDefaultLayoutDecorator>
  <effectiveDefaultPortletDecorator>jetspeed</effectiveDefaultPortletDecorator>
  <dirty>false</dirty>
  <metadata>
    <fields>
      <field>
        <localeString>fr</localeString>
        <name>title</name>
        <value>Bienvenue a Jetspeed</value>
      </field>
      <field>
        <localeString>es</localeString>
        <name>title</name>
        <value>Bienvenido a Jetspeed 2</value>
      </field>
    </fields>
  </metadata>
</page>

Delete Node

Entry path /
Description Delete node based on the type parameter and the path parameter.
HTTP Method GET
Parameters
Type Name Required Default value Example value Description
PATH Yes One of the following:
  • /.psml
  • /folder
  • /.link
The first path parameter is for the node type:
  • .psml : Page node
  • folder : Folder node
  • .link : Link node
PATH Yes /default-page.psml The node path to delete.
REST API examples
DELETE http://localhost:8080/jetspeed/services/pagemanagement/.psml/default-page.psml?_type=json
JSON Response Example
{
  "id":"/default-page.psml",
  "name":"default-page.psml",
  "type":".psml",
  "path":"/default-page.psml",
  "title":"Welcome to Jetspeed",
  "shortTitle":"Welcome to Jetspeed",
  "hidden":false,
  "url":"/default-page.psml",
  "constraintsEnabled":true,
  "permissionsEnabled":false,
  "effectiveDefaultLayoutDecorator":"jetspeed",
  "effectiveDefaultPortletDecorator":"jetspeed",
  "dirty":false,
  "metadata":
    {
      "fields":[
        {
          "name":"title",
          "value":"Welcome to Jetspeed",
          "localeString":"en"
        },
        {
          "name":"title",
          "value":"Bienvenido a Jetspeed 2",
          "localeString":"es"
        }
      ]
    }
}
XML Response Example
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<page>
  <id>/default-page.psml</id>
  <name>default-page.psml</name>
  <type>.psml</type>
  <path>/default-page.psml</path>
  <title>Welcome to Jetspeed</title>
  <shortTitle>Welcome to Jetspeed</shortTitle>
  <hidden>false</hidden>
  <url>/default-page.psml</url>
  <constraintsEnabled>true</constraintsEnabled>
  <permissionsEnabled>false</permissionsEnabled>
  <effectiveDefaultLayoutDecorator>jetspeed</effectiveDefaultLayoutDecorator>
  <effectiveDefaultPortletDecorator>jetspeed</effectiveDefaultPortletDecorator>
  <dirty>false</dirty>
  <metadata>
    <fields>
      <field>
        <localeString>fr</localeString>
        <name>title</name>
        <value>Bienvenue a Jetspeed</value>
      </field>
      <field>
        <localeString>es</localeString>
        <name>title</name>
        <value>Bienvenido a Jetspeed 2</value>
      </field>
    </fields>
  </metadata>
</page>

Copy Node

Entry path /copy/
Description Copy node based on the type parameter, the path parameter and the form request parameters
HTTP Method GET
Parameters
Type Name Required Default value Example value Description
PATH Yes One of the following:
  • /.psml
  • /folder
  • /.link
The first path parameter is for the node type:
  • .psml : Page node
  • folder : Folder node
  • .link : Link node
PATH Yes /default-page.psml The source node path to copy
FORM target Yes /Examples/default-page.psml The target node path to copy
FORM deep No true or false The flag whether copy deeply or not
FORM merge Yes true or false The flag whether copy with merging on the existing target node or not.
FORM owner Yes /Examples/default-page.psml The owner name.
FORM copyids Yes true or false The flag whether copy the fragment IDs of pages to the target node or not.
REST API examples
POST http://localhost:8080/jetspeed/services/pagemanagement/copy/.psml/default-page.psml?_type=json

With the following request form parameters:
  target=/Examples/default-page.psml&deep=true&merge=true&copyids=false
JSON Response Example
{
  "id":"/Examples/default-page.psml",
  "name":"default-page.psml",
  "type":".psml",
  "path":"/Examples/default-page.psml",
  "title":"Welcome to Jetspeed",
  "shortTitle":"Welcome to Jetspeed",
  "hidden":false,
  "url":"/Examples/default-page.psml",
  "constraintsEnabled":true,
  "permissionsEnabled":false,
  "effectiveDefaultLayoutDecorator":"jetspeed",
  "effectiveDefaultPortletDecorator":"jetspeed",
  "dirty":false,
  "metadata":
    {
      "fields":[
        {
          "name":"title",
          "value":"Welcome to Jetspeed",
          "localeString":"en"
        },
        {
          "name":"title",
          "value":"Bienvenido a Jetspeed 2",
          "localeString":"es"
        }
      ]
    }
}
XML Response Example
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<page>
  <id>/Examples/default-page.psml</id>
  <name>default-page.psml</name>
  <type>.psml</type>
  <path>/Examples/default-page.psml</path>
  <title>Welcome to Jetspeed</title>
  <shortTitle>Welcome to Jetspeed</shortTitle>
  <hidden>false</hidden>
  <url>/Examples/default-page.psml</url>
  <constraintsEnabled>true</constraintsEnabled>
  <permissionsEnabled>false</permissionsEnabled>
  <effectiveDefaultLayoutDecorator>jetspeed</effectiveDefaultLayoutDecorator>
  <effectiveDefaultPortletDecorator>jetspeed</effectiveDefaultPortletDecorator>
  <dirty>false</dirty>
  <metadata>
    <fields>
      <field>
        <localeString>fr</localeString>
        <name>title</name>
        <value>Bienvenue a Jetspeed</value>
      </field>
      <field>
        <localeString>es</localeString>
        <name>title</name>
        <value>Bienvenido a Jetspeed 2</value>
      </field>
    </fields>
  </metadata>
</page>

Move Node

Entry path /move/
Description Move node based on the type parameter, the path parameter and the form request parameters
HTTP Method GET
Parameters
Type Name Required Default value Example value Description
PATH Yes One of the following:
  • /.psml
  • /folder
  • /.link
The first path parameter is for the node type:
  • .psml : Page node
  • folder : Folder node
  • .link : Link node
PATH Yes /default-page.psml The source node path to move
FORM target Yes /Examples/default-page.psml The target node path to move
FORM deep No true or false The flag whether move deeply or not
FORM merge Yes true or false The flag whether move with merging on the existing target node or not.
FORM owner Yes /Examples/default-page.psml The owner name.
FORM copyids Yes true or false The flag whether move the fragment IDs of pages to the target node or not.
REST API examples
POST http://localhost:8080/jetspeed/services/pagemanagement/move/.psml/default-page.psml?_type=json

With the following request form parameters:
  target=/Examples/default-page.psml&deep=true&merge=true&copyids=false
JSON Response Example
{
  "id":"/Examples/default-page.psml",
  "name":"default-page.psml",
  "type":".psml",
  "path":"/Examples/default-page.psml",
  "title":"Welcome to Jetspeed",
  "shortTitle":"Welcome to Jetspeed",
  "hidden":false,
  "url":"/Examples/default-page.psml",
  "constraintsEnabled":true,
  "permissionsEnabled":false,
  "effectiveDefaultLayoutDecorator":"jetspeed",
  "effectiveDefaultPortletDecorator":"jetspeed",
  "dirty":false,
  "metadata":
    {
      "fields":[
        {
          "name":"title",
          "value":"Welcome to Jetspeed",
          "localeString":"en"
        },
        {
          "name":"title",
          "value":"Bienvenido a Jetspeed 2",
          "localeString":"es"
        }
      ]
    }
}
XML Response Example
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<page>
  <id>/Examples/default-page.psml</id>
  <name>default-page.psml</name>
  <type>.psml</type>
  <path>/Examples/default-page.psml</path>
  <title>Welcome to Jetspeed</title>
  <shortTitle>Welcome to Jetspeed</shortTitle>
  <hidden>false</hidden>
  <url>/Examples/default-page.psml</url>
  <constraintsEnabled>true</constraintsEnabled>
  <permissionsEnabled>false</permissionsEnabled>
  <effectiveDefaultLayoutDecorator>jetspeed</effectiveDefaultLayoutDecorator>
  <effectiveDefaultPortletDecorator>jetspeed</effectiveDefaultPortletDecorator>
  <dirty>false</dirty>
  <metadata>
    <fields>
      <field>
        <localeString>fr</localeString>
        <name>title</name>
        <value>Bienvenue a Jetspeed</value>
      </field>
      <field>
        <localeString>es</localeString>
        <name>title</name>
        <value>Bienvenido a Jetspeed 2</value>
      </field>
    </fields>
  </metadata>
</page>

Update Node Info

Entry path /info/
Description Update node info based on the type parameter, the path parameter and the form request parameters
HTTP Method GET
Parameters
Type Name Required Default value Example value Description
PATH Yes One of the following:
  • /.psml
  • /folder
  • /.link
The first path parameter is for the node type:
  • .psml : Page node
  • folder : Folder node
  • .link : Link node
PATH Yes /default-page.psml The target node path to move
FORM title No Welcome to Jetspeed The title of the node.
FORM shorttitle No Welcome The short title of the node.
FORM hidden No true or false The flag whether the target node is hidden or not.
FORM skin No jetspeed The skin name of the target node.
FORM version No true or false The version of the target node.
FORM docorder No default-page.psml, min.psml The document order of the target node. The target node must be a folder node. Otherwise, this parameter will be just ignored.
FORM url No http://portals.apache.org The url of the target node. The target node must be a link node. Otherwise, this parameter will be just ignored.
REST API examples
POST http://localhost:8080/jetspeed/services/pagemanagement/info/.psml/default-page.psml?_type=json

With the following request form parameters:
  title=Welcome to Jetspeed-2 Enterprise Portal
JSON Response Example
{
  "id":"/Examples/default-page.psml",
  "name":"default-page.psml",
  "type":".psml",
  "path":"/Examples/default-page.psml",
  "title":"Welcome to Jetspeed-2 Enterprise Portal",
  "shortTitle":"Welcome to Jetspeed",
  "hidden":false,
  "url":"/Examples/default-page.psml",
  "constraintsEnabled":true,
  "permissionsEnabled":false,
  "effectiveDefaultLayoutDecorator":"jetspeed",
  "effectiveDefaultPortletDecorator":"jetspeed",
  "dirty":false,
  "metadata":
    {
      "fields":[
        {
          "name":"title",
          "value":"Welcome to Jetspeed",
          "localeString":"en"
        },
        {
          "name":"title",
          "value":"Bienvenido a Jetspeed 2",
          "localeString":"es"
        }
      ]
    }
}
XML Response Example
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<page>
  <id>/Examples/default-page.psml</id>
  <name>default-page.psml</name>
  <type>.psml</type>
  <path>/Examples/default-page.psml</path>
  <title>Welcome to Jetspeed-2 Enterprise Portal</title>
  <shortTitle>Welcome to Jetspeed</shortTitle>
  <hidden>false</hidden>
  <url>/Examples/default-page.psml</url>
  <constraintsEnabled>true</constraintsEnabled>
  <permissionsEnabled>false</permissionsEnabled>
  <effectiveDefaultLayoutDecorator>jetspeed</effectiveDefaultLayoutDecorator>
  <effectiveDefaultPortletDecorator>jetspeed</effectiveDefaultPortletDecorator>
  <dirty>false</dirty>
  <metadata>
    <fields>
      <field>
        <localeString>fr</localeString>
        <name>title</name>
        <value>Bienvenue a Jetspeed</value>
      </field>
      <field>
        <localeString>es</localeString>
        <name>title</name>
        <value>Bienvenido a Jetspeed 2</value>
      </field>
    </fields>
  </metadata>
</page>

Spring Assembly

The Jetspeed REST Services are configured in the Spring Assembly. Here is the core part of the Spring Assembly. Each service component is configured in the resource providers.

  <!-- 
    The internal server factory. 
    Each JAX-RS service component is registered by "resourceProvider" property. 
  -->
  <bean id="cxfJaxrsServerFactoryBean" class="org.apache.cxf.jaxrs.JAXRSServerFactoryBean">
    <meta key="j2:cat" value="default" />
    <property name="address" value="/" />
    <property name="destinationFactory" ref="cxfDestinationFactory" />
    <property name="providers">
      <list>
        <ref bean="jaxrsJsonProvider" />
      </list>
    </property>
    <property name="resourceProviders">
      <list>
        <bean class="org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider">
          <meta key="j2:cat" value="default" />
          <constructor-arg ref="jaxrsPortletRegistryService" />
        </bean>
        <bean class="org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider">
          <meta key="j2:cat" value="default" />
          <constructor-arg ref="jaxrsPageLayoutService" />
        </bean>
        <bean class="org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider">
          <meta key="j2:cat" value="default" />
          <constructor-arg ref="jaxrsPageManagementService" />
        </bean>
      </list>
    </property>
  </bean>
  
  <!-- Portlet Registry JAX-RS Service -->
  <bean id="jaxrsPortletRegistryService" class="org.apache.jetspeed.services.rest.PortletRegistryService">
    <meta key="j2:cat" value="default" />
    <constructor-arg ref="org.apache.jetspeed.security.SecurityAccessController" />
    <constructor-arg ref="org.apache.jetspeed.components.portletregistry.PortletRegistry" />
    <constructor-arg ref="org.apache.jetspeed.search.SearchEngine" />
  </bean>
  
  <!-- Portal Page Layout Management JAX-RS Service -->
  <bean id="jaxrsPageLayoutService" class="org.apache.jetspeed.services.rest.PageLayoutService">
    <meta key="j2:cat" value="default" />
    <constructor-arg ref="org.apache.jetspeed.layout.PageLayoutComponent" />
    <constructor-arg ref="org.apache.jetspeed.components.portletregistry.PortletRegistry" />
    <constructor-arg ref="PortletActionSecurityBehavior" />
  </bean>
  
  <!-- Portal Page Management JAX-RS Service -->
  <bean id="jaxrsPageManagementService" class="org.apache.jetspeed.services.rest.PageManagementService">
    <meta key="j2:cat" value="default" />
    <constructor-arg ref="org.apache.jetspeed.page.PageManager" />
  </bean>