當前位置: 首頁>>代碼示例>>Java>>正文


Java Application類代碼示例

本文整理匯總了Java中org.apache.wicket.Application的典型用法代碼示例。如果您正苦於以下問題:Java Application類的具體用法?Java Application怎麽用?Java Application使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Application類屬於org.apache.wicket包,在下文中一共展示了Application類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getConnection

import org.apache.wicket.Application; //導入依賴的package包/類
@Override
public IWebSocketConnection getConnection(Application application, String sessionId, IKey key)
{
	Args.notNull(application, "application");
	Args.notNull(sessionId, "sessionId");
	Args.notNull(key, "key");

	IWebSocketConnection connection = null;
	ConcurrentMap<String, ConcurrentMap<IKey, IWebSocketConnection>> connectionsBySession = application.getMetaData(KEY);
	if (connectionsBySession != null)
	{
		ConcurrentMap<IKey, IWebSocketConnection> connectionsByPage = connectionsBySession.get(sessionId);
		if (connectionsByPage != null)
		{
			connection = connectionsByPage.get(key);
		}
	}
	return connection;
}
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:20,代碼來源:SimpleWebSocketConnectionRegistry.java

示例2: getConnections

import org.apache.wicket.Application; //導入依賴的package包/類
@Override
public Collection<IWebSocketConnection> getConnections(Application application, String sessionId)
{
	Args.notNull(application, "application");
	Args.notNull(sessionId, "sessionId");

	Collection<IWebSocketConnection> connections = Collections.emptyList();
	ConcurrentMap<String, ConcurrentMap<IKey, IWebSocketConnection>> connectionsBySession = application.getMetaData(KEY);
	if (connectionsBySession != null)
	{
		ConcurrentMap<IKey, IWebSocketConnection> connectionsByPage = connectionsBySession.get(sessionId);
		if (connectionsByPage != null)
		{
			connections = connectionsByPage.values();
		}
	}
	return connections;
}
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:19,代碼來源:SimpleWebSocketConnectionRegistry.java

示例3: getExceptionMapperProvider

import org.apache.wicket.Application; //導入依賴的package包/類
@Override
public final IProvider<IExceptionMapper> getExceptionMapperProvider() {
	return new IProvider<IExceptionMapper>() {

		@Override
		public IExceptionMapper get() {
			return new DefaultExceptionMapper() {

				@Override
				protected IRequestHandler mapExpectedExceptions(Exception e, Application application) {
					Page errorPage = mapExceptions(e);
					if (errorPage != null) {
						return createPageRequestHandler(new PageProvider(errorPage));
					} else {
						return super.mapExpectedExceptions(e, application);
					}
				}
				
			};
		}
		
	};
}
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:24,代碼來源:GitPlexWebApplication.java

示例4: getResources

import org.apache.wicket.Application; //導入依賴的package包/類
@Override
public Iterator<URL> getResources(final String name) {
    Set<URL> resultSet = new TreeSet<>(new UrlExternalFormComparator());

    try {
        // Try the classloader for the wicket jar/bundle
        Enumeration<URL> resources = Application.class.getClassLoader().getResources(name);
        loadResources(resources, resultSet);

        // Try the classloader for the user's application jar/bundle
        resources = Application.get().getClass().getClassLoader().getResources(name);
        loadResources(resources, resultSet);

        // Try the context class loader
        resources = getClassLoader().getResources(name);
        loadResources(resources, resultSet);
    } catch (Exception e) {
        throw new WicketRuntimeException(e);
    }

    return resultSet.iterator();
}
 
開發者ID:PkayJava,項目名稱:MBaaS,代碼行數:23,代碼來源:ClassResolver.java

示例5: respond

import org.apache.wicket.Application; //導入依賴的package包/類
@Override
public void respond(IRequestCycle requestCycle) {
    String script = ToastrHelper.generateJs(singularException, ToastrType.ERROR, false);

    WebResponse response = (WebResponse)requestCycle.getResponse();
    final String encoding = Application.get()
            .getRequestCycleSettings()
            .getResponseRequestEncoding();

    // Set content type based on markup type for page
    response.setContentType("text/xml; charset=" + encoding);

    // Make sure it is not cached by a client
    response.disableCaching();

    response.write("<?xml version=\"1.0\" encoding=\"");
    response.write(encoding);
    response.write("\"?>");
    response.write("<ajax-response>");
    response.write("<evaluate><![CDATA[" + script + "]]></evaluate>");
    response.write("</ajax-response>");

}
 
開發者ID:opensingular,項目名稱:singular-server,代碼行數:24,代碼來源:AjaxErrorRequestHandler.java

示例6: sendAll

import org.apache.wicket.Application; //導入依賴的package包/類
private static void sendAll(final String m, boolean publish) {
	if (publish) {
		publish(new WsMessageAll(m));
	}
	Application app = (Application)getApp();
	WebSocketSettings settings = WebSocketSettings.Holder.get(app);
	IWebSocketConnectionRegistry reg = settings.getConnectionRegistry();
	Executor executor = settings.getWebSocketPushMessageExecutor();
	for (IWebSocketConnection c : reg.getConnections(app)) {
		executor.run(() -> {
			try {
				c.sendMessage(m);
			} catch (IOException e) {
				log.error("Error while sending message to ALL", e);
			}
		});
	}
}
 
開發者ID:apache,項目名稱:openmeetings,代碼行數:19,代碼來源:WebSocketHelper.java

示例7: send

import org.apache.wicket.Application; //導入依賴的package包/類
private static void send(
		final Function<Application, List<Client>> func
		, BiConsumer<IWebSocketConnection, Client> consumer
		, Predicate<Client> check)
{
	Application app = (Application)getApp();
	WebSocketSettings settings = WebSocketSettings.Holder.get(app);
	IWebSocketConnectionRegistry reg = settings.getConnectionRegistry();
	Executor executor = settings.getWebSocketPushMessageExecutor();
	for (Client c : func.apply(app)) {
		if (check == null || check.test(c)) {
			final IWebSocketConnection wc = reg.getConnection(app, c.getSessionId(), new PageIdKey(c.getPageId()));
			if (wc != null && wc.isOpen()) {
				executor.run(() -> consumer.accept(wc, c));
			}
		}
	}
}
 
開發者ID:apache,項目名稱:openmeetings,代碼行數:19,代碼來源:WebSocketHelper.java

示例8: 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;
}
 
開發者ID:sebfz1,項目名稱:wicket-quickstart-cdi-async,代碼行數:24,代碼來源:MySession.java

示例9: bind

import org.apache.wicket.Application; //導入依賴的package包/類
@Override
public void bind(Request request, Session newSession)
{
	if (getAttribute(request, Session.SESSION_ATTRIBUTE_NAME) != newSession)
	{
		// call template method
		onBind(request, newSession);
		for (BindListener listener : getBindListeners())
		{
			listener.bindingSession(request, newSession);
		}

		HttpSession httpSession = getHttpSession(request, false);

		if (httpSession != null)
		{
			// register an unbinding listener for cleaning up
			String applicationKey = Application.get().getName();
			httpSession.setAttribute("Wicket:SessionUnbindingListener-" + applicationKey,
				new SessionBindingListener(applicationKey, newSession));
		}
		// register the session object itself
		setAttribute(request, Session.SESSION_ATTRIBUTE_NAME, newSession);
	}
}
 
開發者ID:baholladay,項目名稱:WicketRedisSession,代碼行數:26,代碼來源:RedisSessionStore.java

示例10: fetchStatus

import org.apache.wicket.Application; //導入依賴的package包/類
private Status fetchStatus(MenuNode node, Class<? extends Page> currentPage, boolean enabled) {
    if (!enabled) {
        return DISABLED;
    }

    if (currentPage.equals(node.getPageClass())) {
        return SELECTED;
    }

    Boolean opened = node.isOpened();
    if (Boolean.TRUE.equals(opened)) {
        return OPENED;
    } else if (Boolean.FALSE.equals(opened)) {
        return ENABLED;
    }

    SiteMap siteMap = ((SiteMapAware) Application.get()).getSiteMap();
    MenuNode current = siteMap.getPageNode(currentPage);
    while (current != null) {
        if (current.equals(node)) {
            return OPENED;
        }
        current = current.getParent();
    }
    return ENABLED;
}
 
開發者ID:alancnet,項目名稱:artifactory,代碼行數:27,代碼來源:MenuItem.java

示例11: onValidate

import org.apache.wicket.Application; //導入依賴的package包/類
@Override
protected void onValidate(IValidatable<String> validatable) {
  final String value = validatable.getValue();
  if (value == null) return;
  try {
    DateFormat df = createDateFormat();
    df.parse(value);
  } catch (ParseException e) {
    String message = Application.get().getResourceSettings().getLocalizer().getString(resourceKey(), (Component)null, 
          new Model<Serializable>(new Serializable() {
            @SuppressWarnings("unused")
            public String getValue() {
              return value;
            }
          }));
    component.error(AbstractFieldInstancePanel.createErrorMessage(fieldInstanceModel, new Model<String>(message)));
  }
}
 
開發者ID:ontopia,項目名稱:ontopia,代碼行數:19,代碼來源:DateFormatValidator.java

示例12: reportError

import org.apache.wicket.Application; //導入依賴的package包/類
private void reportError(String resourceKey, final String value, final String regex) {
  try {
    String message = Application.get().getResourceSettings().getLocalizer().getString(resourceKey, (Component)null, 
        new Model<Serializable>(new Serializable() {
          @SuppressWarnings("unused")
          public String getValue() {
            return value;
          }
          @SuppressWarnings("unused")
          public String getRegex() {
            return regex;
          }
        }));
    component.error(AbstractFieldInstancePanel.createErrorMessage(fieldInstanceModel, new Model<String>(message)));    
  } catch (Exception e) {
    component.error(AbstractFieldInstancePanel.createErrorMessage(fieldInstanceModel, new Model<String>("Regexp validation error (value='" + value+ "', regex='" + regex + "')")));    
  }
}
 
開發者ID:ontopia,項目名稱:ontopia,代碼行數:19,代碼來源:RegexValidator.java

示例13: onValidate

import org.apache.wicket.Application; //導入依賴的package包/類
@Override
protected void onValidate(IValidatable<String> validatable) {
  final String value = validatable.getValue();
  if (value == null) return;
  try {
    new URILocator(value);
  } catch (Exception e) {
    String message = Application.get().getResourceSettings().getLocalizer().getString(resourceKey(), (Component)null, 
        new Model<Serializable>(new Serializable() {
          @SuppressWarnings("unused")
          public String getValue() {
            return value;
          }
        }));
    component.error(AbstractFieldInstancePanel.createErrorMessage(fieldInstanceModel, new Model<String>(message)));
  }
}
 
開發者ID:ontopia,項目名稱:ontopia,代碼行數:18,代碼來源:URIValidator.java

示例14: 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);
}
 
開發者ID:U-QASAR,項目名稱:u-qasar.platform,代碼行數:21,代碼來源:DashboardSettings.java

示例15: getObject

import org.apache.wicket.Application; //導入依賴的package包/類
/**
 * Returns name
 * @param component component to look associated localization 
 * @return name
 */
public String getObject(Component component) {
	if(objectModel!=null)
	{
		T object = objectModel.getObject();
		if(object==null) return null;
		resourceKey = getResourceKey(object);
	}
	String defaultValue = getDefault();
	if(defaultValue==null) defaultValue = Strings.lastPathComponent(resourceKey, '.');
	if(defaultValue!=null) defaultValue = buitify(defaultValue);
	return Application.get()
			.getResourceSettings()
			.getLocalizer()
			.getString(resourceKey, null, defaultValue);
}
 
開發者ID:OrienteerBAP,項目名稱:wicket-orientdb,代碼行數:21,代碼來源:AbstractNamingModel.java


注:本文中的org.apache.wicket.Application類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。