List of usage examples for org.apache.wicket Session bind
public final void bind()
From source file:com.servoy.j2db.server.headlessclient.WebClientsApplication.java
License:Open Source License
@SuppressWarnings("nls") @Override//from w w w.jav a 2 s . c om public synchronized Session newSession(Request request, Response response) { ISessionStore sessionStore = getSessionStore(); Session session = sessionStore.lookup(request); if (session == null) { IWebClientSessionFactory webClientSessionFactory = ApplicationServerRegistry.get() .getWebClientSessionFactory(); if (webClientSessionFactory == null) { throw new IllegalStateException("Server was not started for web client usage"); } session = webClientSessionFactory.newSession(request, response); session.bind(); } return session; }
From source file:fiftyfive.wicket.shiro.ShiroWicketPlugin.java
License:Apache License
/** * Invoked by {@code ShiroWicketPlugin} when an anonymous or remembered user has tried to * access a page that requires authentication. The default implementation places a * "you need to be logged in to continue" feedback message in the session. * To override or localize this message, * define {@code loginRequired} in your application properties. You can disable the * message entirely by defining {@code loginRequired} as an empty string. *///w ww . j ava2 s.c o m public void onLoginRequired() { String message = getLocalizedMessage(LOGIN_REQUIRED_MESSAGE_KEY, "You need to be logged in to continue."); if (message != null && !message.matches("^\\s*$")) { // We need a new session because otherwise our feedback message won't "stick". Session session = Session.get(); session.bind(); // Add localized "you have been logged out" message to session session.info(message); } }
From source file:fiftyfive.wicket.shiro.ShiroWicketPlugin.java
License:Apache License
/** * Invoked by {@code ShiroWicketPlugin} when the user has tried to access a page * but lacks the necessary role or permission. The default implementation places a * "sorry, you are not allowed to access that page" feedback message in the session. * To override or localize this message, * define {@code unauthorized} in your application properties. You can disable the * message entirely by defining {@code unauthorized} as an empty string. *//*from ww w. j a v a2 s .c o m*/ public void onUnauthorized() { String message = getLocalizedMessage(UNAUTHORIZED_MESSAGE_KEY, "Sorry, you are not allowed to access that page."); if (message != null && !message.matches("^\\s*$")) { // We need a new session because otherwise our feedback message won't "stick". Session session = Session.get(); session.bind(); // Add localized "sorry, you are not allowed to access that page" message to session session.error(message); } }
From source file:guru.mmp.application.web.WebApplication.java
License:Apache License
/** * Creates a new session.// www.jav a 2s .co m * * @param request the request that will create this session * @param response the response to initialise, for example with cookies * * @return the new session */ @Override public Session newSession(Request request, Response response) { Session session = new WebSession(request); session.bind(); return session; }
From source file:lt.inventi.wicket.shiro.ShiroWicketPlugin.java
License:Apache License
/** * Invoked by {@code ShiroWicketPlugin} when an anonymous or remembered user * has tried to access a page that requires authentication. The default * implementation places a "you need to be logged in to continue" feedback * message in the session. To override or localize this message, define * {@code loginRequired} in your application properties. *//*from ww w.j av a2s.co m*/ public void onLoginRequired() { if (showLoginRequiredMessage) { String message = getLocalizedMessage(LOGIN_REQUIRED_MESSAGE_KEY, "You need to be logged in to continue."); if (message != null && !message.matches("^\\s*$")) { // We need a new session because otherwise our feedback message won't "stick". Session session = Session.get(); session.bind(); // Add localized "you have been logged out" message to session session.info(message); } } }
From source file:org.qi4j.sample.dcicargo.sample_a.infrastructure.wicket.prevnext.PrevNext.java
License:Apache License
public static void registerIds(Session session, ArrayList<String> ids) { if (ids == null || ids.isEmpty()) { throw new RuntimeException("Please register a list of ids."); }// w w w. j a va 2 s.c o m session.setMetaData(PREV_NEXT_PANEL_KEY, ids); session.bind(); }
From source file:org.qi4j.sample.dcicargo.sample_a.infrastructure.wicket.prevnext.PrevNext.java
License:Apache License
public static void addId(Session session, String id) { if (id == null || id.isEmpty()) { throw new RuntimeException("Can't register empty id."); }/*w w w .j av a2s . c o m*/ ArrayList<String> ids = session.getMetaData(PREV_NEXT_PANEL_KEY); if (ids == null || ids.isEmpty()) { ids = new ArrayList<String>(); } ids.add(id); session.setMetaData(PREV_NEXT_PANEL_KEY, ids); session.bind(); }