use of javax.faces.application.NavigationHandler in project acs-community-packaging by Alfresco.
the class EditSpaceCommand method execute.
/**
* @see org.alfresco.web.app.servlet.command.Command#execute(org.alfresco.service.ServiceRegistry, java.util.Map)
*/
public Object execute(ServiceRegistry serviceRegistry, Map<String, Object> properties) {
ServletContext sc = (ServletContext) properties.get(PROP_SERVLETCONTEXT);
ServletRequest req = (ServletRequest) properties.get(PROP_REQUEST);
ServletResponse res = (ServletResponse) properties.get(PROP_RESPONSE);
FacesContext fc = FacesHelper.getFacesContext(req, res, sc, "/jsp/close.jsp");
BrowseBean browseBean = (BrowseBean) FacesHelper.getManagedBean(fc, BrowseBean.BEAN_NAME);
// setup context from url args in properties map
String strNodeRef = (String) properties.get(PROP_NODEREF);
ParameterCheck.mandatoryString(PROP_NODEREF, strNodeRef);
browseBean.setActionSpace(new Node(new NodeRef(strNodeRef)));
NavigationHandler navigationHandler = fc.getApplication().getNavigationHandler();
navigationHandler.handleNavigation(fc, null, "dialog:editSpace");
String viewId = fc.getViewRoot().getViewId();
try {
sc.getRequestDispatcher(BaseServlet.FACES_SERVLET + viewId).forward(req, res);
} catch (Exception e) {
throw new AlfrescoRuntimeException("Unable to forward to viewId: " + viewId, e);
}
return null;
}
use of javax.faces.application.NavigationHandler in project core by weld.
the class Crossroad method goingWithGuide.
public void goingWithGuide() {
FacesContext facesContext = FacesContext.getCurrentInstance();
NavigationHandler navHandler = facesContext.getApplication().getNavigationHandler();
navHandler.handleNavigation(facesContext, null, "/road.jsf");
}
use of javax.faces.application.NavigationHandler in project fit3d by fkaiserbio.
the class Fit3DExceptionHandler method handle.
@Override
public void handle() throws FacesException {
final Iterator<ExceptionQueuedEvent> i = getUnhandledExceptionQueuedEvents().iterator();
while (i.hasNext()) {
ExceptionQueuedEvent event = i.next();
ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource();
// get the exception from context
Throwable t = context.getException();
final FacesContext fc = FacesContext.getCurrentInstance();
final Map<String, Object> requestMap = fc.getExternalContext().getRequestMap();
final NavigationHandler nav = fc.getApplication().getNavigationHandler();
// here you do what ever you want with exception
try {
// log error ?
logger.error(t.getMessage(), t);
Flash flash = fc.getExternalContext().getFlash();
// Put the exception in the flash scope to be displayed in the
// error
// page if necessary ...
// TODO prevent direct access to errorpage
flash.put("errorDetails", t.getMessage());
// redirect error page
requestMap.put("exceptionMessage", t.getMessage());
nav.handleNavigation(fc, null, "/errorpages/generic");
fc.renderResponse();
// remove the comment below if you want to report the error in a
// jsf error message
// JsfUtil.addErrorMessage(t.getMessage());
} finally {
// remove it from queue
i.remove();
}
}
// parent handle
getWrapped().handle();
}
Aggregations