本文整理汇总了Java中com.vaadin.server.VaadinRequest.getWrappedSession方法的典型用法代码示例。如果您正苦于以下问题:Java VaadinRequest.getWrappedSession方法的具体用法?Java VaadinRequest.getWrappedSession怎么用?Java VaadinRequest.getWrappedSession使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.server.VaadinRequest
的用法示例。
在下文中一共展示了VaadinRequest.getWrappedSession方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processExternalLink
import com.vaadin.server.VaadinRequest; //导入方法依赖的package包/类
public void processExternalLink(VaadinRequest request) {
WrappedSession wrappedSession = request.getWrappedSession();
String action = (String) wrappedSession.getAttribute(LAST_REQUEST_ACTION_ATTR);
if (webConfig.getLinkHandlerActions().contains(action)) {
//noinspection unchecked
Map<String, String> params =
(Map<String, String>) wrappedSession.getAttribute(LAST_REQUEST_PARAMS_ATTR);
params = params != null ? params : Collections.emptyMap();
try {
LinkHandler linkHandler = AppBeans.getPrototype(LinkHandler.NAME, app, action, params);
if (app.connection.isConnected() && linkHandler.canHandleLink()) {
linkHandler.handle();
} else {
app.linkHandler = linkHandler;
}
} catch (Exception e) {
error(new com.vaadin.server.ErrorEvent(e));
}
}
}
示例2: init
import com.vaadin.server.VaadinRequest; //导入方法依赖的package包/类
@Override
public void init(VaadinRequest request) {
final WrappedSession session = request.getWrappedSession();
final VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
parent.setContent(layout);
Button button = new Button("Click Me");
button.addClickListener(new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
Integer counter = (Integer)session.getAttribute("counter");
if (counter == null) { counter = 0; }
counter++;
session.setAttribute("counter", counter);
layout.addComponent(new Label("Thank you for clicking, counter:" + counter));
}
});
layout.addComponent(button);
}
示例3: initializeLocale
import com.vaadin.server.VaadinRequest; //导入方法依赖的package包/类
public static void initializeLocale(VaadinRequest request) {
WrappedSession session = request.getWrappedSession();
HttpSession httpSession = ((WrappedHttpSession) session).getHttpSession();
ServletContext servletContext = httpSession.getServletContext();
String defaultLanguage = servletContext.getInitParameter(LOCALE_CONFIG_DEFAULT_LANGUAGE);
defaultLocale = new Locale(defaultLanguage);
String language = request.getParameter(LOCALE_PARAM_LANGUAGE);
if (null == language) {
currentLocale = defaultLocale;
} else {
currentLocale = new Locale(language);
}
Messages.initMessageSource(currentLocale);
}
示例4: processExternalLink
import com.vaadin.server.VaadinRequest; //导入方法依赖的package包/类
@Override
public void processExternalLink(VaadinRequest request) {
WrappedSession wrappedSession = request.getWrappedSession();
String action = (String) wrappedSession.getAttribute(LAST_REQUEST_ACTION_ATTR);
if (NexbitLinkHandler.RESET_ACTION.equals(action)) {
//noinspection unchecked
Map<String, String> params =
(Map<String, String>) wrappedSession.getAttribute(LAST_REQUEST_PARAMS_ATTR);
if (params == null) {
log.warn("Unable to process the external link: lastRequestParams not found in session");
return;
}
try {
LinkHandler linkHandler = AppBeans.getPrototype(LinkHandler.NAME, app, action, params);
if (((NexbitLinkHandler)linkHandler).canHandleLink(action, params)) {
linkHandler.handle();
wrappedSession.setAttribute(LAST_REQUEST_ACTION_ATTR, null);
return;
}
} catch (Exception e) {
error(new com.vaadin.server.ErrorEvent(e));
}
}
super.processExternalLink(request);
}
示例5: initializeEnvironment
import com.vaadin.server.VaadinRequest; //导入方法依赖的package包/类
private void initializeEnvironment(VaadinRequest request) {
session = request.getWrappedSession(true);
if (session.getAttribute("e") == null) {
session.setAttribute("e", new Environment());
System.out.println("Created new environment for session " + session.getId());
}
else {
System.out.println("Resumed existing environment for session " + session.getId());
}
}
示例6: onRequestStart
import com.vaadin.server.VaadinRequest; //导入方法依赖的package包/类
@Override
public void onRequestStart(VaadinRequest request, VaadinResponse response) {
final WrappedSession wrappedSession = request.getWrappedSession(false);
VaadinSession session = null;
if (wrappedSession != null) {
session = VaadinSession.getForSession(request.getService(), wrappedSession);
}
SecurityContextHolder.clearContext();
if (session != null) {
logger.trace("Loading security context from VaadinSession {}", session);
SecurityContext securityContext;
session.lock();
try {
securityContext = (SecurityContext) session.getAttribute(SECURITY_CONTEXT_SESSION_ATTRIBUTE);
} finally {
session.unlock();
}
if (securityContext == null) {
logger.trace("No security context found in VaadinSession {}", session);
} else {
logger.trace("Setting security context to {}", securityContext);
SecurityContextHolder.setContext(securityContext);
}
} else {
logger.trace("No VaadinSession available for retrieving the security context");
}
}
示例7: initializePlugins
import com.vaadin.server.VaadinRequest; //导入方法依赖的package包/类
private void initializePlugins(VaadinRequest request) {
WrappedSession session = request.getWrappedSession();
HttpSession httpSession = ((WrappedHttpSession) session).getHttpSession();
ServletContext servletContext = httpSession.getServletContext();
String configFileName = servletContext.getInitParameter(PluginManager.PLUGIN_CONFIG_LOCATION);
if (configFileName != null && configFileName.length() > 0) {
configFileName = servletContext.getRealPath(configFileName);
File configFile = new File(configFileName);
PluginManager.get().initializeFromFile(configFile);
}
}
示例8: init
import com.vaadin.server.VaadinRequest; //导入方法依赖的package包/类
@Override
protected void init(VaadinRequest request) {
// Set the window or tab title
getPage().setTitle("Academic Curricula Design and Management System (ACaDeM)");
// Obtener la sesión del usuario (HTTPSession)
this.httpSession = request.getWrappedSession();
// Inicializar controladores
ControladorInicioSesion.getInstance().setAcademUI(this);
ControladorAdministrador.getInstance().setAcademUI(this);
ControladorEvaluador.getInstance().setAcademUI(this);
ControladorPropietario.getInstance().setAcademUI(this);
ControladorEvaluaciones.getInstance().setAcademUI(this);
final GridLayout layout = new GridLayout(1, 4);
layout.setMargin(true);
//layout.setHeight("100%");
layout.setSizeFull();
// ENCABEZADO
this.panelEncabezado = new PanelEncabezado();
layout.addComponent(this.panelEncabezado, 0, 0);
// HERRAMIENTAS
this.panelHerramientas = new PanelHerramientas();
layout.addComponent(this.panelHerramientas, 0, 1);
// Agregar herramientas a la barra de herramientas
this.panelSesion = new PanelSesion();
// Se muestra una vez el usuario inicia sesión.
this.panelSesion.setVisible(false);
this.panelHerramientas.agregarHerramienta(this.panelSesion, "top:0.0px;left:0.0px");
// CONTENIDO
this.panelContenido = new PanelContenido();
layout.addComponent(this.panelContenido, 0, 2);
// Cuando inicia la aplicación se muestra el formulario de login.
this.formularioInicioSesion = new FormularioInicioSesion();
this.panelContenido.setContenido(this.formularioInicioSesion);
// Panel de opciones
this.panelOpciones = new PanelOpciones();
// PIE DE PÁGINA
this.panelPieDePagina = new PanelPieDePagina();
layout.addComponent(this.panelPieDePagina, 0, 3);
setContent(layout);
}
示例9: init
import com.vaadin.server.VaadinRequest; //导入方法依赖的package包/类
@Override
protected void init(VaadinRequest request) {
// Set the window or tab title
getPage().setTitle("Academic Curricula Design and Management System (ACaDeM)");
// Obtener la sesión del usuario (HTTPSession)
this.httpSession = request.getWrappedSession();
// Inicializar controladores
ControladorInicioSesion.getInstance().setAcademUI(this);
ControladorAdministrador.getInstance().setAcademUI(this);
ControladorEvaluador.getInstance().setAcademUI(this);
ControladorPropietario.getInstance().setAcademUI(this);
ControladorEvaluaciones.getInstance().setAcademUI(this);
final GridLayout layout = new GridLayout(1, 4);
layout.setMargin(true);
//layout.setHeight("100%");
layout.setSizeFull();
// ENCABEZADO
this.panelEncabezado = new PanelEncabezado();
layout.addComponent(this.panelEncabezado, 0, 0);
// HERRAMIENTAS
this.panelHerramientas = new PanelHerramientas();
layout.addComponent(this.panelHerramientas, 0, 1);
// Agregar herramientas a la barra de herramientas
this.panelSesion = new PanelSesion();
// Se muestra una vez el usuario inicia sesión.
this.panelSesion.setVisible(false);
this.panelHerramientas.agregarHerramienta(this.panelSesion, "top:0.0px;left:0.0px");
// CONTENIDO
this.panelContenido = new PanelContenido();
this.panelContenido.setImmediate(true);
layout.addComponent(this.panelContenido, 0, 2);
// Cuando inicia la aplicación se muestra el formulario de login.
this.formularioInicioSesion = new FormularioInicioSesion();
this.panelContenido.setContenido(this.formularioInicioSesion);
// this.ventanaBloqueMaterias = new VentanaBloqueMaterias();
// this.panelContenido.setContenido(this.formularioInicioSesion);
// Panel de opciones
System.out.println("LLega a panel opciones");
this.panelOpciones = new PanelOpciones();
System.out.println("Lo crea");
// PIE DE PÁGINA
this.panelPieDePagina = new PanelPieDePagina();
layout.addComponent(this.panelPieDePagina, 0, 3);
setContent(layout);
}