use of com.vaadin.server.WrappedSession in project cuba by cuba-platform.
the class AppUI method processExternalLink.
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));
}
}
}
use of com.vaadin.server.WrappedSession in project ANNIS by korpling.
the class Helper method getUser.
public static AnnisUser getUser() {
VaadinSession vSession = VaadinSession.getCurrent();
WrappedSession wrappedSession = null;
if (vSession != null) {
wrappedSession = vSession.getSession();
}
if (wrappedSession != null) {
Object o = VaadinSession.getCurrent().getSession().getAttribute(AnnisBaseUI.USER_KEY);
if (o != null && o instanceof AnnisUser) {
return (AnnisUser) o;
}
}
return null;
}
use of com.vaadin.server.WrappedSession in project cuba by cuba-platform.
the class LinkHandler method handle.
/**
* Called to handle the link.
*/
public void handle() {
try {
ExternalLinkContext linkContext = new ExternalLinkContext(requestParams, action, app);
for (LinkHandlerProcessor processor : processors) {
if (processor.canHandle(linkContext)) {
processor.handle(linkContext);
break;
}
}
} finally {
VaadinRequest request = VaadinService.getCurrentRequest();
WrappedSession wrappedSession = request.getWrappedSession();
wrappedSession.removeAttribute(AppUI.LAST_REQUEST_PARAMS_ATTR);
wrappedSession.removeAttribute(AppUI.LAST_REQUEST_ACTION_ATTR);
}
}
use of com.vaadin.server.WrappedSession in project linkki by linkki-framework.
the class DynamicFieldUI method getCarStorage.
// some fake persistent storage
// store the cars in the session so it is available after a browser
// refresh as long as we are in the same session
private List<Car> getCarStorage() {
List<Car> carStorage;
WrappedSession session = CurrentInstance.get(VaadinSession.class).getSession();
@SuppressWarnings("unchecked") List<Car> storage = (List<Car>) session.getAttribute(CAR_STORAGE_ATTRIBUTE);
if (storage != null) {
carStorage = storage;
} else {
carStorage = new ArrayList<>();
addCars(carStorage);
session.setAttribute(CAR_STORAGE_ATTRIBUTE, carStorage);
}
return carStorage;
}
use of com.vaadin.server.WrappedSession in project VaadinUtils by rlsutton1.
the class JasperManager method exportAsync.
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();
}
Aggregations