*
* @return the portal URL.
*/
private PortalURL parse(String urlBase, String contextPath, String servletName, String pathInfo, String portletInfo) {
// Construct portal URL using info retrieved from servlet request.
PortalURL portalURL = new RelativePortalURLImpl(urlBase, contextPath, servletName+pathInfo, this);
if (portletInfo == null) {
if (servletName.contains(".jsp") && !servletName.endsWith(".jsp")) {
int idx = servletName.indexOf(".jsp") + ".jsp".length();
portletInfo = servletName.substring(idx);
servletName = servletName.substring(0, idx);
portalURL = new RelativePortalURLImpl(urlBase, contextPath, servletName, this);
} else {
return portalURL;
}
}
if (LOG.isDebugEnabled()) {
LOG.debug("Parsing request pathInfo: " + portletInfo);
}
StringBuffer renderPath = new StringBuffer();
StringTokenizer st = new StringTokenizer(portletInfo, "/", false);
while (st.hasMoreTokens()) {
String token = st.nextToken();
// Part of the render path: append to renderPath.
if (!token.startsWith(PREFIX)) {
// renderPath.append(token);
//Fix for PLUTO-243
renderPath.append('/').append(token);
}
// Resource window definition: portalURL.setResourceWindow().
else if (token.startsWith(PREFIX + RESOURCE)) {
portalURL.setResourceWindow(decodeControlParameter(token)[0]);
}
// Action window definition: portalURL.setActionWindow().
else if (token.startsWith(PREFIX + ACTION)) {
portalURL.setActionWindow(decodeControlParameter(token)[0]);
}
// Cacheability definition: portalURL.setCacheability().
else if (token.startsWith(PREFIX + CACHE_LEVEL)) {
portalURL.setCacheability(decodeControlParameter(token)[0]);
}
// ResourceID definition: portalURL.setResourceID().
else if (token.startsWith(PREFIX + RESOURCE_ID)) {
portalURL.setResourceID(decodeControlParameter(token)[0]);
}
// Window state definition: portalURL.setWindowState().
else if (token.startsWith(PREFIX + WINDOW_STATE)) {
String[] decoded = decodeControlParameter(token);
portalURL.setWindowState(decoded[0], new WindowState(decoded[1]));
}
// Portlet mode definition: portalURL.setPortletMode().
else if (token.startsWith(PREFIX + PORTLET_MODE)) {
String[] decoded = decodeControlParameter(token);
portalURL.setPortletMode(decoded[0], new PortletMode(decoded[1]));
}
// Portal URL parameter: portalURL.addParameter().
else if (token.startsWith(PREFIX + RENDER_PARAM)) {
String value = null;
if (st.hasMoreTokens()) {
value = st.nextToken();
}
//set the
PortalURLParameter param = decodeParameter(token, value);
portalURL.addParameter(param);
} else if (token.startsWith(PREFIX + PRIVATE_RENDER_PARAM)) {
String value = null;
if (st.hasMoreTokens()) {
value = st.nextToken();
}
PortalURLParameter param = decodePublicParameter(token, value);
if (param != null) {
//set private (Resource) parameter in portalURL
portalURL.getPrivateRenderParameters().put(param.getName(), param.getValues());
}
} else if (token.startsWith(PREFIX + PUBLIC_RENDER_PARAM)) {
String value = null;
if (st.hasMoreTokens()) {
value = st.nextToken();
}
PortalURLParameter param = decodePublicParameter(token, value);
if (param != null) {
//set public parameter in portalURL
portalURL.addPublicParameterCurrent(param.getName(), param.getValues());
}
}
}
if (renderPath.length() > 0) {
portalURL.setRenderPath(renderPath.toString());
}
// Return the portal URL.
return portalURL;
}