Search in sources :

Example 6 with PageURL

use of com.agiletec.aps.system.services.url.PageURL in project entando-core by entando.

the class ErrorManager method service.

@Override
public int service(RequestContext reqCtx, int status) {
    if (status == ControllerManager.CONTINUE || status == ControllerManager.OUTPUT) {
        return ControllerManager.OUTPUT;
    }
    int retStatus = ControllerManager.INVALID_STATUS;
    _logger.debug("Intervention of the error service");
    try {
        PageURL url = this.getUrlManager().createURL(reqCtx);
        url.setPageCode(this.getErrorPageCode());
        String redirUrl = url.getURL();
        _logger.debug("Redirecting to " + redirUrl);
        reqCtx.clearError();
        reqCtx.addExtraParam(RequestContext.EXTRAPAR_REDIRECT_URL, redirUrl);
        retStatus = ControllerManager.REDIRECT;
    } catch (Throwable t) {
        _logger.debug("Error detected while processing the request", t);
        retStatus = ControllerManager.SYS_ERROR;
        reqCtx.setHTTPError(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
    }
    return retStatus;
}
Also used : PageURL(com.agiletec.aps.system.services.url.PageURL)

Example 7 with PageURL

use of com.agiletec.aps.system.services.url.PageURL 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;
}
Also used : IPage(com.agiletec.aps.system.services.page.IPage) PageURL(com.agiletec.aps.system.services.url.PageURL) IURLManager(com.agiletec.aps.system.services.url.IURLManager)

Example 8 with PageURL

use of com.agiletec.aps.system.services.url.PageURL 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;
}
Also used : ServletRequest(javax.servlet.ServletRequest) JspException(javax.servlet.jsp.JspException) IPage(com.agiletec.aps.system.services.page.IPage) PageURL(com.agiletec.aps.system.services.url.PageURL) IURLManager(com.agiletec.aps.system.services.url.IURLManager) RequestContext(com.agiletec.aps.system.RequestContext) IOException(java.io.IOException)

Example 9 with PageURL

use of com.agiletec.aps.system.services.url.PageURL 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;
}
Also used : PageURL(com.agiletec.aps.system.services.url.PageURL) IURLManager(com.agiletec.aps.system.services.url.IURLManager)

Aggregations

PageURL (com.agiletec.aps.system.services.url.PageURL)9 IURLManager (com.agiletec.aps.system.services.url.IURLManager)6 IPage (com.agiletec.aps.system.services.page.IPage)4 RequestContext (com.agiletec.aps.system.RequestContext)2 ResourceInterface (com.agiletec.plugins.jacms.aps.system.services.resource.model.ResourceInterface)1 IOException (java.io.IOException)1 ServletRequest (javax.servlet.ServletRequest)1 JspException (javax.servlet.jsp.JspException)1