use of com.agiletec.aps.system.services.url.IURLManager in project entando-core by entando.
the class SystemInfoWrapper method getPageURLWithWidget.
public String getPageURLWithWidget(String widgetCode) {
String url = null;
try {
IPage page = this.getPageWithWidget(widgetCode);
if (null == page)
return url;
IURLManager urlManager = (IURLManager) ApsWebApplicationUtils.getBean(SystemConstants.URL_MANAGER, this.getReqCtx().getRequest());
PageURL pageUrl = urlManager.createURL(this.getReqCtx());
pageUrl.setPage(page);
url = pageUrl.getURL();
} catch (Throwable t) {
_logger.error("Error getting pageUrl with widget: {}", widgetCode, t);
// ApsSystemUtils.logThrowable(t, this, "getPageURLWithWidget", "Error getting pageUrl with widget: " + widgetCode);
return null;
}
return url;
}
use of com.agiletec.aps.system.services.url.IURLManager in project entando-core by entando.
the class FrontServletActionRedirectResult method execute.
@Override
public void execute(ActionInvocation invocation) throws Exception {
try {
this.actionName = this.conditionalParse(this.actionName, invocation);
if (this.namespace == null) {
this.namespace = invocation.getProxy().getNamespace();
} else {
this.namespace = this.conditionalParse(this.namespace, invocation);
}
if (this.method == null) {
this.method = "";
} else {
this.method = this.conditionalParse(this.method, invocation);
}
String anchorDest = null;
Map<String, String> redirectParams = new HashMap<String, String>();
ResultConfig resultConfig = invocation.getProxy().getConfig().getResults().get(invocation.getResultCode());
if (resultConfig != null) {
this.extractResultParams(redirectParams, resultConfig, invocation);
anchorDest = this.extractAnchorDest(resultConfig, invocation);
}
HttpServletRequest request = ServletActionContext.getRequest();
RequestContext reqCtx = (RequestContext) request.getAttribute(RequestContext.REQCTX);
this.extractInternalServletParams(redirectParams, reqCtx);
IURLManager urlManager = (IURLManager) ApsWebApplicationUtils.getBean(SystemConstants.URL_MANAGER, request);
Page currentPage = (Page) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_PAGE);
Lang currentLang = (Lang) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_LANG);
ConfigInterface configManager = (ConfigInterface) ApsWebApplicationUtils.getBean(SystemConstants.BASE_CONFIG_MANAGER, request);
String urlType = configManager.getParam(SystemConstants.CONFIG_PARAM_BASE_URL);
boolean needRequest = (null != urlType && !urlType.equals(SystemConstants.CONFIG_PARAM_BASE_URL_RELATIVE));
String url = urlManager.createURL(currentPage, currentLang, redirectParams, false, (needRequest) ? request : null);
if (null != anchorDest) {
url += "#" + anchorDest;
}
this.setLocation(url);
} catch (Throwable t) {
_logger.error("error in execute", t);
}
super.execute(invocation);
}
use of com.agiletec.aps.system.services.url.IURLManager in project entando-core by entando.
the class ActionURLTag method doEndTag.
@Override
public int doEndTag() throws JspException {
ServletRequest request = this.pageContext.getRequest();
RequestContext reqCtx = (RequestContext) request.getAttribute(RequestContext.REQCTX);
IURLManager urlManager = (IURLManager) ApsWebApplicationUtils.getBean(SystemConstants.URL_MANAGER, this.pageContext);
try {
PageURL pageUrl = urlManager.createURL(reqCtx);
IPage currPage = (IPage) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_PAGE);
Integer currentFrame = (Integer) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_FRAME);
pageUrl.setPage(currPage);
pageUrl.addParam(InternalServletTag.REQUEST_PARAM_ACTIONPATH, this.getPath());
pageUrl.addParam(InternalServletTag.REQUEST_PARAM_FRAMEDEST, currentFrame.toString());
if (null != this.getParameters()) {
Iterator<String> iter = this.getParameters().keySet().iterator();
while (iter.hasNext()) {
String name = (String) iter.next();
pageUrl.addParam(name, this.getParameters().get(name));
}
}
String path = pageUrl.getURL();
if (null != this.getVar()) {
this.pageContext.setAttribute(this.getVar(), path);
} else {
this.pageContext.getOut().print(path);
}
} catch (IOException e) {
_logger.error("Error closing tag", e);
// ApsSystemUtils.logThrowable(e, this, "doEndTag");
throw new JspException("Error closing tag ", e);
}
this.release();
return EVAL_PAGE;
}
use of com.agiletec.aps.system.services.url.IURLManager in project entando-core by entando.
the class NavigatorTarget method getUrl.
/**
* Restituisce il link alla pagina corrente.
*
* @return Il link alla pagina.
*/
public String getUrl() {
IURLManager urlManager = (IURLManager) ApsWebApplicationUtils.getBean(SystemConstants.URL_MANAGER, this._reqCtx.getRequest());
PageURL pageUrl = urlManager.createURL(this._reqCtx);
pageUrl.setPage(this.getPage());
String urlString = pageUrl.getURL();
return urlString;
}
use of com.agiletec.aps.system.services.url.IURLManager in project entando-core by entando.
the class SystemInfoWrapper method getPageURLWithWidget.
public String getPageURLWithWidget(String widgetCode) {
String url = null;
try {
IPage page = this.getPageWithWidget(widgetCode);
if (null == page) {
return url;
}
IURLManager urlManager = (IURLManager) ApsWebApplicationUtils.getBean(SystemConstants.URL_MANAGER, this.getReqCtx().getRequest());
PageURL pageUrl = urlManager.createURL(this.getReqCtx());
pageUrl.setPage(page);
url = pageUrl.getURL();
} catch (Throwable t) {
_logger.error("Error getting pageUrl with widget: {}", widgetCode, t);
return null;
}
return url;
}
Aggregations