org.omnifaces.util.Faces Java Examples
The following examples show how to use
org.omnifaces.util.Faces.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CombinedResourceInputStream.java From BootsFaces-Examples with Apache License 2.0 | 6 votes |
/** * Creates an instance of {@link CombinedResourceInputStream} based on the given resources. For each resource, the {@link InputStream} * will be obtained and hold in an iterable collection. * * @param resources * The resources to be read. * @throws IOException * If something fails at I/O level. */ public CombinedResourceInputStream(Set<Resource> resources) throws IOException { prepareStreaming(resources); /* 16.02.2015 Caching added by Stephan Rauh, http://www.beyondjava.net */ if ("true".equals(Faces.getInitParameter(PARAM_NAME_ACTIVATE_RESOURCE_CACHING))) { combinedResource = prepareStreamingFromCache(streamIterator, resources); pointer = 0; currentStream = null; } else { streamIterator.hasNext(); // We assume it to be always true, see also CombinedResource#getInputStream(). currentStream = streamIterator.next(); } /* 16.02.2015 end of pull request */ }
Example #2
Source File: CombinedResourceInputStream.java From BootsFaces-Examples with Apache License 2.0 | 6 votes |
/** * How many seconds are cache entries supposed to live in the cache? Default: 1 hour. * @return the number of seconds */ private static int getTimeToLiveOfCacheEntries() { int timeToLive=3600; // one hour by default String ttl = Faces.getInitParameter(TIME_TO_LIVE_CONTEXT_PARAM); if (null !=ttl) { try { timeToLive=Integer.parseInt(ttl); } catch (Exception weirdEntry) { // this error has already been reported on startup, so we can safely ignore it here } } return timeToLive; }
Example #3
Source File: LogoutMB.java From admin-template with MIT License | 5 votes |
public void doLogout() throws IOException { String loginPage = adminConfig.getLoginPage(); if (loginPage == null || "".equals(loginPage)) { loginPage = Constants.DEFAULT_LOGIN_PAGE; } if (!loginPage.startsWith("/")) { loginPage = "/" + loginPage; } Faces.getSession().invalidate(); ExternalContext ec = Faces.getExternalContext(); ec.redirect(ec.getRequestContextPath() + loginPage); }
Example #4
Source File: LayoutMB.java From admin-template with MIT License | 5 votes |
private boolean templateExists(String templateName) { try { return Faces.getExternalContext().getResourceAsStream(templateName) != null; } catch (Exception e) { LOG.warning(String.format("Could not find application defined template in path '%s' due to following error: %s. Falling back to default admin template. See application template documentation for more details: https://github.com/adminfaces/admin-template#application-template", APP_TEMPLATE_PATH, e.getMessage())); return false; } }
Example #5
Source File: BreadCrumbMB.java From admin-template with MIT License | 5 votes |
public void clearAndHome() { clear(); try { AdminUtils.redirect(Faces.getRequestBaseURL()); } catch (Exception e) { //see issue #177 Logger.getLogger(getClass().getName()).log(Level.SEVERE,"Could not redirect to Home page.",e); } }
Example #6
Source File: LogoutServlet.java From admin-template with MIT License | 4 votes |
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { Faces.getSession().invalidate(); ExternalContext ec = Faces.getExternalContext(); ec.redirect(ec.getRequestContextPath() + getLoginPage()); }
Example #7
Source File: CreditCardInvoiceBean.java From web-budget with GNU General Public License v3.0 | 2 votes |
/** * Navigate to the print page * * @return the outcome to the print page */ public String changeToPrintInvoice() { Faces.setFlashAttribute("creditCardInvoice", this.invoice); return NavigationManager.to("cardInvoicePrint.xhtml"); }
Example #8
Source File: CreditCardInvoiceBean.java From web-budget with GNU General Public License v3.0 | 2 votes |
/** * Navigate to the print page * * @return the outcome to the print page */ public String changeToPrintInvoice() { Faces.setFlashAttribute("creditCardInvoice", this.invoice); return NavigationManager.to("cardInvoicePrint.xhtml"); }