Page 1 of 1

What is @param ctx context

PostPosted: Thu Nov 17, 2005 4:04 pm
by sunilverma
Hi All

I found that ctx is a Propreties object which is passed in various methods including constructor of PO class which is responsible for creating persisting object.

Here is code from PO.java

public PO (Properties ctx)
{
this (ctx, 0, null, null);
} // PO

Can some one please help me in finding out where these Properties are set or coming from ?

Thanx in advance

Regards,
Sunil

PostPosted: Thu Nov 17, 2005 7:44 pm
by new_soft
Hi Sunil,
the ctx variable is defined in WebSessionCtx:
private WebSessionCtx (HttpServletRequest request)
{
log.info (request.getContextPath() + " (" + request.getRemoteAddr()
+ " - " + request.getLocale() + ") #" + counter);
ctx = new Properties();
setLanguage(request);

HttpSession session = request.getSession(false);

// Add Servlet Init Parameters (webStore/src/web/WEB-INF/web.xml)
ServletContext sc = session.getServletContext();
Enumeration en = sc.getInitParameterNames();
while (en.hasMoreElements())
{
String key = (String)en.nextElement();
String value = sc.getInitParameter(key);
ctx.setProperty(key, value);
log.config (key + "=" + value);
}

setWStore (request.getContextPath());
ctx = getDefaults ();

// ServerContext - dev2/wstore
ctx.put(CTX_SERVER_CONTEXT, request.getServerName() + request.getContextPath());
// Make Context directly availabe to jsp's
session.setAttribute("ctx", ctx);
//
log.fine("#" + ctx.size());
} // WebSessionCtx


But There is another context variable wich are defined in Env.java : it's the variable where compiere save the context of one client.

Hope that help

PostPosted: Thu Nov 17, 2005 9:25 pm
by sunilverma
Thanks Khaled

I was a great help

Regards
Sunil

PostPosted: Thu Nov 17, 2005 9:28 pm
by sunilverma
Oops!

That was 'slip of fingure' I missed the 't'

Thanks again

Regards

Sunil

PostPosted: Thu Nov 17, 2005 11:30 pm
by new_soft
Hi,
:lol:
But let us know if it's the right answer or not? If it solve your problem?