當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。