Here is an example:
public static String deletePermission(HttpServletRequest request, HttpServletResponse response) {
LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin");
String permissionId = (String)request.getParameter("permissionId");
Debug.logInfo("In deletePermission permissionId=" + permissionId, module);
try {
dispatcher.runSync("removePermission", UtilMisc.toMap("permissionId", permissionId));
} catch (GenericServiceException e) {
return ModelService.RESPOND_ERROR;
}
return ModelService.RESPOND_SUCCESS;
}
regards,
Mathius Allo
----- Original Message ----
From: X Gylee <
[hidden email]>
To:
[hidden email]
Sent: Monday, November 19, 2007 7:01:58 PM
Subject: How to access session and request from Java service
In services.xml, I defined a service of type "java". According to
OFBiz documentation, this service received DispatchContext and Map as
its parameters.
How can I access the HTTP session and request from those input
parameters?
I could not find an example in the OFBiz source about it. All the
codes in the source use the event of type "java" in controller.xml,
and this obviously provides HttpServletRequest as one of its input
parameters.
____________________________________________________________________________________
Be a better pen pal.
Text or chat with friends inside Yahoo! Mail. See how.
http://overview.mail.yahoo.com/