Yeah, I think method signature is correct. Following is my method.
---------------------------------------------------------------------
public static String checkAccess(HttpServletRequest
request,HttpServletResponse response){
Security security =
(Security)request.getAttribute("security");
String key = "_EVENT_MESSAGE_";
if (security.hasPermission("LEARN_VIEW",
request.getSession()))
{
request.setAttribute(key, "You have access!");
}
else {
request.setAttribute(key, "You DO NOT have access! You
are denied!");
}
return "success";
}
---------------------------------------------------------------------
Scott Gray-2 wrote:
>
> Is the method signature correct? i.e. does it look like this:
> public static String checkAccess(HttpServletRequest request,
> HttpServletResponse response) {
>
> Regards
> Scott
>
> On 4/09/2009, at 1:36 AM, su2 wrote:
>
>>
>> Yeah I was able to figure out that because if I remove <event> call,
>> It was
>> going to the screen. But I am not sure why it is not able find my
>> method in
>> the java class.
>>
>> Scott Gray-2 wrote:
>>>
>>> Your problem is right there:
>>>> java.lang.NoSuchMethodException:
>>>> org
>>>> .ofbiz
>>>> .test
>>>> .test.TestEvents.checkAccess(javax.servlet.http.HttpServletRequest,
>>>> javax.servlet.http.HttpServletResponse)
>>> it can't find the checkAccess method in the TestEvents class
>>>
>>> Regards
>>> Scott
>>>
>>> On 4/09/2009, at 12:54 AM, su2 wrote:
>>>
>>>>
>>>> Hi Scott,
>>>>
>>>> I tried changing screen render at error (<response name="error"
>>>> type="view"
>>>> value="CheckAccess"/> ) and I got the following error.
>>>>
>>>> ---------------------------------------------------------------------------------------------
>>>> The Following Errors Occurred:
>>>>
>>>> Error calling event: org.ofbiz.webapp.event.EventHandlerException:
>>>> Problems
>>>> processing event: java.lang.NoSuchMethodException:
>>>> org
>>>> .ofbiz
>>>> .test
>>>> .test.TestEvents.checkAccess(javax.servlet.http.HttpServletRequest,
>>>> javax.servlet.http.HttpServletResponse)
>>>> (org
>>>> .ofbiz
>>>> .test
>>>> .test.TestEvents.checkAccess(javax.servlet.http.HttpServletRequest,
>>>> javax.servlet.http.HttpServletResponse))
>>>> ---------------------------------------------------------------------------------------------
>>>>
>>>> And in log I do not see any error/warning regarding CheckAccess.
>>>>
>>>> Thank you for your help.
>>>>
>>>>
>>>> Scott Gray-2 wrote:
>>>>>
>>>>> Check the logs, if the event is throwing an exception or
>>>>> returning a
>>>>> string other than "success" then the success view won't be
>>>>> rendered.
>>>>>
>>>>> Regards
>>>>> Scott
>>>>>
>>>>> HotWax Media
>>>>> http://www.hotwaxmedia.com
>>>>>
>>>>> On 3/09/2009, at 8:39 AM, su2 wrote:
>>>>>
>>>>>>
>>>>>> Hello All,
>>>>>>
>>>>>> I have a request-map where I am calling a java event.
>>>>>>
>>>>>> ------------------------------------------------------------------
>>>>>> <request-map uri="CheckAccess">
>>>>>> <security auth="true"/>
>>>>>> <event type="java" path="org.ofbiz.test.test.testEvents"
>>>>>> invoke="checkAccess"/>
>>>>>> <response name="success" type="view" value="CheckAccess"/>
>>>>>>
>>>>>> </request-map>
>>>>>> ------------------------------------------------------------------
>>>>>>
>>>>>> When I try to access the screen it goes to correct uri but
>>>>>> screen is
>>>>>> blank.
>>>>>> And when I remove <event>. It shows the screen(of course not with
>>>>>> the
>>>>>> process which is in java event).
>>>>>>
>>>>>> I have jar file class-path in ofbiz-component.xml file.
>>>>>>
>>>>>> I would really appreciate the help.
>>>>>>
>>>>>> Thanks in advance.
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://www.nabble.com/blank-screen-while-calling-java-event-tp25265335p25265335.html
>>>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/blank-screen-while-calling-java-event-tp25265335p25275391.html
>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>
>>>
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/blank-screen-while-calling-java-event-tp25265335p25276204.html
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>
>
>
>
>
--
View this message in context:
http://www.nabble.com/blank-screen-while-calling-java-event-tp25265335p25276394.html
Sent from the OFBiz - User mailing list archive at Nabble.com.