use of com.agiletec.aps.system.services.url.IURLManager in project entando-core by entando.
the class InfoTag method doStartTag.
@Override
public int doStartTag() throws JspException {
ServletRequest request = this.pageContext.getRequest();
try {
if ("startLang".equals(this._key)) {
Lang startLang = this.extractStartLang();
this._info = startLang.getCode();
} else if ("defaultLang".equals(this._key)) {
ILangManager langManager = (ILangManager) ApsWebApplicationUtils.getBean(SystemConstants.LANGUAGE_MANAGER, this.pageContext);
this._info = langManager.getDefaultLang().getCode();
} else if ("currentLang".equals(this._key)) {
RequestContext reqCtx = (RequestContext) request.getAttribute(RequestContext.REQCTX);
Lang currentLang = (Lang) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_LANG);
this._info = currentLang.getCode();
} else if ("langs".equals(this._key)) {
ILangManager langManager = (ILangManager) ApsWebApplicationUtils.getBean(SystemConstants.LANGUAGE_MANAGER, this.pageContext);
this._info = langManager.getLangs();
} else if ("systemParam".equals(this._key)) {
if (SystemConstants.PAR_APPL_BASE_URL.equals(this.getParamName())) {
IURLManager urlManager = (IURLManager) ApsWebApplicationUtils.getBean(SystemConstants.URL_MANAGER, this.pageContext);
this._info = urlManager.getApplicationBaseURL((HttpServletRequest) request);
} else {
ConfigInterface confManager = (ConfigInterface) ApsWebApplicationUtils.getBean(SystemConstants.BASE_CONFIG_MANAGER, this.pageContext);
this._info = confManager.getParam(this.getParamName());
}
}
} catch (Throwable t) {
_logger.error("Error during tag initialization", t);
throw new JspException("Error during tag initialization", t);
}
return EVAL_BODY_INCLUDE;
}
use of com.agiletec.aps.system.services.url.IURLManager in project entando-core by entando.
the class PageInfoTag method extractPageUrl.
protected void extractPageUrl(IPage page, Lang currentLang, RequestContext reqCtx) {
IURLManager urlManager = (IURLManager) ApsWebApplicationUtils.getBean(SystemConstants.URL_MANAGER, this.pageContext);
PageURL pageUrl = urlManager.createURL(reqCtx);
pageUrl.setPageCode(page.getCode());
if (this.getLangCode() != null) {
pageUrl.setLangCode(this.getLangCode());
} else {
pageUrl.setLangCode(currentLang.getCode());
}
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));
}
}
this.setValue(pageUrl.getURL());
}
use of com.agiletec.aps.system.services.url.IURLManager in project entando-core by entando.
the class URLTag method doStartTag.
/**
* Prepares a PageURL object; this object may comprehend several sub-tags
*/
@Override
public int doStartTag() throws JspException {
ServletRequest request = this.pageContext.getRequest();
RequestContext reqCtx = (RequestContext) request.getAttribute(RequestContext.REQCTX);
try {
IURLManager urlManager = (IURLManager) ApsWebApplicationUtils.getBean(SystemConstants.URL_MANAGER, this.pageContext);
this._pageUrl = urlManager.createURL(reqCtx);
if (_pageCode != null) {
_pageUrl.setPageCode(_pageCode);
}
if (_langCode != null) {
_pageUrl.setLangCode(_langCode);
}
if (this.isParamRepeat()) {
List<String> exclusion = this.getParametersToExclude();
_pageUrl.setParamRepeat(exclusion);
}
} catch (Throwable t) {
_logger.error("Error during tag initialization", t);
throw new JspException("Error during tag initialization", t);
}
return EVAL_BODY_INCLUDE;
}
use of com.agiletec.aps.system.services.url.IURLManager in project entando-core by entando.
the class ApiRestServer method extractApplicationBaseUrl.
protected String extractApplicationBaseUrl(HttpServletRequest request) throws Exception {
String applicationBaseUrl = null;
try {
IURLManager urlManager = (IURLManager) ApsWebApplicationUtils.getBean(SystemConstants.URL_MANAGER, request);
applicationBaseUrl = urlManager.getApplicationBaseURL(request);
} catch (Exception t) {
_logger.error("Error extracting application base url", t);
}
return applicationBaseUrl;
}
use of com.agiletec.aps.system.services.url.IURLManager in project entando-core by entando.
the class SystemInfoWrapper method getActionPathUrl.
public String getActionPathUrl(String actionPath) {
String url = null;
RequestContext reqCtx = this.getReqCtx();
IURLManager urlManager = (IURLManager) ApsWebApplicationUtils.getBean(SystemConstants.URL_MANAGER, reqCtx.getRequest());
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, actionPath);
pageUrl.addParam(InternalServletTag.REQUEST_PARAM_FRAMEDEST, currentFrame.toString());
url = pageUrl.getURL();
} catch (Throwable t) {
_logger.error("Error getting path for action path: {}", actionPath, t);
return null;
}
return url;
}
Aggregations