Request request = ObjectModelHelper.getRequest(objectModel);
RenderResponse renderResponse = PortletObjectModelHelper.getRenderResponse(objectModel);
if (renderResponse != null) {
PortletURL url = null;
if (name.startsWith(PREFIX_RENDER)) {
url = renderResponse.createRenderURL();
name = name.substring(PREFIX_RENDER.length());
if (name.length() > 0 && name.charAt(0) == '/') {
name = name.substring(1);
}
} else if (name.startsWith(PREFIX_RESOURCE)) {
name = name.substring(PREFIX_RESOURCE.length());
if (name.length() == 0 || name.charAt(0) != '/') {
String uri = request.getContextPath() + "/" + request.getServletPath();
name = NetUtils.absolutize(uri, name);
}
return renderResponse.encodeURL(name);
} else if (name.startsWith(PREFIX_ACTION)) {
url = renderResponse.createActionURL();
name = name.substring(PREFIX_ACTION.length());
if (name.length() > 0 && name.charAt(0) == '/') {
name = name.substring(1);
}
} else {
throw new IllegalArgumentException("Invalid attribute name '" + name + "' for '" + getClass().getName() + "'");
}
Map parameters = new HashMap(7);
name = NetUtils.deparameterize(name, parameters);
if (name.length() > 0) {
parameters.put(PortletEnvironment.PARAMETER_PATH_INFO, name);
}
for (Iterator i = parameters.keySet().iterator(); i.hasNext();) {
String param = (String) i.next();
Object values = parameters.get(param);
if (values instanceof String) {
url.setParameter(param, (String) values);
} else {
url.setParameter(param, (String[]) values);
}
}
return url.toString();
} else {
if (name.startsWith(PREFIX_RENDER)) {
return name.substring(PREFIX_RENDER.length());
} else if (name.startsWith(PREFIX_RESOURCE)) {
return name.substring(PREFIX_RESOURCE.length());