Creating and updating Script Portlet V 1.3 applications with command line push support

Your Script Portlet applications are easily located and added to portal pages by authors with the content toolbar when they are stored in a Web Content Manager Site Library. You can push files that are associated with script-based applications from your local file system to a Script Portlet instance in a Web Content Manager Site Library by running the sp push command.

About this task

You can edit and test your application locally with your favorite editor and browser and then push it to the server.

This information applies to CF05In versions ofWebSphere® Portal version 8.5 combined cumulative fix 05 and later, this feature creates a reference from the page to the application in the site area. Further updates to the application within the site area are reflected in the application on any portal pages added from the content toolbar.

This information applies to CF05In versions of WebSphere Portal version 8.5 earlier than combined cumulative fix 05, you can create and update applications. However, the following conditions apply:
  • Each time that you create an application from the toolbar, you create a new copy of the application.
  • When you update an application with the command line tool by pushing from the client system again, your page does not reflect the updated code.

Procedure

  1. Open a command line and find your application root folder. Enter the following command:
    sp push -wcmContentName your_application_name

    By default, the sp push command uses the default settings from the sp-config.json file where you installed the Script Portlet command line application. This command creates the Web Content Manager content item for your application with the name specified by the -wcmContentName argument in the Web Content Manager site area that is identified by the wcmSiteArea setting in that file. The default site area in the sp-config.json is Script Portlet Library/Script Portlet Applications. The pushed applications are stored in the Script Portlet Applications site area in the Script Portlet Library Web Content Manager library.

  2. Optional: If you are running the sp push command from any other folder than the application folder, you must use the -contentRoot argument to specify your application folder. For example, use the following code:
    sp push -contentRoot c:\samples\scripts\hello
    Table 1. General command line options
    Commands Description
    list projects Lists the Web Content Manager projects present in the Portal server.
    list vportals Lists the virtual portals that are hosted by the Portal server.
    push Create or update the content of a Script Portlet instance.

    The following options can be defined using the command line application. They can also be defined in the sp-config.json configuration file so that they do not need to be defined on the command line each time the application is used. The sp-config.json configuration file defines baseline options that are used across all instances of Script Portlet. Options that are defined on the command line are added to the sp-config.json file and supersede options that are defined in the file.

    The tool also looks for an sp-config.json file in the directory that is defined as the content root of the Script Portlet in the -contentRootoption. If -contentRoot is not specified, then the tool looks in the current working directory. If the file is found, any options that it defines are added to the baseline options. If the same option is defined in both files, the value in the content root's sp-config.json file takes precedence.

    When an option is specified in the sp-config.json configuration file, the leading dash of the option name must be omitted.

    Table 2. Portal communication options
    Option Associated property Description
    -scriptPortletServer value scriptPortletServer The URL of the Portal server that hosts a Script Portlet environment. Push requests are sent to this server. The value is formatted http://host:port or https://<host>:<port>.
    -laxSSL true|false laxSSL Defines whether to accept or reject self-signed certificates when you use HTTPS to communicate with the Portal server. The default value false rejects self-signed certificates.
    -connectTimeout value connectTimeout Defines the maximum amount of time, in milliseconds, to wait for the command line to connect to the Portal server. The default value is 15000, or 15 seconds. An error is generated if Portal does not accept the connection within the defined amount of time.
    -socketTimeout value socketTimeout Defines the maximum amount of time, in milliseconds, to wait for Portal to respond to a command after a successful connection. The default value is 15000, or 15 seconds. An error is generated if Portal does not respond to the command within the defined amount of time.
    Table 3. Portal authentication options
    Option Associated property Description
    -portalUser value portalUser TheWebSphere Portal user ID you use to log in to complete the push request.
    -portalPassword portalPassword Password of the WebSphere Portal user who completes the push request.
    Note: If the Portal server requires authentication, do not define the password in any .json configuration file because the password is stored in plain text, which is a potential security vulnerability. Instead, allow the command line to query for the password or use the -portalPassword command line option. Allowing the tool to query for the password is preferred because the password is not echoed on the command line and does not appear in the command history.
    -performAuth true|false performAuth Defines whether the Portal server requires authentication before it completes a command. The default value, true, requires that a user name and password are provided before the server completes a command.
    Table 4. Content specification options
    Option Associated property Description
    -contentRoot value contentRoot Absolute or relative path to a directory on the workstation that contains the content to be pushed to Portal. If the path is relative, then it is relative to the current working directory. When you use the -prebuiltZIP option, the -contentRoot option specifies the directory that contains the optional .json configuration file of the portlet. This directory is also where the log file of completed actions of the push command is written. The default value is the current working directory.
    -prebuiltZIP value prebuiltZIP Path to an existing compressed file that provides the content to be pushed to Portal instead of the content in the current working directory. The -contentRoot property can be used to locate the application-specific sp-config.json configuration file if not in the current working directory.
    -mainHtmlFile value mainHtmlFile Path to the main .html file of the Script Portlet application. The main .html file is the first file that is rendered by the portlet. If -contentRoot is specified, then the .html file path must be relative to the value of -contentRoot. When -prebuiltZIP is specified, the .html file path must be relative to the top-level directory in the ZIP. Required for the push command. If this path is not specified, the tool attempts to locate a file that is named either index.html or index.htm at the path that is specified by -contentRoot or in the top-level directory of the ZIP. If one of these files is found, it is used as the value of the main .html file. Otherwise, the tool prompts for the value.
    Table 5. Portlet and Web Content Manager content specification options
    Option Associated property Description
    -wcmContentName value wcmContentName Name of the Script Portlet instance to be created or updated in the Web Content Manager site area that is specified by the wcmSiteArea property or command line option. There is no default value. This name must be specified by property or command line option unless you are updating an existing script portlet instance on a page viawcmContentID or specifying the full path to a content instance via wcmContentPath.
    -wcmContentID value wcmContentID Web Content Manager content ID of an existing Script Portlet instance on a portal page. Set this value in place of wcmContentName only if you are updating an existing script portlet instance on a portal page. And set it only after you click Export Config for that application from the script portlet edit mode. Do not use this option when you create or update a script portlet application in a shared Web Content Manager Library site area.
    -wcmContentPath value wcmContentPath Full Web Content Manager path, including library and site area, to your application. You cannot use this argument with wcmSiteArea and wcmContentName or if either is used by default by sp-config.json.
    -wcmContentTitle value wcmContentTitle Sets or updates the title of the Script Portlet instance. The default is the application name that is specified with the wcmContentName option if you do not specify it here.
    -wcmSiteArea value wcmSiteArea The Web Content Manager site area in which Script Portlet instances are created.
    -projectID value projectID The ID of the Portal project that manages the publication of changes to the Script Portlet content.
    virtualPortalID value virtualPortalID The ID of the virtual Portal that contains the Script Portlet instance that you want to create or update.