blob: 98c03238c0146bea950c74d65ed857640171110b [file] [log] [blame]
/**
* Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Florian Pirchner - Initial implementation
*/
package org.eclipse.osbp.runtime.web.common;
import java.util.Locale;
import org.eclipse.osbp.runtime.common.dispose.IDisposable;
import org.eclipse.osbp.runtime.common.user.IUserInfo;
// TODO: Auto-generated Javadoc
/**
* A web context is an object that offers access to features that are related
* with a browser tab. One http sessoin may have many web contexts. The web
* context is attached to the current thread as far as a request is processed by
* the http servlet. For concurrent threads no web context is attached to them.
* So concurrent threads have to query the web context and use the sync-methods
* to run a runnable in a web context.
* <p>
* To dispose a web context call {@link #dispose()}.
*/
public interface IWebContext extends IDisposable {
/**
* Returns the unique id of the web context.
*
* @return the id
*/
String getId();
/**
* Returns the i18n service configured with the settings of that context.
* For instance the locale of the context will be used to return the proper
* i18n service.
*
*/
// TODO: check the definition and the description - this returns nothing
void getI18nService();
/**
* Returns the locale of that context.
*
* @return the locale
*/
Locale getLocale();
/**
* Returns the user info this context is assigned to. Never
* <code>null</code>.
*
* @return the user info
*/
IUserInfo getUserInfo();
/**
* Returns the value for the given property or <code>null</code> if the
* value is not available.
*
* @param property
* the property
* @return the property
*/
Object getProperty(String property);
/**
* Executes the given runnable in the context of that web context. Therefore
* it will sync with the web environment before executing the runnable.
*
* @param runnable
* the runnable
*/
public void syncExec(Runnable runnable);
/**
* Executes the given runnable in the context of that web context in an
* async mode. Therefore it will sync with the web environment before
* executing the runnable.
*
* @param runnable
* the runnable
*/
public void asyncExec(Runnable runnable);
}