本文整理汇总了Java中org.apache.wicket.util.string.Strings.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java Strings.isEmpty方法的具体用法?Java Strings.isEmpty怎么用?Java Strings.isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.wicket.util.string.Strings
的用法示例。
在下文中一共展示了Strings.isEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onOpen
import org.apache.wicket.util.string.Strings; //导入方法依赖的package包/类
@Override
protected void onOpen(IPartialPageRequestHandler handler) {
ConfigurationDao cfgDao = getBean(ConfigurationDao.class);
String baseURL = getBaseUrl();
sendEmailAtRegister = cfgDao.getBool(CONFIG_EMAIL_AT_REGISTER, false);
sendConfirmation = !Strings.isEmpty(baseURL) && cfgDao.getBool(CONFIG_EMAIL_VERIFICATION, false);
String messageCode = "account.created";
if (sendConfirmation && sendEmailAtRegister) {
messageCode = "warn.notverified";
} else if (sendConfirmation) {
messageCode = "1591";
}
confirmRegistration.setModelObject(getString(messageCode));
reset(handler);
handler.add(form);
}
示例2: query
import org.apache.wicket.util.string.Strings; //导入方法依赖的package包/类
@Override
public void query(String term, int page, Response<Group> response) {
if (WebSession.getRights().contains(User.Right.Admin)) {
List<Group> groups = getBean(GroupDao.class).get(0, Integer.MAX_VALUE);
for (Group g : groups) {
if (Strings.isEmpty(term) || g.getName().toLowerCase().contains(term.toLowerCase())) {
response.add(g);
}
}
} else {
User u = getBean(UserDao.class).get(getUserId());
for (GroupUser ou : u.getGroupUsers()) {
if (Strings.isEmpty(term) || ou.getGroup().getName().toLowerCase().contains(term.toLowerCase())) {
response.add(ou.getGroup());
}
}
}
}
示例3: init
import org.apache.wicket.util.string.Strings; //导入方法依赖的package包/类
private void init(String _name, String _ext, InputStream is) {
if (Strings.isEmpty(_ext)) {
int idx = _name.lastIndexOf('.');
name = idx < 0 ? _name : _name.substring(0, idx);
ext = getFileExt(_name);
} else {
name = _name;
ext = _ext.toLowerCase();
}
Metadata md = new Metadata();
md.add(RESOURCE_NAME_KEY, String.format(FILE_NAME_FMT, name, ext));
try {
mime = tika.getDetector().detect(is == null ? null : TikaInputStream.get(is), md);
} catch (Throwable e) {
mime = null;
log.error("Unexpected exception while detecting mime type", e);
}
}
示例4: checkResource
import org.apache.wicket.util.string.Strings; //导入方法依赖的package包/类
/**
* Check that current user has access to mentioned resource
* @param resource {@link RequiredOrientResource} to check
* @param action {@link Action} to check for
* @return true if access is allowed
*/
public boolean checkResource(RequiredOrientResource resource, Action action)
{
if(!resource.action().equals(action.getName())) return true;
OSecurityUser user = OrientDbWebSession.get().getUser();
if(user==null) return false;
int iOperation = OrientPermission.combinedPermission(resource.permissions());
ORule.ResourceGeneric value = OSecurityHelper.getResourceGeneric(resource.value());
String specific = resource.specific();
if(Strings.isEmpty(specific)) specific = null;
if(user.checkIfAllowed(value, specific, iOperation)!=null) return true;
while(!Strings.isEmpty(specific=Strings.beforeLastPathComponent(specific, '.')))
{
if(user.checkIfAllowed(value, specific+"."+ODatabaseSecurityResources.ALL, iOperation)!=null) return true;
}
return false;
}
示例5: onScriptExecute
import org.apache.wicket.util.string.Strings; //导入方法依赖的package包/类
protected void onScriptExecute(AjaxRequestTarget target)
{
String commandScript = scriptModel.getObject();
if(!Strings.isEmpty(commandScript))
{
String scriptEngineName = scriptEngineModel.getObject();
if (!Strings.isEmpty(scriptEngineName)){
ScriptExecutorHolder.get().getScriptExecutor().execute(commandScript,scriptEngineName,context);
}else{
ScriptExecutorHolder.get().getScriptExecutor().execute(commandScript);
}
if(!keepScriptModel.getObject())
{
scriptModel.setObject("");
if(target!=null)
{
target.add(scriptTextArea);
target.focusComponent(scriptTextArea);
}
}
if(target!=null) target.add(historyContainer);
}
}
示例6: convertInput
import org.apache.wicket.util.string.Strings; //导入方法依赖的package包/类
/**
* Convert the input respecting the flag convertEmptyInputStringToNull.
* Subclasses that override this method should test this flag also.
*
* @see org.apache.wicket.markup.html.form.FormComponent#convertInput()
*/
@Override
protected void convertInput()
{
// Stateless forms don't have to be rendered first, convertInput could be called before
// onBeforeRender calling resolve type here again to check if the type is correctly set.
resolveType();
String[] value = getInputAsArray();
String tmp = value != null && value.length > 0 ? value[0] : null;
if (convertBlankInputStringToNull && StringUtils.isBlank(tmp))
{
setConvertedInput(null);
}
else if (getConvertEmptyInputStringToNull() && Strings.isEmpty(tmp))
{
setConvertedInput(null);
}
else
{
super.convertInput();
}
}
示例7: getObject
import org.apache.wicket.util.string.Strings; //导入方法依赖的package包/类
@Override
public String getObject() {
if (Strings.isEmpty(value)) {
return value;
}
String safeValue;
switch (mode) {
case none:
safeValue = GitBlitWebApp.get().xssFilter().none(value);
break;
default:
safeValue = GitBlitWebApp.get().xssFilter().relaxed(value);
break;
}
if (!value.equals(safeValue)) {
LoggerFactory.getLogger(getClass()).warn("XSS filter trigggered on suspicious form field value {}", value);
}
return safeValue;
}
示例8: AbstractWebSocketProcessor
import org.apache.wicket.util.string.Strings; //导入方法依赖的package包/类
/**
* Constructor.
*
* @param request
* the http request that was used to create the TomcatWebSocketProcessor
* @param application
* the current Wicket Application
*/
public AbstractWebSocketProcessor(final HttpServletRequest request, final WebApplication application)
{
this.sessionId = request.getSession(true).getId();
String pageId = request.getParameter("pageId");
resourceName = request.getParameter("resourceName");
if (Strings.isEmpty(pageId) && Strings.isEmpty(resourceName))
{
throw new IllegalArgumentException("The request should have either 'pageId' or 'resourceName' parameter!");
}
if (Strings.isEmpty(pageId) == false)
{
this.pageId = Integer.parseInt(pageId, 10);
}
else
{
this.pageId = NO_PAGE_ID;
}
String baseUrl = request.getParameter(WebRequest.PARAM_AJAX_BASE_URL);
Checks.notNull(baseUrl, String.format("Request parameter '%s' is required!", WebRequest.PARAM_AJAX_BASE_URL));
this.baseUrl = Url.parse(baseUrl);
WicketFilter wicketFilter = application.getWicketFilter();
this.servletRequest = new ServletRequestCopy(request);
this.application = Args.notNull(application, "application");
this.webSocketSettings = WebSocketSettings.Holder.get(application);
this.webRequest = webSocketSettings.newWebSocketRequest(request, wicketFilter.getFilterPath());
this.connectionRegistry = webSocketSettings.getConnectionRegistry();
this.connectionFilter = webSocketSettings.getConnectionFilter();
}
示例9: getRegistryKey
import org.apache.wicket.util.string.Strings; //导入方法依赖的package包/类
protected IKey getRegistryKey()
{
IKey key;
if (Strings.isEmpty(resourceName))
{
key = new PageIdKey(pageId);
}
else
{
key = new ResourceNameKey(resourceName);
}
return key;
}
示例10: convertInput
import org.apache.wicket.util.string.Strings; //导入方法依赖的package包/类
@Override
public void convertInput() {
String input = getWebRequest().getRequestParameters().getParameterValue(getInputName()).toString();
if (Strings.isEmpty(input)) {
setConvertedInput(null);
} else {
setConvertedInput(getProvider().toChoices(Collections.singleton(input)).iterator().next());
}
}
示例11: convertInput
import org.apache.wicket.util.string.Strings; //导入方法依赖的package包/类
@Override
public void convertInput() {
String input = getWebRequest().getRequestParameters().getParameterValue(getInputName()).toString();
final Collection<T> choices;
if (Strings.isEmpty(input)) {
choices = new ArrayList<T>();
} else {
choices = getProvider().toChoices(Arrays.asList(input.split(",")));
}
setConvertedInput(choices);
}
示例12: newSortableHeader
import org.apache.wicket.util.string.Strings; //导入方法依赖的package包/类
@Override
protected WebMarkupContainer newSortableHeader(String headerId, final String property, final ISortStateLocator locator) {
return new AjaxFallbackOrderByBorder(headerId, property, locator) {
@Override
protected void onSortChanged() {
getTable().setCurrentPage(0);
}
@Override
protected void onAjaxClick(AjaxRequestTarget target) {
target.add(getTable());
}
@Override
public void onComponentTag(ComponentTag tag) {
super.onComponentTag(tag);
ISortState sortState = locator.getSortState();
SortOrder dir = sortState.getPropertySortOrder(property);
String cssClass;
if (dir == SortOrder.ASCENDING) {
cssClass = "sortable asc";
} else if (dir == SortOrder.DESCENDING) {
cssClass = "sortable desc";
} else {
cssClass = "sortable";
}
if (!Strings.isEmpty(cssClass)) {
tag.append("class", cssClass, " ");
}
}
};
}
示例13: SimpleSearchPage
import org.apache.wicket.util.string.Strings; //导入方法依赖的package包/类
public SimpleSearchPage(IModel<QueryFacetsSelection> queryModel) {
super(queryModel, Model.of(true));
if (!Strings.isEmpty(queryModel.getObject().getQuery()) || !queryModel.getObject().getSelection().isEmpty()) {
//query selection -> redirect to non-simple page
setResponsePage(new FacetedSearchPage(queryModel));
}
}
示例14: renderHead
import org.apache.wicket.util.string.Strings; //导入方法依赖的package包/类
@Override
public void renderHead(Component component, IHeaderResponse response) {
// include highlight script
response.render(JavaScriptHeaderItem.forReference(JavaScriptResources.getHighlightJS()));
final String words = getWordList(component);
if (!Strings.isEmpty(words)) {
String selector = getComponentSelector(component.getMarkupId());
// after load, highlight
response.render(OnDomReadyHeaderItem.forScript(scriptFactory.createScript(selector, words)));
}
}
示例15: absoluteMountPathForPage
import org.apache.wicket.util.string.Strings; //导入方法依赖的package包/类
/**
* Get the absolute bookmarkable path of a page
*
* @param pageClass Page
* @param pageParameters Optional page parameters
* @return Bookmarkable path
*/
public static String absoluteMountPathForPage(Class<? extends Page> pageClass, PageParameters pageParameters) {
HttpServletRequest req = getHttpServletRequest();
RequestCycle requestCycle = RequestCycle.get();
Url url = requestCycle.mapUrlFor(pageClass, pageParameters);
String renderedUrl = url.toString();
renderedUrl = Strings.isEmpty(renderedUrl) ? "." : renderedUrl;
return RequestUtils.toAbsolutePath(HttpUtils.getWebappContextUrl(req),
requestCycle.getOriginalResponse().encodeURL(renderedUrl));
}