use of org.compiere.util.WebInfo in project adempiere by adempiere.
the class WorkflowServlet method doGet.
/**
* Process the HTTP Get request.
* Sends Web Request Page
*
* @param request request
* @param response response
* @throws ServletException
* @throws IOException
*/
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
log.info("doGet from " + request.getRemoteHost() + " - " + request.getRemoteAddr() + " - forward to notes.jsp");
String url = "/notes.jsp";
//
HttpSession session = request.getSession(false);
if (session == null || session.getAttribute(WebInfo.NAME) == null)
url = "/login.jsp";
else {
session.removeAttribute(WebSessionCtx.HDR_MESSAGE);
WebInfo info = (WebInfo) session.getAttribute(WebInfo.NAME);
if (info != null)
info.setMessage("");
// Parameter = Activity_ID - if valid and belongs to wu then create PDF & stream it
String msg = streamAttachment(request, response);
if (msg == null || msg.length() == 0)
return;
if (info != null)
info.setMessage(msg);
}
log.info("doGet - Forward to " + url);
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url);
dispatcher.forward(request, response);
}
use of org.compiere.util.WebInfo in project adempiere by adempiere.
the class Generator method generateSessionEquiv.
private void generateSessionEquiv(HttpServletCM thisServlet, HttpServletRequest httpRequest, Properties ctx) {
xmlCode.append("<session>\n");
HttpSession thisSession = httpRequest.getSession(false);
if (thisSession != null) {
if (thisSession.getAttribute(WebInfo.NAME) != null) {
WebInfo wi = (WebInfo) thisSession.getAttribute(WebInfo.NAME);
xmlCode.append("<WebInfo>\n");
xmlCode.append("<Info><![CDATA[" + wi.getInfo() + "]]></Info>\n");
if (wi.getUser_ID() > 0) {
MUser thisUser = MUser.get(ctx, wi.getAD_User_ID());
xmlCode = thisUser.get_xmlString(xmlCode);
MBPartner thisBPartner = new MBPartner(ctx, wi.getC_BPartner_ID(), null);
if (thisBPartner != null)
xmlCode = thisBPartner.get_xmlString(xmlCode);
MBPartnerLocation thisBPartnerLocation = thisBPartner.getPrimaryC_BPartner_Location();
if (thisBPartnerLocation != null)
xmlCode = thisBPartnerLocation.get_xmlString(xmlCode);
MLocation thisLocation = MLocation.getBPLocation(ctx, thisBPartnerLocation.get_ID(), null);
if (thisLocation != null)
xmlCode = thisLocation.get_xmlString(xmlCode);
MBPBankAccount[] theseBPBankAccount = thisBPartner.getBankAccounts(true);
if (theseBPBankAccount != null && theseBPBankAccount.length > 0)
for (int i = 0; i < theseBPBankAccount.length; i++) xmlCode = theseBPBankAccount[i].get_xmlString(xmlCode);
if (thisSession.getAttribute("EMail") == null)
thisSession.setAttribute("EMail", thisUser.getEMail());
}
if (wi.getWebUser().getPasswordMessage() != null) {
xmlCode.append("<PasswordMessage><![CDATA[" + wi.getWebUser().getPasswordMessage() + "]]></PasswordMessage>\n");
wi.getWebUser().setPasswordMessage(null);
}
if (wi.getWebUser().getSaveErrorMessage() != null) {
xmlCode.append("<SaveErrorMessage><![CDATA[" + wi.getWebUser().getSaveErrorMessage() + "]]></SaveErrorMessage>\n");
wi.getWebUser().setSaveErrorMessage(null);
}
if (thisSession.getAttribute("hdrMessage") != null) {
xmlCode.append("<hdrMessage><![CDATA[" + thisSession.getAttribute("hdrMessage") + "]]></hdrMessage>\n");
thisSession.removeAttribute("hdrMessage");
}
xmlCode.append("<WebUser>\n");
xmlCode.append("<LoggedIn>" + wi.getWebUser().isLoggedIn() + "</LoggedIn>\n");
xmlCode.append("</WebUser>\n");
xmlCode.append("</WebInfo>\n");
}
if (thisSession.getAttribute("EMail") != null)
xmlCode.append("<EMail><![CDATA[" + thisSession.getAttribute("EMail") + "]]></EMail>\n");
}
xmlCode.append("</session>\n");
}
use of org.compiere.util.WebInfo in project adempiere by adempiere.
the class InfoLinkTag method doStartTag.
// setOneLine
/**
* Start Tag
* @return SKIP_BODY
* @throws JspException
*/
public int doStartTag() throws JspException {
HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
// creates wsc/wu
Properties ctx = JSPEnv.getCtx(request);
WebSessionCtx wsc = WebSessionCtx.get(request);
//
HttpSession session = pageContext.getSession();
WebUser wu = (WebUser) session.getAttribute(WebUser.NAME);
if (wu != null && wu.isLoggedIn()) {
if (ctx != null) {
WebInfo info = (WebInfo) session.getAttribute(WebInfo.NAME);
if (info == null || wu.getAD_User_ID() != info.getAD_User_ID()) {
info = new WebInfo(ctx, wu);
session.setAttribute(WebInfo.NAME, info);
}
}
//
// log.fine("WebUser exists - " + wu);
//
JspWriter out = pageContext.getOut();
HtmlCode html = new HtmlCode();
//
if (wu.isCustomer() || wu.isVendor())
menuBPartner(html, wsc.wstore);
if (wu.isSalesRep())
menuSalesRep(html, wsc.wstore);
if (wu.isEmployee() || wu.isSalesRep())
menuUser(html, wu.isEmployee(), wsc.wstore);
menuAll(html, wsc.wstore);
//
html.output(out);
} else {
if (CLogMgt.isLevelFiner())
log.fine("No WebUser");
if (session.getAttribute(WebInfo.NAME) == null)
session.setAttribute(WebInfo.NAME, WebInfo.getGeneral());
}
return (SKIP_BODY);
}
use of org.compiere.util.WebInfo in project adempiere by adempiere.
the class RfQServlet method doGet.
/**
* Process the HTTP Get request
* Sends Web Request Page
*
* @param request request
* @param response response
* @throws ServletException
* @throws IOException
*/
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
log.info("doGet from " + request.getRemoteHost() + " - " + request.getRemoteAddr());
String url = "/rfqs.jsp";
//
HttpSession session = request.getSession(false);
if (session == null || session.getAttribute(WebInfo.NAME) == null)
url = "/login.jsp";
else {
session.removeAttribute(WebSessionCtx.HDR_MESSAGE);
WebInfo info = (WebInfo) session.getAttribute(WebInfo.NAME);
if (info != null)
info.setMessage("");
// Parameter = Note_ID - if is valid create PDF & stream it
String msg = streamAttachment(request, response);
if (msg == null || msg.length() == 0)
return;
if (info != null)
info.setMessage(msg);
}
log.info("doGet - Forward to " + url);
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url);
dispatcher.forward(request, response);
}
use of org.compiere.util.WebInfo in project adempiere by adempiere.
the class RequestServlet method doGet.
/**
* Process the HTTP Get request.
* Sends Attachment
*
* @param request request
* @param response response
* @throws ServletException
* @throws IOException
*/
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
log.info("From " + request.getRemoteHost() + " - " + request.getRemoteAddr());
String url = "/requestDetails.jsp";
//
HttpSession session = request.getSession(false);
if (session == null || session.getAttribute(WebInfo.NAME) == null)
url = "/login.jsp";
else {
session.removeAttribute(WebSessionCtx.HDR_MESSAGE);
WebInfo info = (WebInfo) session.getAttribute(WebInfo.NAME);
if (info != null)
info.setMessage("");
// Parameter = Note_ID - if is valid and belongs to wu then create PDF & stream it
String msg = streamAttachment(request, response);
if (msg == null || msg.length() == 0)
return;
if (info != null)
info.setMessage(msg);
}
log.info("Forward to " + url);
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url);
dispatcher.forward(request, response);
}
Aggregations