本文整理汇总了Java中org.osgl.util.S.afterLast方法的典型用法代码示例。如果您正苦于以下问题:Java S.afterLast方法的具体用法?Java S.afterLast怎么用?Java S.afterLast使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.osgl.util.S
的用法示例。
在下文中一共展示了S.afterLast方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AppDescriptor
import org.osgl.util.S; //导入方法依赖的package包/类
/**
* Construct an `AppVersion` with name and version
*
* @param appName
* the app name
* @param version
* the app version
*/
private AppDescriptor(String appName, String packageName, Version version) {
if (appName.startsWith("${")) {
LOGGER.warn("app name is substitute variable - fallback to default app name");
appName = S.afterLast(packageName, ".");
}
this.appName = appName;
this.packageName = packageName;
this.version = version;
}
示例2: loadClass
import org.osgl.util.S; //导入方法依赖的package包/类
@Override
protected synchronized Class<?> loadClass(final String name,
final boolean resolve) throws ClassNotFoundException {
if (!name.startsWith("testapp.")) {
return super.loadClass(name, resolve);
}
// gets an input stream to read the bytecode of the class
String cn = name.replace('.', '/');
String resource = cn + ".class";
InputStream is = getResourceAsStream(resource);
byte[] b;
// adapts the class on the fly
try {
ClassReader cr = new ClassReader(is);
ClassWriter cw = new ClassWriter(0);
MailerEnhancer enhancer = new MailerEnhancer(cw, MailerEnhancerTest.this);
cr.accept(enhancer, 0);
b = cw.toByteArray();
OutputStream os1 = new FileOutputStream("/tmp/" + S.afterLast(cn, "/") + ".class");
IO.write(b, os1);
cr = new ClassReader(b);
cw = new ClassWriter(0);
OutputStream os2 = new FileOutputStream("/tmp/" + S.afterLast(cn, "/") + ".java");
ClassVisitor tv = new TraceClassVisitor(cw, new PrintWriter(os2));
cr.accept(tv, 0);
} catch (Exception e) {
throw new ClassNotFoundException(name, e);
}
// returns the adapted class
return defineClass(name, b, 0, b.length);
}
示例3: loadClass
import org.osgl.util.S; //导入方法依赖的package包/类
@Override
protected synchronized Class<?> loadClass(final String name,
final boolean resolve) throws ClassNotFoundException {
if (!name.startsWith("testapp.")) {
return super.loadClass(name, resolve);
}
// gets an input stream to read the bytecode of the class
String cn = name.replace('.', '/');
String resource = cn + ".class";
InputStream is = getResourceAsStream(resource);
byte[] b;
// adapts the class on the fly
try {
ClassReader cr = new ClassReader(is);
ClassWriter cw = new ClassWriter(0);
ControllerEnhancer enhancer = new ControllerEnhancer(cw, ControllerEnhancerTest.this);
cr.accept(enhancer, 0);
b = cw.toByteArray();
OutputStream os1 = new FileOutputStream("/tmp/" + S.afterLast(cn, "/") + ".class");
IO.write(b, os1);
cr = new ClassReader(b);
cw = new ClassWriter(0);
OutputStream os2 = new FileOutputStream("/tmp/" + S.afterLast(cn, "/") + ".java");
ClassVisitor tv = new TraceClassVisitor(cw, new PrintWriter(os2));
cr.accept(tv, 0);
} catch (Exception e) {
throw new ClassNotFoundException(name, e);
}
// returns the adapted class
return defineClass(name, b, 0, b.length);
}
示例4: loadClass
import org.osgl.util.S; //导入方法依赖的package包/类
@Override
protected synchronized Class<?> loadClass(final String name,
final boolean resolve) throws ClassNotFoundException {
if (!name.startsWith("testapp.")) {
return super.loadClass(name, resolve);
}
// gets an input stream to read the bytecode of the class
String cn = name.replace('.', '/');
String resource = cn + ".class";
InputStream is = getResourceAsStream(resource);
byte[] b;
// adapts the class on the fly
try {
ClassReader cr = new ClassReader(is);
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
DataObjectEnhancer enhancer = new DataObjectEnhancer(cw);
cr.accept(enhancer, 0);
b = cw.toByteArray();
//CheckClassAdapter.verify(new ClassReader(cw.toByteArray()), true, new PrintWriter(System.out));
OutputStream os1 = new FileOutputStream("/tmp/" + S.afterLast(cn, "/") + ".class");
IO.write(b, os1);
cr = new ClassReader(b);
cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
OutputStream os2 = new FileOutputStream("/tmp/" + S.afterLast(cn, "/") + ".java");
ClassVisitor tv = new TraceClassVisitor(cw, new PrintWriter(os2));
cr.accept(tv, 0);
} catch (Exception e) {
throw new ClassNotFoundException(name, e);
}
// returns the adapted class
return defineClass(name, b, 0, b.length);
}
示例5: suffixOf
import org.osgl.util.S; //导入方法依赖的package包/类
private String suffixOf(String key) {
return S.afterLast(key, ".");
}
示例6: apply
import org.osgl.util.S; //导入方法依赖的package包/类
@Override
public void apply(H.Request req, H.Response resp) {
boolean hasName = S.notBlank(name);
try {
applyCookies(resp);
applyHeaders(resp);
if (null != contentType) {
resp.contentType(contentType);
} else if (hasName) {
String ext = S.afterLast(name, ".");
if (S.notBlank(ext)) {
H.Format format = H.Format.of(ext);
if (null != format) {
resp.initContentType(format.contentType());
}
}
resp.initContentType("application/octet-stream");
}
if (!resp.containsHeader(CONTENT_DISPOSITION)) {
resp.contentDisposition(name, disposition.isInline());
}
if (!resp.containsHeader(CONTENT_LENGTH)) {
if (0 < length) {
resp.header(CONTENT_LENGTH, S.string(length));
}
}
applyStatus(resp);
applyBeforeCommitHandler(req, resp);
if (null != binary) {
resp.writeBinary(binary);
} else {
outputStreamVisitor.apply(resp.outputStream());
}
} catch (Exception e) {
throw E.unexpected(e);
} finally {
try {
resp.commit();
applyAfterCommitHandler(req, resp);
} finally {
clearThreadLocals();
}
}
}