本文整理汇总了Java中javax.faces.application.ConfigurableNavigationHandler类的典型用法代码示例。如果您正苦于以下问题:Java ConfigurableNavigationHandler类的具体用法?Java ConfigurableNavigationHandler怎么用?Java ConfigurableNavigationHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConfigurableNavigationHandler类属于javax.faces.application包,在下文中一共展示了ConfigurableNavigationHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkCart
import javax.faces.application.ConfigurableNavigationHandler; //导入依赖的package包/类
public void checkCart(ComponentSystemEvent event) {
if (logger.isDebugEnabled()) logger.debug("in check cart");
FacesContext fc = FacesContext.getCurrentInstance();
ConfigurableNavigationHandler nav = (ConfigurableNavigationHandler) fc.getApplication().getNavigationHandler();
if (this.cart.isEmpty()) {
if (logger.isDebugEnabled()) logger.debug("go direct to logout");
HttpServletRequest req = (HttpServletRequest) FacesContext
.getCurrentInstance().getExternalContext().getRequest();
HttpServletResponse res = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();
try {
res.sendRedirect("finish-logout.xhtml");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
示例2: handle
import javax.faces.application.ConfigurableNavigationHandler; //导入依赖的package包/类
public void handle() throws FacesException {
final Iterator<ExceptionQueuedEvent> i = getUnhandledExceptionQueuedEvents().iterator();
while (i.hasNext()) {
ExceptionQueuedEvent event = i.next();
ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource();
Throwable t = context.getException();
final FacesContext fc = FacesContext.getCurrentInstance();
final ExternalContext externalContext = fc.getExternalContext();
final ConfigurableNavigationHandler nav = (ConfigurableNavigationHandler) fc.getApplication().getNavigationHandler();
try {
log.error(t.getMessage(), t);
performRedirect(externalContext, "/error_service");
fc.renderResponse();
} finally {
i.remove();
}
}
getWrapped().handle();
}
示例3: getNavigationCases
import javax.faces.application.ConfigurableNavigationHandler; //导入依赖的package包/类
@Override
public Map<String, Set<NavigationCase>> getNavigationCases()
{
Map<String, Set<NavigationCase>> result = null;
if (this.wrapped instanceof ConfigurableNavigationHandler)
{
result = ((ConfigurableNavigationHandler) this.wrapped).getNavigationCases();
}
if (result == null)
{
result = new HashMap<String, Set<NavigationCase>>();
}
if (!this.activated)
{
return result;
}
return new NavigationCaseMapWrapper(result, this.wrapped);
}
示例4: wrapNavigationHandlerWithNewWrapper
import javax.faces.application.ConfigurableNavigationHandler; //导入依赖的package包/类
private NavigationHandler wrapNavigationHandlerWithNewWrapper(NavigationHandler handler)
{
if (ConfigurableNavigationHandler.class.isAssignableFrom(handler.getClass()))
{
try
{
Constructor deltaSpikeNavigationHandlerWrapperConstructor =
this.navigationHandlerWrapperClass.getConstructor(ConfigurableNavigationHandler.class);
NavigationHandler navigationHandlerWrapper =
(NavigationHandler)deltaSpikeNavigationHandlerWrapperConstructor.newInstance(handler);
return navigationHandlerWrapper;
}
catch (Exception e)
{
throw ExceptionUtils.throwAsRuntimeException(e);
}
}
return null;
}
示例5: getNavigationCase
import javax.faces.application.ConfigurableNavigationHandler; //导入依赖的package包/类
/**
* @param context
* @param fromAction
* @param outcome
* @return
*/
@Override
public NavigationCase getNavigationCase(FacesContext context,
String fromAction, String outcome) {
if (parent instanceof ConfigurableNavigationHandler) {
return ((ConfigurableNavigationHandler) parent).getNavigationCase(
context, fromAction, outcome);
} else {
return null;
}
}
示例6: getNavigationCases
import javax.faces.application.ConfigurableNavigationHandler; //导入依赖的package包/类
/**
* @return
*/
@Override
public Map<String, Set<NavigationCase>> getNavigationCases() {
if (parent instanceof ConfigurableNavigationHandler) {
return ((ConfigurableNavigationHandler) parent)
.getNavigationCases();
} else {
return null;
}
}
示例7: getNavigationCase
import javax.faces.application.ConfigurableNavigationHandler; //导入依赖的package包/类
@Override
public NavigationCase getNavigationCase(FacesContext context, String fromAction,
String outcome)
{
if (!(_delegate instanceof ConfigurableNavigationHandler))
return null;
return ((ConfigurableNavigationHandler)_delegate).getNavigationCase(context, fromAction, outcome);
}
示例8: getNavigationCases
import javax.faces.application.ConfigurableNavigationHandler; //导入依赖的package包/类
@Override
public Map<String, Set<NavigationCase>> getNavigationCases()
{
if (!(_delegate instanceof ConfigurableNavigationHandler))
return _emptyCaces;
return ((ConfigurableNavigationHandler)_delegate).getNavigationCases();
}
示例9: determineTargetURL
import javax.faces.application.ConfigurableNavigationHandler; //导入依赖的package包/类
/**
* Translate the outcome attribute value to the target URL.
*
* @param context
* the current FacesContext
* @param outcome
* the value of the outcome attribute
* @return the target URL of the navigation rule (or the outcome if there's
* not navigation rule)
*/
private String determineTargetURL(FacesContext context, Button button, String outcome) {
ConfigurableNavigationHandler cnh = (ConfigurableNavigationHandler) context.getApplication()
.getNavigationHandler();
NavigationCase navCase = cnh.getNavigationCase(context, null, outcome);
/*
* Param Name: javax.faces.PROJECT_STAGE Default Value: The default
* value is ProjectStage#Production but IDE can set it differently in
* web.xml Expected Values: Development, Production, SystemTest,
* UnitTest Since: 2.0
*
* If we cannot get an outcome we use an Alert to give a feedback to the
* Developer if this build is in the Development Stage
*/
if (navCase == null) {
if (FacesContext.getCurrentInstance().getApplication().getProjectStage().equals(ProjectStage.Development)) {
return "alert('WARNING! " + C.W_NONAVCASE_BUTTON + "');";
} else {
return "";
}
} // throw new FacesException("The outcome '"+outcome+"' cannot be
// resolved."); }
String vId = navCase.getToViewId(context);
Map<String, List<String>> params = getParams(navCase, button);
String url;
url = context.getApplication().getViewHandler().getBookmarkableURL(context, vId, params,
button.isIncludeViewParams() || navCase.isIncludeViewParams());
return url;
}
示例10: getNavigationCase
import javax.faces.application.ConfigurableNavigationHandler; //导入依赖的package包/类
/** Calls the default implementation */
@Override
public NavigationCase getNavigationCase(FacesContext context,
String fromAction, String outcome) {
if (wrappedNavigationHandler instanceof ConfigurableNavigationHandler) {
return ((ConfigurableNavigationHandler) wrappedNavigationHandler)
.getNavigationCase(context, fromAction, outcome);
} else {
return null;
}
}
示例11: getNavigationCases
import javax.faces.application.ConfigurableNavigationHandler; //导入依赖的package包/类
/** Calls the default implementation */
@Override
public Map<String, Set<NavigationCase>> getNavigationCases() {
if (wrappedNavigationHandler instanceof ConfigurableNavigationHandler) {
return ((ConfigurableNavigationHandler) wrappedNavigationHandler)
.getNavigationCases();
} else {
return null;
}
}
示例12: encodeHref
import javax.faces.application.ConfigurableNavigationHandler; //导入依赖的package包/类
private String encodeHref(FacesContext context, AbstractNavLink navlink) {
String href = navlink.getHref();
String url;
if (href != null) {
url = getResourceURL(context, href);
return url;
} else {
String outcome = navlink.getOutcome();
if (outcome==null) {
return null;
}
ConfigurableNavigationHandler cnh = (ConfigurableNavigationHandler) context.getApplication()
.getNavigationHandler();
NavigationCase navCase = cnh.getNavigationCase(context, null, outcome);
if (navCase == null) {
return null;
}
String vId = navCase.getToViewId(context);
Map<String, List<String>> params = getParams(navCase, navlink);
url = context.getApplication().getViewHandler().getBookmarkableURL(context, vId, params,
navlink.isIncludeViewParams() || navCase.isIncludeViewParams());
if (url != null) {
String frag = navlink.getFragment();
if (frag != null) {
url += "#" + frag;
}
return url;
} else {
return "#";
}
}
}
示例13: handle
import javax.faces.application.ConfigurableNavigationHandler; //导入依赖的package包/类
public void handle() throws FacesException {
final Iterator<ExceptionQueuedEvent> i = getUnhandledExceptionQueuedEvents().iterator();
while (i.hasNext()) {
ExceptionQueuedEvent event = i.next();
ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource();
Throwable t = context.getException();
final FacesContext fc = FacesContext.getCurrentInstance();
final ExternalContext externalContext = fc.getExternalContext();
final ConfigurableNavigationHandler nav = (ConfigurableNavigationHandler) fc.getApplication().getNavigationHandler();
try {
if (isSecurityException(t)) {
performRedirect(externalContext, "/login");
} else if (isConversationException(t)) {
log.error(t.getMessage(), t);
performRedirect(externalContext, "/conversation_error");
} else {
log.error(t.getMessage(), t);
performRedirect(externalContext, "/error");
}
fc.renderResponse();
} finally {
i.remove();
}
}
getWrapped().handle();
}
示例14: requireLogin
import javax.faces.application.ConfigurableNavigationHandler; //导入依赖的package包/类
/** ログイン済みで無い場合、ログインページへリダイレクト */
public void requireLogin() {
if (!isLoggedin()) {
ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler)
FacesContext.getCurrentInstance()
.getApplication().getNavigationHandler();
handler.performNavigation("index.xhtml?faces-redirect=true");
}
}
示例15: skipLogin
import javax.faces.application.ConfigurableNavigationHandler; //导入依赖的package包/类
/** ログイン済みでログインページにきた場合は、ログイン後ページへリダイレクト */
public void skipLogin() {
if(isLoggedin()) {
ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler)
FacesContext.getCurrentInstance()
.getApplication().getNavigationHandler();
handler.performNavigation("chatroom.xhtml?faces-redirect=true");
}
}