本文整理汇总了Java中com.vaadin.server.WrappedSession.setAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java WrappedSession.setAttribute方法的具体用法?Java WrappedSession.setAttribute怎么用?Java WrappedSession.setAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.server.WrappedSession
的用法示例。
在下文中一共展示了WrappedSession.setAttribute方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processExternalLink
import com.vaadin.server.WrappedSession; //导入方法依赖的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);
}
示例2: login
import com.vaadin.server.WrappedSession; //导入方法依赖的package包/类
@Override
public Authentication login(Authentication authentication, boolean rememberMe) throws Exception {
final HttpServletRequest request = new RememberMeRequestWrapper(getCurrentRequest(), rememberMe,
getRememberMeParameter());
final HttpServletResponse response = getCurrentResponse();
try {
LOGGER.debug("Attempting authentication of {}, rememberMe = {}", authentication, rememberMe);
final Authentication fullyAuthenticated = getAuthenticationManager().authenticate(authentication);
LOGGER.debug("Invoking session authentication strategy");
sessionAuthenticationStrategy.onAuthentication(fullyAuthenticated, request, response);
successfulAuthentication(fullyAuthenticated, request, response);
return fullyAuthenticated;
} catch (Exception e) {
unsuccessfulAuthentication(request, response);
throw e;
} finally {
if (saveContextInSessionAfterLogin) {
LOGGER.debug("Saving security context in the session");
WrappedSession session = getSession();
if (session != null) {
session.setAttribute(springSecurityContextKey, SecurityContextHolder.getContext());
} else {
LOGGER.warn(
"Tried to save security context in the session, but no session was bound to the current thread");
}
}
}
}
示例3: exportAsync
import com.vaadin.server.WrappedSession; //导入方法依赖的package包/类
public void exportAsync(OutputFormat exportMethod, Collection<ReportParameter<?>> params,
JasperProgressListener progressListener)
{
if (params == null)
{
params = new LinkedList<>();
}
this.params = params;
images = new ConcurrentHashMap<>();
if (UI.getCurrent() != null)
{
WrappedSession session = UI.getCurrent().getSession().getSession();
session.setAttribute(VaadinJasperPrintServlet.IMAGES_MAP, images);
}
else
{
logger.warn("No vaadin UI present");
}
stop = false;
writerReady = new CountDownLatch(1);
completeBarrier = new CountDownLatch(1);
readerReady = new CountDownLatch(1);
this.progressListener = progressListener;
if (progressListener == null)
{
this.progressListener = new JasperProgressListener()
{
@Override
public void failed(String string)
{
// noop
}
@Override
public void completed()
{
// noop
}
@Override
public void outputStreamReady()
{
// noop
}
};
}
inputStream = null;
outputStream = null;
queueEntry = new QueueEntry(reportProperties.getReportTitle(), reportProperties.getUsername());
inQueue = true;
jobQueue.add(queueEntry);
this.exportMethod = exportMethod;
thread = new Thread(this, "JasperManager");
thread.start();
}