2013-08-16

Force a virtual portal to a specific language

How do I force a specific virtual portal based on hostname to a specific language?

In order to force the WebSphere Portal to display a certain langugage the easiest way is to replace the "Accept-Language" header to whatever locale you want but if you have muliple virtual hosts you also have to check for the hostname in the request.

The below lines can be placed in the Apache httpd.conf file in order to add headers based on the conditional rule of the hostname.


SetEnvIf Host \.<server host> force-en
#Header echo Accept-Language <- will return the language.
RequestHeader unset Accept-Language env=force-en
RequestHeader append Accept-Language "en-us" env=force-en



2013-06-10

How to read the WebSphere Portal page mode.

In order to find out the view or edit mode of a portal page in WebSphere Portal 8 the portlet can read the public rendering parameter of the toolbar state:

Just add this to the portlet.xml file

<public-render-parameter>                                              
  <description>Shared render parameter that holds the toolbar state.</description>                                                      
  <identifier>toolbarstate</identifier>                                
  <qname xmlns:utb='http://www.ibm.com/xmlns/prod/websphere/portal/publicparams/utb'>utb:state</qname>                                                  
</public-render-parameter>                                              
                                                                       
Inside the <portlet> tag you need to add:                                                                                                    
<supported-public-render-parameter>toolbarstate</supported-public-render-parameter>

The value is then red using a normal:
 String statevalue = renderRequest.getparameter("toolbarstate");


2013-03-13

Delegate,Delegate,Delegate

Note to self, always add the group you want to assign rights to to the user group you want to assign rights from in the Portal config.

<?xml version="1.0" encoding="UTF-8"?>
<request type="update" version="8.0.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PortalConfig_8.0.0.xsd" create-oids="true">
    <portal action="locate">
        <group action="update" domain="rel" name="baseline_group">
            <access-control externalized="false" owner="undefined" private="false">
                <role actionset="Delegator" update="set">
                    <mapping subjectid="portal_editors" subjecttype="user_group" update="set" />
                    <mapping subjectid="librarians" subjecttype="user_group" update="set" />
/>
                </role>
                <role actionset="Can Run As User" update="set">
                    <mapping subjectid="librarians" subjecttype="user_group" update="set" />
/>
                </role>
            </access-control>
        </group>
    </portal>
</request>