当前位置: 首页>>代码示例>>Java>>正文


Java PhaseId.RENDER_RESPONSE属性代码示例

本文整理汇总了Java中javax.faces.event.PhaseId.RENDER_RESPONSE属性的典型用法代码示例。如果您正苦于以下问题:Java PhaseId.RENDER_RESPONSE属性的具体用法?Java PhaseId.RENDER_RESPONSE怎么用?Java PhaseId.RENDER_RESPONSE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.faces.event.PhaseId的用法示例。


在下文中一共展示了PhaseId.RENDER_RESPONSE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getListener

public PhaseListener getListener() {
    return new PhaseListener() {
        private static final long serialVersionUID = -66585096775189540L;

        public PhaseId getPhaseId() {
            return PhaseId.RENDER_RESPONSE;
        }

        public void beforePhase(PhaseEvent event) {
            unselectCategory();
        }

        public void afterPhase(PhaseEvent arg0) {
            // nothing
        }
    };
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:17,代码来源:CategorySelectionBean.java

示例2: processPartial

@Override
public void processPartial(PhaseId phaseId)
{
  UIViewRoot viewRoot = _context.getViewRoot();
  if (phaseId == PhaseId.APPLY_REQUEST_VALUES ||
      phaseId == PhaseId.PROCESS_VALIDATIONS ||
      phaseId == PhaseId.UPDATE_MODEL_VALUES)
  {
    _processExecute(viewRoot, phaseId);
  }
  else if (phaseId == PhaseId.RENDER_RESPONSE)
  {
    _processRender(viewRoot);
  }

}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:16,代码来源:PartialViewContextImpl.java

示例3: reportPhase

private void reportPhase (PhaseEvent event, boolean after) {
    HttpSession session = (HttpSession) event.getFacesContext().getExternalContext().getSession(false);
    if (session != null) {
        if (after && event.getPhaseId() == PhaseId.RENDER_RESPONSE) {
            session.removeAttribute(PHASE);
        } else {
            if (!after) session.setAttribute(PHASE, event.getPhaseId());
        }

    }

    if (!after && event.getPhaseId() == PhaseId.RENDER_RESPONSE) {
        //DumpView(event.getFacesContext());
    }
    //System.out.println ("**********************"+(after ? "AFTER " : "BEFORE ")+event.getPhaseId()+" session="+session);        System.out.flush();
}
 
开发者ID:navisidhu,项目名称:libreacs,代码行数:16,代码来源:PhaseListener.java

示例4: getStreamedPhoto

/**
 * Can be used to render a image in the view with some image data
 * 
 * @param data
 *            array of bytes with image data
 * @return StreamedContent
 */
public StreamedContent getStreamedPhoto(byte[] data) {
	FacesContext context = FacesContext.getCurrentInstance();

	if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE) {
		return new DefaultStreamedContent(FacesContext.getCurrentInstance()
				.getExternalContext()
				.getResourceAsStream("/static/img/default-image.png"));
		// return new DefaultStreamedContent();
	} else {
		if (data != null) {
			return new DefaultStreamedContent(
					new ByteArrayInputStream(data));
		} else {
			return new DefaultStreamedContent(FacesContext
					.getCurrentInstance().getExternalContext()
					.getResourceAsStream("/static/img/default-image.png"));
		}
	}
}
 
开发者ID:machadolucas,项目名称:watchout,代码行数:26,代码来源:PlayerSessionBean.java

示例5: getStreamedInsuranceIcon

public StreamedContent getStreamedInsuranceIcon() {
	FacesContext context = FacesContext.getCurrentInstance();

	if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE) {
		return new DefaultStreamedContent();
	} else {
		String id = context.getExternalContext().getRequestParameterMap()
				.get("id");
		byte[] image = null;
		for (Insurances in : insurances) {
			if (in.getIdinsurances().toString().equals(id)) {
				image = in.getIcon();
				break;
			}
		}
		if (image != null) {
			return new DefaultStreamedContent(new ByteArrayInputStream(
					image));
		} else {
			return new DefaultStreamedContent(FacesContext
					.getCurrentInstance().getExternalContext()
					.getResourceAsStream("/static/img/default-image.png"));
		}
	}
}
 
开发者ID:machadolucas,项目名称:watchout,代码行数:25,代码来源:GameBean.java

示例6: getStreamedIcon

public StreamedContent getStreamedIcon() {
	FacesContext context = FacesContext.getCurrentInstance();

	if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE) {
		return new DefaultStreamedContent();
	} else {
		if (bean.getIcon() != null) {
			return new DefaultStreamedContent(new ByteArrayInputStream(
					bean.getIcon()));
		} else {
			return new DefaultStreamedContent(FacesContext
					.getCurrentInstance().getExternalContext()
					.getResourceAsStream("/static/img/default-image.png"));
		}
	}
}
 
开发者ID:machadolucas,项目名称:watchout,代码行数:16,代码来源:InsurancesBean.java

示例7: getStreamedPhoto

public StreamedContent getStreamedPhoto() {
	FacesContext context = FacesContext.getCurrentInstance();

	if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE) {
		return new DefaultStreamedContent();
	} else {
		if (bean.getPhoto() != null) {
			return new DefaultStreamedContent(new ByteArrayInputStream(
					bean.getPhoto()));
		} else {
			return new DefaultStreamedContent(FacesContext
					.getCurrentInstance().getExternalContext()
					.getResourceAsStream("/static/img/default-image.png"));
		}
	}
}
 
开发者ID:machadolucas,项目名称:watchout,代码行数:16,代码来源:PlacesBean.java

示例8: afterPhase

@Override
public void afterPhase(PhaseEvent event)
{
    // Set an attribute on to the session just so that we can force the session to get serialized
    // We target the invoke application phase as well since the redirects get issued at that stage.
    if (event.getPhaseId() == PhaseId.INVOKE_APPLICATION || event.getPhaseId() == PhaseId.RENDER_RESPONSE)
    {
        final String METHOD_NAME = "afterPhase";
        LOGGER.logp(Level.FINEST, CLASS_NAME, METHOD_NAME, "Adding a random attribute to the session map.");
        Map<String, Object> sessionMap = event.getFacesContext().getExternalContext().getSessionMap();
        if (sessionMap != null)
        {
            sessionMap.put("__timestamp__", System.currentTimeMillis());
        }
    }
}
 
开发者ID:roguexz,项目名称:gae-java-template,代码行数:16,代码来源:SessionSerializationListener.java

示例9: beforePhase

/**
 * Handle a notification that the processing for a particular phase of the
 * request processing lifecycle is about to begin.
 */
public void beforePhase(PhaseEvent event) {

	if(event.getPhaseId() == PhaseId.RENDER_RESPONSE) {
		FacesContext facesContext = event.getFacesContext();
		restoreMessages(facesContext);
	}
}
 
开发者ID:hantsy,项目名称:javaee8-jsf-sample,代码行数:11,代码来源:MessageHandler.java

示例10: beforePhase

/**
 * in RENDER_RESPONSE restore facesMessages
 */
public void beforePhase(PhaseEvent event) {
    if (event.getPhaseId() == PhaseId.RENDER_RESPONSE) {
        FacesContext facesContext = event.getFacesContext();
        restoreMessages(facesContext);
    }
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:9,代码来源:MessageHandler.java

示例11: goToErrorPage

/**
 * @param context
 * @param e
 * @throws Throwable
 */
private void goToErrorPage(FacesContext context, Throwable e) {
    HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();
    request.setAttribute(ERROR_EXCEPTION + "_stacktrace", e);

    if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE) {
        throw new FacesException(e);
    }

    if (e instanceof FileNotFoundException) {
        logger.log(Level.WARNING,"File not found", e);
        throw new FacesException(e);
    }


    request.setAttribute(ERROR_EXCEPTION_TYPE, e.getClass().getName());
    request.setAttribute(ERROR_MESSAGE, e.getMessage());
    request.setAttribute(ERROR_REQUEST_URI, request.getHeader("Referer"));
    request.setAttribute(ERROR_STATUS_CODE, HttpServletResponse.SC_INTERNAL_SERVER_ERROR);

    String errorPage = findErrorPage(e);
    if (!has(errorPage)) {
        String errorPageParam = context.getExternalContext().getInitParameter(Constants.InitialParams.ERROR_PAGE);
        if (!has(errorPageParam)) {
            errorPage = Constants.DEFAULT_ERROR_PAGE;
        }
    }
    context.getApplication().getNavigationHandler().handleNavigation(context, null, errorPage);
    context.renderResponse();
}
 
开发者ID:adminfaces,项目名称:admin-template,代码行数:34,代码来源:CustomExceptionHandler.java

示例12: handleBusinessException

/**
 * @param context
 * @param e       application business exception
 */
private void handleBusinessException(FacesContext context, BusinessException e) {
    if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE) {
        throw new FacesException(e);
    }
    if (has(e.getExceptionList())) {
        for (BusinessException be : e.getExceptionList()) {
            addFacesMessage(be);
        }
    } else { //Single exception
        addFacesMessage(e);
    }
    validationFailed();
    context.renderResponse();
}
 
开发者ID:adminfaces,项目名称:admin-template,代码行数:18,代码来源:CustomExceptionHandler.java

示例13: getPhotoStreamedContent

/**
 * Get photo as a stream. Parameter is expected to be present.
 *
 * @return      StreamedContent for pf graphic image.
 */
public StreamedContent getPhotoStreamedContent() {

	try
	{
		FacesContext context = FacesContext.getCurrentInstance();

		if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE)
		{
			// So, we're rendering the view. Return a stub StreamedContent so that it will generate right URL.
			return new DefaultStreamedContent();
		}

		// So, browser is requesting the image. Get ID value from actual request param.
		String photoIdStr = context.getExternalContext().getRequestParameterMap().get("photoId");
		if (photoIdStr == null)
		{
			log.error("No photoParamId found!!");
			return null;
		}

		Photo photo = photoTableModel.getRowData(photoIdStr);
		if (photo == null)
		{
			log.error("Failed to find photo in map with id " + photoIdStr);
			return null;
		}

		return new DefaultStreamedContent(new ByteArrayInputStream(photo.getPhotoContent()), photo.getPhotoType());

	}
	catch (Exception e) {
		log.error("Failed to find photo", e);
	}

	return null;
}
 
开发者ID:heather92115,项目名称:photosOpen,代码行数:41,代码来源:PhotoListBean.java

示例14: getPhaseId

/**
 * @see javax.faces.event.PhaseListener#getPhaseId()
 */
@Override
public PhaseId getPhaseId() {

    // Only listen during the render response phase.
    return PhaseId.RENDER_RESPONSE;
}
 
开发者ID:disit,项目名称:iclos,代码行数:9,代码来源:PostRedirectGetListener.java

示例15: afterPhase

/**
 * @see javax.faces.event.PhaseListener#afterPhase(javax.faces.event.PhaseEvent)
 */
public void afterPhase(PhaseEvent event)
{
   if (logger.isDebugEnabled())
   {
      if (event.getPhaseId() == PhaseId.RENDER_RESPONSE)
      {
         printComponentTree(FacesContext.getCurrentInstance().getViewRoot());
      }
      
      logger.debug("********** Exiting phase: " + event.getPhaseId().toString());
   }
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:15,代码来源:DebugPhaseListener.java


注:本文中的javax.faces.event.PhaseId.RENDER_RESPONSE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。