本文整理汇总了Java中org.apache.wicket.Session.exists方法的典型用法代码示例。如果您正苦于以下问题:Java Session.exists方法的具体用法?Java Session.exists怎么用?Java Session.exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.wicket.Session
的用法示例。
在下文中一共展示了Session.exists方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadStringResource
import org.apache.wicket.Session; //导入方法依赖的package包/类
@Override
public String loadStringResource(Component component, String key, Locale locale, String style, String variation) {
if (locale == null) {
locale = Session.exists() ? Session.get().getLocale() : Locale.getDefault();
}
ResourceBundle.Control control = new UTF8Control();
try {
return ResourceBundle.getBundle(bundleName, locale, control).getString(key);
} catch (MissingResourceException ex) {
try {
return ResourceBundle.getBundle(bundleName, locale,
Thread.currentThread().getContextClassLoader(), control).getString(key);
} catch (MissingResourceException ex2) {
return null;
}
}
}
示例2: setupContext
import org.apache.wicket.Session; //导入方法依赖的package包/类
protected void setupContext(Application application, Session session) {
if (!Application.exists() && application != null) {
ThreadContext.setApplication(application);
}
if (!Session.exists() && session != null) {
ThreadContext.setSession(session);
}
}
示例3: getDefaultLocale
import org.apache.wicket.Session; //导入方法依赖的package包/类
private Locale getDefaultLocale() {
if (Session.exists()) {
return Session.get().getLocale();
} else {
return propertyService.get(SpringPropertyIds.DEFAULT_LOCALE);
}
}
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:8,代码来源:AbstractNotificationContentDescriptorFactory.java
示例4: getLocale
import org.apache.wicket.Session; //导入方法依赖的package包/类
public static Locale getLocale(final long languageId) {
Locale loc = LabelDao.getLocale(languageId);
if (loc == null) {
loc = Session.exists() ? WebSession.get().getLocale() : Locale.ENGLISH;
}
return loc;
}
示例5: applyFacetValueFromParameter
import org.apache.wicket.Session; //导入方法依赖的package包/类
private void applyFacetValueFromParameter(StringValue facetValue, final HashMap<String, FacetSelection> selection) {
final List<String> fq = FILTER_SPLITTER.splitToList(facetValue.toString());
if (fq.size() == 2) {
// we have a facet - value pair
//get facet name, may be a case of "not"
final String facetString = fq.get(0);
//check if negated
final boolean negated = facetString.startsWith("-");
//get actual facet name
final String requestedFacet;
if (negated) {
//skip negation for actual facet name
requestedFacet = facetString.substring(1);
} else {
requestedFacet = facetString;
}
final String facet = facetParamMapper.getFacet(requestedFacet);
final String value = facetParamMapper.getValue(requestedFacet, fq.get(1));
if (isAllowedFacetName(facet)) {
if (selection.containsKey(facet)) {
selection.get(facet).getValues().add(value);
} else {
selection.put(facet, new FacetSelection(Arrays.asList(value)));
}
if (negated) {
//negate selection
selection.get(facet).setQualifier(value, FacetSelectionValueQualifier.NOT);
}
} else {
logger.debug("Undefined facet passed into query parameter {}: {}", FILTER_QUERY, facet);
if (Session.exists()) {
// generate Wicket error message
Session.get().error("Unknown facet: " + facet);
}
}
} else {
logger.info("Illegal query parameter value for {}: {}", FILTER_QUERY, facetValue);
}
}
示例6: cacheEnabled
import org.apache.wicket.Session; //导入方法依赖的package包/类
private boolean cacheEnabled() {
return Session.exists();
}