use of lucee.runtime.listener.ApplicationContext in project Lucee by lucee.
the class UDFSetterProperty method callWithNamedValues.
@Override
public Object callWithNamedValues(PageContext pageContext, Struct values, boolean doIncludePath) throws PageException {
UDFUtil.argumentCollection(values, getFunctionArguments());
Object value = values.get(propName, null);
if (value == null) {
Key[] keys = CollectionUtil.keys(values);
if (keys.length == 1) {
value = values.get(keys[0]);
} else
throw new ExpressionException("The parameter " + prop.getName() + " to function " + getFunctionName() + " is required but was not passed in.");
}
component.getComponentScope().set(propName, cast(pageContext, arguments[0], value, 1));
// make sure it is reconized that set is called by hibernate
// if(component.isPersistent())ORMUtil.getSession(pageContext);
ApplicationContext appContext = pageContext.getApplicationContext();
if (appContext.isORMEnabled() && component.isPersistent())
ORMUtil.getSession(pageContext);
return component;
}
use of lucee.runtime.listener.ApplicationContext in project Lucee by lucee.
the class PageContextImpl method setClientCookies.
private void setClientCookies() {
TimeSpan tsExpires = SessionCookieDataImpl.DEFAULT.getTimeout();
String domain = PageContextUtil.getCookieDomain(this);
boolean httpOnly = SessionCookieDataImpl.DEFAULT.isHttpOnly();
boolean secure = SessionCookieDataImpl.DEFAULT.isSecure();
ApplicationContext ac = getApplicationContext();
if (ac instanceof ApplicationContextSupport) {
ApplicationContextSupport acs = (ApplicationContextSupport) ac;
SessionCookieData data = acs.getSessionCookie();
if (data != null) {
// expires
TimeSpan ts = data.getTimeout();
if (ts != null)
tsExpires = ts;
// httpOnly
httpOnly = data.isHttpOnly();
// secure
secure = data.isSecure();
// domain
String tmp = data.getDomain();
if (!StringUtil.isEmpty(tmp, true))
domain = tmp.trim();
}
}
int expires;
long tmp = tsExpires.getSeconds();
if (Integer.MAX_VALUE < tmp)
expires = Integer.MAX_VALUE;
else
expires = (int) tmp;
cookieScope().setCookieEL(KeyConstants._cfid, cfid, expires, secure, "/", domain, httpOnly, true, false);
cookieScope().setCookieEL(KeyConstants._cftoken, cftoken, expires, secure, "/", domain, httpOnly, true, false);
}
use of lucee.runtime.listener.ApplicationContext in project Lucee by lucee.
the class WSClient method getInstance.
public static WSClient getInstance(PageContext pc, String wsdlUrl, String username, String password, ProxyData proxyData) throws PageException {
pc = ThreadLocalPageContext.get(pc);
if (pc != null) {
Log l = pc.getConfig().getLog("application");
ApplicationContext ac = pc.getApplicationContext();
if (ac != null) {
if (ApplicationContext.WS_TYPE_JAX_WS == ac.getWSType()) {
l.info("RPC", "using JAX WS Client");
return new JaxWSClient(wsdlUrl, username, password, proxyData);
}
if (ApplicationContext.WS_TYPE_CXF == ac.getWSType()) {
l.info("RPC", "using CXF Client");
return new CXFClient(wsdlUrl, username, password, proxyData);
}
}
l.info("RPC", "using Axis 1 RPC Client");
}
return new Axis1Client(wsdlUrl, username, password, proxyData);
}
Aggregations