Refine search
public void completeTask() throws IOException { // the conversation is always ended on task completion (otherwise the // redirect will end up in an exception anyway!) businessProcess.completeTask(true); FacesContext.getCurrentInstance().getExternalContext().redirect(url); }
protected void handleRedirect(FacesContext context, Throwable rootCause, ExceptionInfo info, boolean responseResetted) throws IOException { ExternalContext externalContext = context.getExternalContext(); externalContext.getSessionMap().put(ExceptionInfo.ATTRIBUTE_NAME, info); externalContext.redirect(url);
public void completeProcessInstanceForm() throws IOException { // start the process instance if (processDefinitionId!=null) { businessProcess.startProcessById(processDefinitionId); processDefinitionId = null; } else { businessProcess.startProcessByKey(processDefinitionKey); processDefinitionKey = null; } // End the conversation conversationInstance.get().end(); // and redirect FacesContext.getCurrentInstance().getExternalContext().redirect(url); }
FacesContext facesContext = FacesContext.getCurrentInstance(); ExternalContext ec = facesContext.getExternalContext(); ec.redirect("progress.xhtml");
FacesContext facesContext = FacesContext.getCurrentInstance(); ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext(); HttpServletRequest request = (HttpServletRequest) facesContext.getExternalContext().getRequest(); for (Cookie cookie : request.getCookies()) { if (cookie.getName().equals("Your Cookie")) { // if cookie equals then externalContext.redirect("some page"); } }
private void redirectToBatchDownloadAPI(String multiFileString, Boolean guestbookRecordsAlreadyWritten, Boolean downloadOriginal){ String fileDownloadUrl = "/api/access/datafiles/" + multiFileString; if (guestbookRecordsAlreadyWritten && !downloadOriginal){ fileDownloadUrl += "?gbrecs=true"; } else if (guestbookRecordsAlreadyWritten && downloadOriginal){ fileDownloadUrl += "?gbrecs=true&format=original"; } else if (!guestbookRecordsAlreadyWritten && downloadOriginal){ fileDownloadUrl += "?format=original"; } try { FacesContext.getCurrentInstance().getExternalContext().redirect(fileDownloadUrl); } catch (IOException ex) { logger.info("Failed to issue a redirect to file download url."); } }
public String requestInterview() { String url = dt.requestInterview(); Logger.getLogger(DataTagsAPITestingBean.class.getName()).info("Dataset name: " + datasetName); try { FacesContext.getCurrentInstance().getExternalContext().redirect(url); } catch (IOException ex) { Logger.getLogger(DataTagsAPITestingBean.class.getName()).log(Level.SEVERE, null, ex); } return url; }
public void completeTask() throws IOException { // the conversation is always ended on task completion (otherwise the // redirect will end up in an exception anyway!) businessProcess.completeTask(true); FacesContext.getCurrentInstance().getExternalContext().redirect(url); }
public void redirectToExternalURL(String url) { try { FacesContext.getCurrentInstance().getExternalContext().redirect(url); } catch (IOException e) { throw new RedirectException(e); } }
private void redirectToDownloadAPI(String downloadType, Long fileId, boolean guestBookRecordAlreadyWritten) { String fileDownloadUrl = FileUtil.getFileDownloadUrlPath(downloadType, fileId, guestBookRecordAlreadyWritten); logger.fine("Redirecting to file download url: " + fileDownloadUrl); try { FacesContext.getCurrentInstance().getExternalContext().redirect(fileDownloadUrl); } catch (IOException ex) { logger.info("Failed to issue a redirect to file download url (" + fileDownloadUrl + "): " + ex); } }
@Override protected void doEncodeBegin(javax.faces.context.ResponseWriter writer, FacesContext ctx, UIComponent component) throws IOException { UIResource resource = (UIResource) component; String url = DocumentStoreUtils.addResourceToDataStore(ctx, resource); ctx.getExternalContext().redirect(url); }
public static Boolean redirect(String pagina) { FacesContext faces = FacesContext.getCurrentInstance(); ExternalContext context = faces.getExternalContext(); try { context.redirect(pagina); return true; } catch (IOException ex) { // JavaScriptUtils.showMessageHeaderError("", ex.getMessage()) addMessageError("", ex.getMessage()); } return false; }
public String restartServer() { FacesContext context = FacesContext.getCurrentInstance(); HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest(); request.setAttribute(NXAuthConstants.DISABLE_REDIRECT_REQUEST_KEY, Boolean.TRUE); String restartUrl = BaseURL.getBaseURL(request) + RESTART_PATH; try { context.getExternalContext().redirect(restartUrl); } catch (IOException e) { log.error("Error while redirecting to restart page", e); } return null; }
public String restartServer() { FacesContext context = FacesContext.getCurrentInstance(); HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest(); request.setAttribute(NXAuthConstants.DISABLE_REDIRECT_REQUEST_KEY, Boolean.TRUE); String restartUrl = BaseURL.getBaseURL(request) + RESTART_PATH; try { context.getExternalContext().redirect(restartUrl); } catch (IOException e) { log.error("Error while redirecting to restart page", e); } return null; }
public void exec() { try { EndSessionRequest req = new EndSessionRequest(idTokenHint, postLogoutRedirectUri, state); String authorizationRequest = endSessionEndpoint + "?" + req.getQueryString(); FacesContext.getCurrentInstance().getExternalContext().redirect(authorizationRequest); } catch (Exception e) { log.error(e.getMessage(), e); } }
public static void redirectToPage(String viewId) { FacesContext.getCurrentInstance().getExternalContext().getFlash().setKeepMessages(true); String requestContextPath = FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath(); String fullRedirectUrl = requestContextPath + "/" + viewId; try { System.out.println("Redirecting to " + fullRedirectUrl); FacesContext.getCurrentInstance().getExternalContext().redirect(fullRedirectUrl); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
public void render(Map<String, ?> model, FacesContext facesContext) throws Exception { HttpServletRequest request = (HttpServletRequest) facesContext.getExternalContext().getRequest(); String targetUrl = doCreateTargetUrl(model, request); facesContext.getExternalContext().redirect(targetUrl); }
public void countryLocaleCodeChanged(String code) { if (dataverseLocales == null) { init(); } localeCode = code; FacesContext.getCurrentInstance() .getViewRoot().setLocale(new Locale(dataverseLocales.get(code))); try { String url = ((HttpServletRequest) FacesContext.getCurrentInstance() .getExternalContext().getRequest()).getHeader("referer"); FacesContext.getCurrentInstance().getExternalContext().redirect(url); } catch (IOException ioe) { ioe.printStackTrace(); } }
/** * Helper method to issue a redirect in a JSF environment properly. Subclasses may use as utility code. * @param url the url to redirect to * @param context the faces context */ protected void sendRedirect(String url, FacesContext context) { try { url = context.getExternalContext().encodeResourceURL(url); context.getExternalContext().redirect(url); context.responseComplete(); } catch (IOException e) { throw new IllegalArgumentException("Could not send redirect to " + url); } }
public void init() throws IOException { FacesContext context = FacesContext.getCurrentInstance(); if (context.isValidationFailed()) { ExternalContext externalContext = context.getExternalContext(); externalContext.redirect(externalContext.getRequestContextPath() + "/otherpage.xhtml"); } }