* If the phpParameter is not empty create a PHPParameters object and attach it to the session
*/
if ( phpParameter != null && phpParameter.length() > 0)
{
// Perl Parameter Object
PHPParameters phpScript = new PHPParameters();
// Separate the values before and after the Query Mark ?
int ixQuery = phpParameter.indexOf('?');
if ( ixQuery != -1)
{
phpScript.setScriptName(phpParameter.substring(0,ixQuery));
String queryArguments = phpParameter.substring(ixQuery+1);
System.out.println("ProcessRequest -- Script " + phpParameter.substring(0,ixQuery) + " Query string " + queryArguments);
int ixQuerySeparator = queryArguments.indexOf('&');
while ( ixQuerySeparator != -1)
{
phpScript.addQueryArgument(queryArguments.substring(0, ixQuerySeparator));
queryArguments = queryArguments.substring(ixQuerySeparator+1);
ixQuerySeparator = queryArguments.indexOf('&');
}
phpScript.addQueryArgument(queryArguments);
// Add the PerlParameters to the session
actionRequest.getPortletSession().setAttribute(PHPParameters.PHP_PARAMETER, phpScript, PortletSession.APPLICATION_SCOPE);
}
else
{
// No query string just the script name
phpScript.setScriptName(phpParameter);
// Get all the parameters from the request and add them as query arguments
Enumeration names = actionRequest.getParameterNames();
String name, value;
while (names.hasMoreElements())
{
name = (String)names.nextElement();
// ACTION_PARAMETER_PHP already processed just ignore it
if (name.compareToIgnoreCase(PHPParameters.ACTION_PARAMETER_PHP) != 0)
{
value = actionRequest.getParameter(name);
phpScript.addQueryArgument(name + "=" + value);
}
}
// Add the PerlParameters to the session
actionRequest.getPortletSession().setAttribute(PHPParameters.PHP_PARAMETER, phpScript, PortletSession.APPLICATION_SCOPE);
}