本文整理匯總了Java中org.apache.wicket.Application.get方法的典型用法代碼示例。如果您正苦於以下問題:Java Application.get方法的具體用法?Java Application.get怎麽用?Java Application.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.wicket.Application
的用法示例。
在下文中一共展示了Application.get方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getWebSocketConnection
import org.apache.wicket.Application; //導入方法依賴的package包/類
public static IWebSocketConnection getWebSocketConnection(WebSocketInfo wsinfo)
{
IWebSocketConnection connection = null;
if (wsinfo != null)
{
Application application = Application.get(wsinfo.getApplicationName());
WebSocketSettings settings = WebSocketSettings.Holder.get(application);
connection = settings.getConnectionRegistry().getConnection(application, wsinfo.getSessionId(), wsinfo.getKey());
if (connection == null)
{
LOG.error("WebSocket connection is lost");
}
}
else
{
LOG.error("WebSocket client is unknown");
}
return connection;
}
示例2: get
import org.apache.wicket.Application; //導入方法依賴的package包/類
/**
* Retrieves the instance of settings object.
*
* @return settings instance
*/
public static DashboardSettings get() {
Application application = Application.get();
DashboardSettings settings = application.getMetaData(KEY);
if (settings == null) {
synchronized (application) {
settings = application.getMetaData(KEY);
if (settings == null) {
settings = new DashboardSettings();
application.setMetaData(KEY, settings);
}
}
}
return application.getMetaData(KEY);
}
示例3: getLimit
import org.apache.wicket.Application; //導入方法依賴的package包/類
/**
* Determines a limit to use for HTML diff output.
*
* @param key
* to use to read the value from the GitBlit settings, if available.
* @param minimum
* minimum value to enforce
* @param maximum
* maximum (and default) value to enforce
* @return the limit
*/
private int getLimit(String key, int minimum, int maximum) {
if (Application.exists()) {
Application application = Application.get();
if (application instanceof GitBlitWebApp) {
GitBlitWebApp webApp = (GitBlitWebApp) application;
int configValue = webApp.settings().getInteger(key, maximum);
if (configValue < minimum) {
return minimum;
} else if (configValue < maximum) {
return configValue;
}
}
}
return maximum;
}
示例4: internalMap
import org.apache.wicket.Application; //導入方法依賴的package包/類
private IRequestHandler internalMap(Exception e) {
final Application application = Application.get();
// check if we are processing an Ajax request and if we want to invoke the failure handler
if (isAjaxRequest() && shouldInvokeClientSideFailureHandler(application)) {
return new ErrorCodeRequestHandler(INTERNAL_SERVER_ERROR);
}
if (e instanceof StalePageException) {
// If the page was stale, just re-render it (the url should always be updated by an redirect in that case)
return new RenderPageRequestHandler(new PageProvider(((StalePageException) e).getPage()));
} else if (e instanceof PageExpiredException) {
return createPageRequestHandler(application.getApplicationSettings().getPageExpiredErrorPage());
} else if (e instanceof AuthorizationException || e instanceof ListenerInvocationNotAllowedException) {
return createPageRequestHandler(application.getApplicationSettings().getAccessDeniedPage());
} else if (e instanceof ResponseIOException) {
LOG.error("Connection lost, give up responding.", e);
return new EmptyRequestHandler();
} else
if (e instanceof PackageResource.PackageResourceBlockedException && application.usesDeploymentConfig()) {
LOG.debug(e.getMessage(), e);
return new ErrorCodeRequestHandler(NOT_FOUND);
}
return mapUnexpectedException(e);
}
示例5: mapUnexpectedException
import org.apache.wicket.Application; //導入方法依賴的package包/類
private IRequestHandler mapUnexpectedException(Exception e) {
LOG.error("{}: An unexpected error occurred", getExceptionId(e), e);
Application application = Application.get();
IExceptionSettings.UnexpectedExceptionDisplay display =
application.getExceptionSettings().getUnexpectedExceptionDisplay();
if (IExceptionSettings.SHOW_EXCEPTION_PAGE.equals(display)) {
return createPageRequestHandler(createExceptionDisplayPageProvider(e));
} else if (IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE.equals(display)) {
return createPageRequestHandler(application.getApplicationSettings().getInternalErrorPage());
} else {
// IExceptionSettings.SHOW_NO_EXCEPTION_PAGE
return new ErrorCodeRequestHandler(INTERNAL_SERVER_ERROR);
}
}
示例6: get
import org.apache.wicket.Application; //導入方法依賴的package包/類
/**
* Retrieves the instance of settings object.
*
* @return settings instance
*/
public static ApplicationSettings get() {
// FIXME Application should provide setMetadataIfAbsent()
Application application = Application.get();
ApplicationSettings settings = application.getMetaData(KEY);
if (settings == null) {
synchronized (application) {
settings = application.getMetaData(KEY);
if (settings == null) {
settings = new ApplicationSettings();
application.setMetaData(KEY, settings);
}
}
}
return application.getMetaData(KEY);
}
示例7: pushJsonWebSocketMessage
import org.apache.wicket.Application; //導入方法依賴的package包/類
public void pushJsonWebSocketMessage(String json) {
Application application = Application.get();
WebSocketSettings settings = WebSocketSettings.Holder.get(application);
IWebSocketConnectionRegistry registry = settings.getConnectionRegistry();
IWebSocketConnection connection = registry.getConnection(application, webSocketSessionId, webSocketClientKey);
if (connection == null) {
logger.warn("websocket client lookup failed for web-socket session: {}", webSocketSessionId);
return;
}
try {
connection.sendMessage(json);
} catch (Exception e) {
logger.error("websocket push failed", e);
}
}
示例8: get
import org.apache.wicket.Application; //導入方法依賴的package包/類
public static BasicApplicationApplication get() {
final Application application = Application.get();
if (application instanceof BasicApplicationApplication) {
return (BasicApplicationApplication) application;
}
throw new WicketRuntimeException("There is no BasicApplicationApplication attached to current thread " +
Thread.currentThread().getName());
}
示例9: get
import org.apache.wicket.Application; //導入方法依賴的package包/類
public static ShowcaseApplication get() {
final Application application = Application.get();
if (application instanceof ShowcaseApplication) {
return (ShowcaseApplication) application;
}
throw new WicketRuntimeException("There is no ShowcaseApplication attached to current thread " +
Thread.currentThread().getName());
}
示例10: get
import org.apache.wicket.Application; //導入方法依賴的package包/類
public static CoreWicketAuthenticatedApplication get() {
final Application application = Application.get();
if (application instanceof CoreWicketAuthenticatedApplication) {
return (CoreWicketAuthenticatedApplication) application;
}
throw new WicketRuntimeException("There is no CoreWicketAuthenticatedApplication attached to current thread " +
Thread.currentThread().getName());
}
示例11: get
import org.apache.wicket.Application; //導入方法依賴的package包/類
public static CoreWicketApplication get() {
final Application application = Application.get();
if (application instanceof CoreWicketApplication) {
return (CoreWicketApplication) application;
}
throw new WicketRuntimeException("There is no CoreWicketApplication attached to current thread " +
Thread.currentThread().getName());
}
示例12: destroyApplication
import org.apache.wicket.Application; //導入方法依賴的package包/類
public static void destroyApplication() {
WebApplication app = (WebApplication)Application.get(getWicketApplicationName());
WebApplicationContext ctx = getWebApplicationContext(app.getServletContext());
app.internalDestroy(); //need to be called to
if (ctx != null) {
((XmlWebApplicationContext)ctx).destroy();
}
ThreadContext.setApplication(null);
ThreadContext.setRequestCycle(null);
ThreadContext.setSession(null);
}
示例13: send
import org.apache.wicket.Application; //導入方法依賴的package包/類
@Override
public void send(IWebSocketPushMessage event) {
Application application = Application.get(WicketWebInitializer.WICKET_FILTERNAME);
WebSocketSettings webSocketSettings = WebSocketSettings.Holder.get(application);
IWebSocketConnectionRegistry connectionRegistry = webSocketSettings.getConnectionRegistry();
Collection<IWebSocketConnection> connections = connectionRegistry.getConnections(application);
log.trace("sending event to {} connections", connections.size());
for (IWebSocketConnection connection : connections) {
connection.sendMessage(event);
}
}
示例14: valueUnbound
import org.apache.wicket.Application; //導入方法依賴的package包/類
/**
* @see javax.servlet.http.HttpSessionBindingListener#valueUnbound(javax.servlet.http.HttpSessionBindingEvent)
*/
@Override
public void valueUnbound(final HttpSessionBindingEvent evt)
{
String sessionId = evt.getSession().getId();
log.debug("Session unbound: {}", sessionId);
if (wicketSession != null)
{
wicketSession.onInvalidate();
}
Application application = Application.get(applicationKey);
if (application == null)
{
log.debug("Wicket application with name '{}' not found.", applicationKey);
return;
}
ISessionStore sessionStore = application.getSessionStore();
if (sessionStore != null)
{
if (sessionStore instanceof HttpSessionStore)
{
((RedisSessionStore) sessionStore).onUnbind(sessionId);
}
for (UnboundListener listener : sessionStore.getUnboundListener())
{
listener.sessionUnbound(sessionId);
}
}
}
示例15: rebuildSiteMap
import org.apache.wicket.Application; //導入方法依賴的package包/類
@Override
public void rebuildSiteMap() {
// get the first application key (in aol it will not work!)
ArtifactoryApplication app = (ArtifactoryApplication) Application.get(
Application.getApplicationKeys().iterator().next());
// we must attach the application to the current thread in order to perform wicket operation
ThreadContext.setApplication(app);
try {
app.rebuildSiteMap();
} finally {
ThreadContext.detach();
}
}