use of lucee.runtime.type.dt.DateTimeImpl in project Lucee by lucee.
the class Cache method doStartTag.
@Override
public int doStartTag() throws PageException {
now = new DateTimeImpl(pageContext.getConfig());
if (action == CACHE && hasBody)
action = CONTENT;
try {
if (action == CACHE) {
doClientCache();
doServerCache();
} else if (action == CACHE_CLIENT)
doClientCache();
else if (action == CACHE_SERVER)
doServerCache();
else if (action == FLUSH)
doFlush();
else if (action == CONTENT)
return doContentCache();
else if (action == GET)
doGet();
else if (action == PUT)
doPut();
return EVAL_PAGE;
} catch (Exception e) {
throw Caster.toPageException(e);
}
}
use of lucee.runtime.type.dt.DateTimeImpl in project Lucee by lucee.
the class FileTag method getInfo.
public static Struct getInfo(PageContext pc, Resource file, String serverPassword) throws PageException {
SecurityManager sm = pc.getConfig().getSecurityManager();
checkFile(pc, sm, file, serverPassword, false, false, false, false);
Struct sct = new StructImpl();
// fill data to query
sct.setEL(KeyConstants._name, file.getName());
sct.setEL(KeyConstants._size, Long.valueOf(file.length()));
sct.setEL(KeyConstants._type, file.isDirectory() ? "Dir" : "File");
sct.setEL("dateLastModified", new DateTimeImpl(pc, file.lastModified(), false));
sct.setEL("attributes", getFileAttribute(file));
if (SystemUtil.isUnix())
sct.setEL(KeyConstants._mode, new ModeObjectWrap(file));
try {
sct.setEL(KeyConstants._checksum, Hash.md5(file));
} catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
}
try {
BufferedImage bi = ImageUtil.toBufferedImage(file, null);
if (bi != null) {
Struct img = new StructImpl();
img.setEL(KeyConstants._width, new Double(bi.getWidth()));
img.setEL(KeyConstants._height, new Double(bi.getHeight()));
sct.setEL(KeyConstants._img, img);
}
} catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
}
return sct;
}
use of lucee.runtime.type.dt.DateTimeImpl in project Lucee by lucee.
the class ServerImpl method reload.
public void reload(PageContext pc, Boolean jsr223) {
Info info = pc.getConfig().getFactory().getEngine().getInfo();
ReadOnlyStruct coldfusion = new ReadOnlyStruct();
coldfusion.setEL(PRODUCT_LEVEL, info.getLevel());
// coldfusion.setEL(PRODUCT_VERSION,"11,0,07,296330");
coldfusion.setEL(PRODUCT_VERSION, "2016,0,03,300357");
coldfusion.setEL(SERIAL_NUMBER, "0");
coldfusion.setEL(PRODUCT_NAME, "Lucee");
// TODO scope server missing values
// Jrun
coldfusion.setEL(KeyConstants._appserver, "");
//
coldfusion.setEL(EXPIRATION, expired);
//
coldfusion.setEL(INSTALL_KIT, "");
String rootdir = "";
try {
rootdir = ThreadLocalPageContext.getConfig(pc).getRootDirectory().getAbsolutePath();
} catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
}
//
coldfusion.setEL(ROOT_DIR, rootdir);
//
coldfusion.setEL(SUPPORTED_LOCALES, LocaleFactory.getLocaleList());
coldfusion.setReadOnly(true);
super.setEL(KeyConstants._coldfusion, coldfusion);
ReadOnlyStruct os = new ReadOnlyStruct();
os.setEL(KeyConstants._name, System.getProperty("os.name"));
os.setEL(ARCH, System.getProperty("os.arch"));
os.setEL(MAC_ADDRESS, SystemUtil.getMacAddressAsWrap());
int arch = SystemUtil.getOSArch();
if (arch != SystemUtil.ARCH_UNKNOW)
os.setEL(ARCH_MODEL, new Double(arch));
os.setEL(KeyConstants._version, System.getProperty("os.version"));
os.setEL(ADDITIONAL_INFORMATION, "");
os.setEL(BUILD_NUMBER, "");
os.setEL(HOST_NAME, SystemUtil.getLocalHostName());
os.setReadOnly(true);
super.setEL(KeyConstants._os, os);
ReadOnlyStruct lucee = new ReadOnlyStruct();
lucee.setEL(KeyConstants._version, info.getVersion().toString());
lucee.setEL(VERSION_NAME, info.getVersionName());
lucee.setEL(VERSION_NAME_EXPLANATION, info.getVersionNameExplanation());
lucee.setEL(KeyConstants._state, getStateAsString(info.getVersion()));
lucee.setEL(RELEASE_DATE, new DateTimeImpl(info.getRealeaseTime(), false));
lucee.setEL(LOADER_VERSION, Caster.toDouble(SystemUtil.getLoaderVersion()));
lucee.setEL(LOADER_PATH, ClassUtil.getSourcePathForClass("lucee.loader.servlet.CFMLServlet", ""));
lucee.setEL(ENVIRONMENT, jsr223 != null && jsr223.booleanValue() ? "jsr223" : "servlet");
lucee.setReadOnly(true);
super.setEL(KeyConstants._lucee, lucee);
ReadOnlyStruct separator = new ReadOnlyStruct();
separator.setEL(KeyConstants._path, System.getProperty("path.separator"));
separator.setEL(KeyConstants._file, System.getProperty("file.separator"));
separator.setEL(KeyConstants._line, System.getProperty("line.separator"));
separator.setReadOnly(true);
super.setEL(KeyConstants._separator, separator);
ReadOnlyStruct java = new ReadOnlyStruct();
java.setEL(KeyConstants._version, System.getProperty("java.version"));
java.setEL(VENDOR, System.getProperty("java.vendor"));
arch = SystemUtil.getJREArch();
if (arch != SystemUtil.ARCH_UNKNOW)
java.setEL(ARCH_MODEL, new Double(arch));
Runtime rt = Runtime.getRuntime();
java.setEL(FREE_MEMORY, new Double(rt.freeMemory()));
java.setEL(TOTAL_MEMORY, new Double(rt.totalMemory()));
java.setEL(MAX_MEMORY, new Double(rt.maxMemory()));
java.setEL(JAVA_AGENT_SUPPORTED, Boolean.TRUE);
if (jep == null) {
String temp = System.getProperty("user.dir", "");
if (!StringUtil.isEmpty(temp) && !temp.endsWith(File.separator))
temp = temp + File.separator;
jep = temp;
}
java.setEL(JAVA_EXECUTION_PATH, jep);
java.setReadOnly(true);
super.setEL(KeyConstants._java, java);
ReadOnlyStruct servlet = new ReadOnlyStruct();
String name = "";
try {
name = pc.getServletContext().getServerInfo();
} catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
}
servlet.setEL(KeyConstants._name, name);
servlet.setReadOnly(true);
super.setEL(KeyConstants._servlet, servlet);
ReadOnlyStruct system = new ReadOnlyStruct();
system.setEL(KeyConstants._properties, SystemPropStruct.getInstance());
system.setEL(KeyConstants._environment, EnvStruct.getInstance());
system.setReadOnly(true);
super.setEL(KeyConstants._system, system);
}
use of lucee.runtime.type.dt.DateTimeImpl in project Lucee by lucee.
the class IKStorageScopeSupport method touchBeforeRequest.
@Override
public void touchBeforeRequest(PageContext pc) {
hasChanges = false;
setTimeSpan(pc);
// lastvisit=System.currentTimeMillis();
if (data == null)
data = new ConcurrentHashMapPro<Collection.Key, IKStorageScopeItem>();
data.put(KeyConstants._cfid, new IKStorageScopeItem(pc.getCFID()));
data.put(KeyConstants._cftoken, new IKStorageScopeItem(pc.getCFToken()));
data.put(URLTOKEN, new IKStorageScopeItem(pc.getURLToken()));
data.put(LASTVISIT, new IKStorageScopeItem(_lastvisit));
_lastvisit = new DateTimeImpl(pc.getConfig());
lastvisit = System.currentTimeMillis();
if (type == SCOPE_CLIENT) {
data.put(HITCOUNT, new IKStorageScopeItem(new Double(hitcount++)));
} else {
data.put(SESSION_ID, new IKStorageScopeItem(pc.getApplicationContext().getName() + "_" + pc.getCFID() + "_" + pc.getCFToken()));
}
data.put(TIMECREATED, new IKStorageScopeItem(timecreated));
}
use of lucee.runtime.type.dt.DateTimeImpl in project Lucee by lucee.
the class StorageScopeImpl method touch.
@Override
public void touch() {
lastvisit = System.currentTimeMillis();
_lastvisit = new DateTimeImpl(ThreadLocalPageContext.getConfig());
}
Aggregations