Package com.agiletec.aps.system

Examples of com.agiletec.aps.system.RequestContext


  }

  @Override
  public String extractShowletParam(HttpServletRequest request, String paramName) {
    String paramValue = null;
    RequestContext reqCtx = (RequestContext) request.getAttribute(RequestContext.REQCTX);
    if (reqCtx!=null) {
      Widget widget = (com.agiletec.aps.system.services.page.Widget) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET);
      if (widget!=null) {
        ApsProperties config = widget.getConfig();
        if (null != config) {
          String showletParam = config.getProperty(paramName);
          if (showletParam!=null && showletParam.trim().length()>0) {
View Full Code Here


 
  @Override
  public int doStartTag() throws JspException {
    ServletRequest request =  this.pageContext.getRequest();
    try {
      RequestContext reqCtx = (RequestContext) request.getAttribute(RequestContext.REQCTX);
      Object value = reqCtx.getExtraParam(this.getParam());
      if (null != value) {
        String var = this.getVar();
        if (null == var || "".equals(var)) {
          this.pageContext.getOut().print(value);
        } else {
View Full Code Here

  @Override
  public int doStartTag() throws JspException {
    HttpServletRequest req =  (HttpServletRequest) this.pageContext.getRequest();
    try {
      HttpSession session = req.getSession();
      RequestContext reqCtx = (RequestContext) req.getAttribute(RequestContext.REQCTX);
      Lang lang = (Lang) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_LANG);
      req.getSession().setAttribute(JpmyportalplusSystemConstants.SESSIONPARAM_CURRENT_LANG, lang);
      UserDetails currentUser = (UserDetails) session.getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
      if (!currentUser.getUsername().equals(SystemConstants.GUEST_USER_NAME)) {
        PageUserConfigBean userConfigBean = (PageUserConfigBean) session.getAttribute(JpmyportalplusSystemConstants.SESSIONPARAM_CURRENT_CUSTOM_USER_PAGE_CONFIG);
        if (null == userConfigBean || !currentUser.getUsername().equals(userConfigBean.getUsername())) {
View Full Code Here

  }

  @Override
  protected void buildWidgetOutput(IPage page, String[] showletOutput) throws JspException {
    HttpServletRequest req =  (HttpServletRequest) this.pageContext.getRequest();
    RequestContext reqCtx = (RequestContext) req.getAttribute(RequestContext.REQCTX);
    try {
      IPageUserConfigManager pageUserConfigManager = (IPageUserConfigManager) ApsWebApplicationUtils.getBean(JpmyportalplusSystemConstants.PAGE_USER_CONFIG_MANAGER, pageContext);
      CustomPageConfig customPageConfig = null;
      UserDetails currentUser = (UserDetails) this.pageContext.getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
      if (currentUser.getUsername().equals(SystemConstants.GUEST_USER_NAME)) {
        customPageConfig = pageUserConfigManager.getGuestPageConfig(page, req);
      } else {
        PageUserConfigBean userConfigBean = (PageUserConfigBean) req.getSession().getAttribute(JpmyportalplusSystemConstants.SESSIONPARAM_CURRENT_CUSTOM_USER_PAGE_CONFIG);
        if (null != userConfigBean) {
          customPageConfig = userConfigBean.getConfig().get(page.getCode());
        }
      }
      if (null == customPageConfig || customPageConfig.getConfig() == null || !customPageConfig.getPageCode().equals(page.getCode())) {
        req.getSession().removeAttribute(JpmyportalplusSystemConstants.SESSIONPARAM_CURRENT_CUSTOM_PAGE_CONFIG);
        super.buildWidgetOutput(page, showletOutput);
        return;
      }
      req.getSession().setAttribute(JpmyportalplusSystemConstants.SESSIONPARAM_CURRENT_CUSTOM_PAGE_CONFIG, customPageConfig);
      Widget[] customShowlets = customPageConfig.getConfig();
      Widget[] showletsToRender = pageUserConfigManager.getShowletsToRender(page, customShowlets);
      List<IFrameDecoratorContainer> decorators = this.extractDecorators();
      BodyContent body = this.pageContext.pushBody();
      for (int scan = 0; scan < showletsToRender.length; scan++) {
        reqCtx.addExtraParam(SystemConstants.EXTRAPAR_CURRENT_FRAME, new Integer(scan));
        body.clearBody();
        this.includeWidget(reqCtx, showletsToRender[scan], decorators);
        showletOutput[scan] = body.getString();
      }
    } catch (Throwable t) {
View Full Code Here

  /**
   * End tag analysis.
   */
  public int doEndTag() throws JspException {
    ServletRequest req =  this.pageContext.getRequest();
    RequestContext reqCtx = (RequestContext) req.getAttribute(RequestContext.REQCTX);
    try {
      Object value = reqCtx.getExtraParam(this.getVar());
      if (value == null) value = "";
      this.pageContext.getOut().print(value);
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "doStartTag");
      throw new JspException("Error in end tag", t);
View Full Code Here

  /**
   * Start tag analysis.
   */
  public int doStartTag() throws JspException {
    ServletRequest request =  this.pageContext.getRequest();
    RequestContext reqCtx = (RequestContext) request.getAttribute(RequestContext.REQCTX);
    try {
      Widget showlet = (Widget) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET);
      String contentsId = showlet.getConfig().getProperty(GeoRefSystemConstants.ROUTE_CONTENTS_ID_SHOWLET_PARAM);
      this.pageContext.setAttribute(this.getListName(), this.extractContentIdList(contentsId));
    } catch (Throwable e) {
      ApsSystemUtils.logThrowable(e, this, "doStartTag");
      throw new JspException("Error initialization tag", e);
View Full Code Here

* @author E.Santoboni
*/
public class CustomizableWidgetsTag extends TagSupport {

    public int doStartTag() throws JspException {
        RequestContext reqCtx = (RequestContext) this.pageContext.getRequest().getAttribute(RequestContext.REQCTX);
        List<WidgetCheckInfo> checkInfos = new ArrayList<WidgetCheckInfo>();
        IPageUserConfigManager pageUserConfigManager = (IPageUserConfigManager) ApsWebApplicationUtils.getBean(JpmyportalplusSystemConstants.PAGE_USER_CONFIG_MANAGER, pageContext);
        try {
            Lang currentLang = (Lang) this.pageContext.getSession().getAttribute(JpmyportalplusSystemConstants.SESSIONPARAM_CURRENT_LANG);
            IPage currentPage = (IPage) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_PAGE);
            Widget[] customShowletConfig = this.getCustomShowletConfig(currentPage);
            Widget[] showletsToRender = pageUserConfigManager.getShowletsToRender(currentPage, customShowletConfig);
            List<String> allowedShowlets = new ArrayList<String>();
            Map<String, WidgetType> customizableShowlets = this.getCustomizableShowlets(pageUserConfigManager);
            allowedShowlets.addAll(customizableShowlets.keySet());
View Full Code Here

  }
 
  //---------------------------------------------- Dispenser
 
    public void testGetRenderedContent_1() throws Throwable {
      RequestContext reqCtx = this.getRequestContext();
    String contentId = null;
    String langCode = "en";
    long modelId = -1;
    try {
      modelId = this.createMockContentModel();
View Full Code Here

      this.deleteMockContentObject(contentId, modelId);
    }
    }
   
  public void testGetRenderedContent_2() throws Throwable {
      RequestContext reqCtx = this.getRequestContext();
    String contentId = null;
    String langCode = "en";
    long modelId = -1;
    try {
      modelId = this.createMockContentModel();
View Full Code Here

      this.deleteMockContentObject(contentId, modelId);
    }
    }
   
  public void testGetRenderedContent_3() throws Throwable {
      RequestContext reqCtx = this.getRequestContext();
    String contentId = null;
    String langCode = "en";
    long modelId = -1;
    try {
      modelId = this.createMockContentModel();
View Full Code Here

TOP

Related Classes of com.agiletec.aps.system.RequestContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.