本文整理汇总了Java中org.osgl.util.S.blank方法的典型用法代码示例。如果您正苦于以下问题:Java S.blank方法的具体用法?Java S.blank怎么用?Java S.blank使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.osgl.util.S
的用法示例。
在下文中一共展示了S.blank方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: method
import org.osgl.util.S; //导入方法依赖的package包/类
@Override
public H.Method method() {
if (null == method) {
method = _method();
if (method == H.Method.POST) {
// check the method overload
String s = header(H.Header.Names.X_HTTP_METHOD_OVERRIDE);
if (S.blank(s)) {
s = paramVal("_method"); // Spring use this
}
if (S.notBlank(s)) {
method = H.Method.valueOfIgnoreCase(s);
}
}
}
return method;
}
示例2: isPackageOrClassName
import org.osgl.util.S; //导入方法依赖的package包/类
/**
* Check if a given string is a valid java package or class name.
*
* This method use the technique documented in
* [this SO question](https://stackoverflow.com/questions/13557195/how-to-check-if-string-is-a-valid-class-identifier)
* with the following extensions:
*
* * if the string does not contain `.` then assume it is not a valid package or class name
*
* @param s
* the string to be checked
* @return
* `true` if `s` is a valid java package or class name
*/
public static boolean isPackageOrClassName(String s) {
if (S.blank(s)) {
return false;
}
S.List parts = S.fastSplit(s, ".");
if (parts.size() < 2) {
return false;
}
for (String part: parts) {
if (!Character.isJavaIdentifierStart(part.charAt(0))) {
return false;
}
for (int i = 1, len = part.length(); i < len; ++i) {
if (!Character.isJavaIdentifierPart(part.charAt(i))) {
return false;
}
}
}
return true;
}
示例3: handle
import org.osgl.util.S; //导入方法依赖的package包/类
@Override
public void handle(CliContext context) {
try {
ensureAgentsReady();
saveCommandPath(context);
Object result = _handle(context);
onResult(result, context);
} catch ($.Break b) {
throw b;
} catch (CliException error) {
context.println(error.getMessage());
} catch (Exception e) {
String msg = e.getMessage();
if (S.blank(msg)) {
msg = S.fmt("Error processing command: %s", e);
}
context.println(msg);
logger.error(e, "Error handling request");
} catch (Throwable t) {
logger.fatal(t, "Error handling request");
} finally {
PropertySpec.current.remove();
}
}
示例4: preventDoubleSubmission
import org.osgl.util.S; //导入方法依赖的package包/类
private void preventDoubleSubmission(ActionContext context) {
if (null == dspToken) {
return;
}
H.Request req = context.req();
if (req.method().safe()) {
return;
}
String tokenValue = context.paramVal(dspToken);
if (S.blank(tokenValue)) {
return;
}
H.Session session = context.session();
String cacheKey = S.concat("DSP-", dspToken);
String cached = session.cached(cacheKey);
if (S.eq(tokenValue, cached)) {
throw Conflict.get();
}
session.cacheFor1Min(cacheKey, tokenValue);
}
示例5: initialized
import org.osgl.util.S; //导入方法依赖的package包/类
@Override
protected void initialized() {
App app = App.instance();
Class rawType = spec.rawType();
dao = app.dbServiceManager().dao(rawType);
querySpec = S.string(options.get(KEY_USER_KEY));
if (S.blank(querySpec)) {
querySpec = AAAConfig.user.key.get();
}
}
示例6: templatePath
import org.osgl.util.S; //导入方法依赖的package包/类
@Override
public String templatePath() {
String path = templatePath;
String context = templateContext;
if (S.notBlank(path)) {
return path.startsWith("/") || S.blank(context) ? path : S.pathConcat(context, '/', path);
} else {
if (S.blank(context)) {
return methodPath().replace('.', '/');
} else {
return S.pathConcat(context, '/', S.afterLast(methodPath(), "."));
}
}
}
示例7: preCheck
import org.osgl.util.S; //导入方法依赖的package包/类
/**
* Do sanity check to see if CSRF token is present. This method
* is called before session resolved
*
* @param context the current context
*/
public void preCheck(ActionContext context) {
if (!enabled) {
return;
}
H.Method method = context.req().method();
if (method.safe()) {
return;
}
String token = retrieveCsrfToken(context);
if (S.blank(token)) {
raiseCsrfNotVerified(context);
}
}
示例8: filter
import org.osgl.util.S; //导入方法依赖的package包/类
/**
* Filter a list of string tokens and get rid of tokens that are
* {@link #noiseWords() noise}
*
* The tokens in the return list is in lower case
*
* @param tokens
* the list of string token
* @return
* filtered list of lowercase string tokens
*/
static List<String> filter(List<String> tokens) {
List<String> result = new ArrayList<>();
Set<String> noise = noiseWords();
for (String token : tokens) {
if (S.blank(token)) {
continue;
}
token = token.trim().toLowerCase();
if (!noise.contains(token)) {
result.add(token);
}
}
return result;
}
示例9: dbBindName
import org.osgl.util.S; //导入方法依赖的package包/类
private static String dbBindName(BeanSpec spec) {
for (Annotation annotation : spec.allAnnotations()) {
if (annotation.annotationType().getName().equals(DbBind.class.getName())) {
String value = $.invokeVirtual(annotation, "value");
return (S.blank(value)) ? spec.name() : value;
}
}
return null;
}
示例10: isAppProperties
import org.osgl.util.S; //导入方法依赖的package包/类
private boolean isAppProperties(String name, String profile) {
if (!name.endsWith(".properties")) {
return false;
}
if (name.startsWith("conf/")) {
String name0 = name.substring(5);
if (!name0.contains("/") || name0.startsWith("common")) {
return true;
}
return !S.blank(profile) && name0.startsWith(profile + "/");
}
return !name.contains("/") && !name.startsWith("act") && !name.startsWith("build.");
}
示例11: handle
import org.osgl.util.S; //导入方法依赖的package包/类
@Override
public void handle(ActionContext context) {
if (null != delegate) {
delegate.handle(context);
return;
}
context.handler(this);
File file = base;
H.Format fmt;
if (base.isDirectory()) {
String path = context.paramVal(ParamNames.PATH);
if (S.blank(path)) {
AlwaysForbidden.INSTANCE.handle(context);
return;
}
file = new File(base, path);
if (!file.exists()) {
AlwaysNotFound.INSTANCE.handle(context);
return;
}
if (file.isDirectory() || !file.canRead()) {
AlwaysForbidden.INSTANCE.handle(context);
return;
}
}
ActResponse resp = context.prepareRespForWrite();
fmt = contentType(file.getPath());
resp.contentType(fmt);
context.applyCorsSpec().applyContentSecurityPolicy().applyContentType();
InputStream is = new BufferedInputStream(IO.is(file));
IO.copy(is, resp.outputStream());
}
示例12: of
import org.osgl.util.S; //导入方法依赖的package包/类
static JobTrigger of(AppConfig config, Every anno) {
String duration = anno.value();
if (duration.startsWith("every.")) {
duration = (String) config.get(duration);
} else if (duration.startsWith("${") && duration.endsWith("}")) {
duration = duration.substring(2, duration.length() - 1);
duration = (String) config.get(duration);
}
if (S.blank(duration)) {
throw E.invalidConfiguration("Cannot find configuration for duration: %s", anno.value());
}
return every(duration, anno.startImmediately());
}
示例13: resolve
import org.osgl.util.S; //导入方法依赖的package包/类
@Override
public final T resolve(String value) {
if (S.blank(value)) {
return null;
}
Date date = parse(value);
if (null == date) {
return null;
}
return cast(date);
}
示例14: contextPath
import org.osgl.util.S; //导入方法依赖的package包/类
public CommanderClassMetaInfo contextPath(String path) {
if (S.blank(path)) {
contextPath = "/";
} else {
contextPath = path;
}
return this;
}
示例15: routeInfoList
import org.osgl.util.S; //导入方法依赖的package包/类
private List<RouteInfo> routeInfoList(String portName, String q) {
final Router router = S.blank(portName) ? app.router() : app.router(portName);
List<RouteInfo> list = router.debug();
if (S.notBlank(q)) {
List<RouteInfo> toBeRemoved = new ArrayList<>();
for (RouteInfo info: list) {
if (info.path().matches(q) || S.string(info.handler()).matches(q)) {
continue;
}
toBeRemoved.add(info);
}
list = C.list(list).without(toBeRemoved);
}
return list;
}