Search in sources :

Example 26 with ApplicationContext

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;
}
Also used : ApplicationContext(lucee.runtime.listener.ApplicationContext) Key(lucee.runtime.type.Collection.Key) ExpressionException(lucee.runtime.exp.ExpressionException)

Example 27 with ApplicationContext

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);
}
Also used : TimeSpan(lucee.runtime.type.dt.TimeSpan) ApplicationContextSupport(lucee.runtime.listener.ApplicationContextSupport) ClassicApplicationContext(lucee.runtime.listener.ClassicApplicationContext) ApplicationContext(lucee.runtime.listener.ApplicationContext) SessionCookieData(lucee.runtime.listener.SessionCookieData)

Example 28 with ApplicationContext

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);
}
Also used : ApplicationContext(lucee.runtime.listener.ApplicationContext) Log(lucee.commons.io.log.Log)

Aggregations

ApplicationContext (lucee.runtime.listener.ApplicationContext)28 MemoryScope (lucee.runtime.type.scope.storage.MemoryScope)10 StorageScope (lucee.runtime.type.scope.storage.StorageScope)10 HttpSession (javax.servlet.http.HttpSession)6 DataSource (lucee.runtime.db.DataSource)4 ApplicationContextSupport (lucee.runtime.listener.ApplicationContextSupport)4 Key (lucee.runtime.type.Collection.Key)4 CacheConnection (lucee.runtime.cache.CacheConnection)3 ExpressionException (lucee.runtime.exp.ExpressionException)3 PageException (lucee.runtime.exp.PageException)3 TimeSpan (lucee.runtime.type.dt.TimeSpan)3 IKHandlerCache (lucee.runtime.type.scope.storage.IKHandlerCache)3 IKHandlerDatasource (lucee.runtime.type.scope.storage.IKHandlerDatasource)3 IOException (java.io.IOException)2 Map (java.util.Map)2 Resource (lucee.commons.io.res.Resource)2 RefBooleanImpl (lucee.commons.lang.types.RefBooleanImpl)2 ApplicationException (lucee.runtime.exp.ApplicationException)2 ClassicApplicationContext (lucee.runtime.listener.ClassicApplicationContext)2 ModernApplicationContext (lucee.runtime.listener.ModernApplicationContext)2