[JBoss Seam] - Seam security working in Facelets but not via annotations
by omilian3
Hi,
Following the Seam reference, I've setup a login page using the identity management facilities. The log in works fine, and in my Facelets I can use the following successfully:
<s:div rendered="#{identity.loggedIn}">
| YOU ARE LOGGED IN
| </s:div>
I've also setup the JBoss Rules engine, so the following also works:
<s:div rendered="#{s:hasPermission('customer', 'delete', null)}">
| YOU HAVE CUSTOMER DELETE
| </s:div>
and;
<s:div rendered="#{s:hasRole('power')}">
| YOU HAVE POWER ROLE
| </s:div>
So far so good. These pages all reference a simple backing bean as follows:
| package au.gov.austrac.ao.prototype;
|
| import org.jboss.seam.annotations.In;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.security.Restrict;
| import org.jboss.seam.security.Identity;
|
| @Name("authenticator")
| public class ExampleAuthenticator {
|
| @In
| Identity identity;
|
| public String name = "bill";
|
| public String getName() {
| tryRulesEngine();
| return name;
| }
|
| public void setName(String name) {
| this.name = name;
| }
|
| @Restrict("#{identity.loggedIn}")
| public void tryRulesEngine() {
| System.out.println("logged in? " + identity.isLoggedIn());
| }
|
| public boolean authenticate() {
| identity.addRole("power");
| return true;
| }
| }
This bean is available under the name "authenticator" in my pages via the @Name annotation, and the authenticate() method is invoked by the identity code, so it would seem that the framework knows about this class and the Seam annotations are being invoked (at least @Name is), yet when I'm not logged in I can still access the tryRulesEngine() method. Note that the section of the page controlled by the first code snippet above is not displayed.
It appears that the @Restrict annotation is not working or is not being invoked?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4069842#4069842
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4069842
17Â years, 3Â months
[JBoss Portal] - IPC - Event not fired
by explorer
Hi,
I was trying to work with the example given for IPC but with some custom code of mine. I was not able to achieve any result. Please advice.
I have a myportal.sar where in i put the jboss-service.xml with the following code.
| <server>
| <mbean
| code="org.jboss.portal.core.event.PortalEventListenerServiceImpl"
| name="portal:service=ListenerService,type=PortalInitListener"
| xmbean-dd=""
| xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
| <xmbean/>
| <depends
| optional-attribute-name="Registry"
| proxy-type="attribute">portal:service=ListenerRegistry</depends>
| <attribute name="RegistryId">PortalInitListener</attribute>
| <attribute name="ListenerClassName">
| gov.sba.bgportal.jboss.examples.PortalInitService
| </attribute>
| </mbean>
| <mbean
| code="org.jboss.portal.core.event.PortalEventListenerServiceImpl"
| name="portal:service=ListenerService,type=NodeEventListener"
| xmbean-dd=""
| xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
| <xmbean/>
| <depends
| optional-attribute-name="Registry"
| proxy-type="attribute">portal:service=ListenerRegistry</depends>
| <attribute name="RegistryId">NodeEventListener</attribute>
| <attribute name="ListenerClassName">
| gov.sba.bgportal.jboss.examples.MyEventPortlet$Listener
| </attribute>
| </mbean>
| </server>
|
My first listener PortalInitListener is of type PortalEventListener and works good for SessionEvents.
Second one is a PortalNodeEventListener. This never gets fired.
There are two portlets communicating the information through parameters.
FirstPortlet:
public class AlfrescoRenditionPrtlet extends GenericPortlet
| {
| protected void doView(RenderRequest rRequest, RenderResponse rResponse) throws PortletException, IOException, UnavailableException
| {
| String renditionFileURL = rRequest.getPreferences().getValue("renditionFileURL", "/AdminHome/404.html");
| String PropegatedValue = rRequest.getParameterMap().toString();
| String s = "parameterMAP AlfrescoRenditionPrtlet ---->"+PropegatedValue;
| String s1 = "fromContext AlfrescoRenditionPrtlet ---->"+getPortletContext().getAttribute("fromContext");
| rResponse.setContentType("text/html");
| PrintWriter writer = rResponse.getWriter();
| writer.println("<form action=\"" + rResponse.createActionURL() + "\" method=\"post\">");
| writer.println("<input type=\"text\" name=\"EventPropegatedValue\" value=\"Hidden value from PortletItSelf\"/> ");
| writer.println("<input type=\"submit\"/>");
| writer.println("</form><br>");
| writer.println(s+"<br>"+s1);
| writer.close();
| }
| }
|
SecondPortlet:
| public void processAction(ActionRequest request, ActionResponse response) {
| String PropegatedValue = request.getParameter("EventPropegatedValue");
| response.setRenderParameter("PropegatedValue", PropegatedValue);
| }
|
| protected void doView(RenderRequest rRequest, RenderResponse response) throws PortletException, IOException, UnavailableException
| {
| String PropegatedValue = rRequest.getParameterMap().toString();
| String s = "PropegatedValue MyEventPortlet ---->"+PropegatedValue;
| String renditionFileURL = rRequest.getPreferences().getValue("renditionFileURL", "/AdminHome/404.html");
| String s1 = "fromContext MyEventPortlet ---->"+getPortletContext().getAttribute("fromContext");
| response.setContentType("text/html");
| PrintWriter writer = response.getWriter();
| writer.println(s+"<br>"+s1);
| writer.close();
| }
|
Listener:
| public static class Listener implements PortalNodeEventListener{
| public PortalNodeEvent onEvent(PortalNodeEventContext context, PortalNodeEvent event) {
| PortalNode node = event.getNode();
| String nodeName = node.getName();
| WindowActionEvent newEvent = null;
| if (nodeName.equals("ARPWindow1") && event instanceof WindowActionEvent)
| {
| WindowActionEvent wae = (WindowActionEvent)event;
| PortalNode window2 = node.resolve("../MEPWindow2");
| if (window2 != null)
| {
| newEvent = new WindowActionEvent(window2);
| Map map = new HashMap<Object,Object>();
| map.put("EventPropegatedValue", "~~~~~This is the value~~~~");
| map.putAll(wae.getParameters());
| newEvent.setParameters(map);
| }
| }
| if (newEvent != null)
| {
| return newEvent;
| }
| else
| {
| return context.dispatch();
| }
| }
| }
|
I am unable to locate the problem. Any one there to advice me.
Any sort of help is thanked.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4069838#4069838
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4069838
17Â years, 3Â months
[JBoss Messaging] - onMessage not being fired for message on a queue
by HibsMax
Hi, Group.
This question is vague and I apologise for that up front. I'm mainly looking for pointers to help me determine where to start looking.
I have an application that:
1. produces a message
2. writes the message to a database
3. pushes the message to queue
4. update the record in the database
5. sends the message to a topic
6. a consumer then consumes the messages on the topic
steps 1-3 happen in a servlet running on server1
steps 4-5 happen in the onMessage method in an MDB running on server2
All the messages make it to the database so I know that steps 1, 2 and 3 are all working. I have a debug statement in the onMessage method and I can see that it's not being called for every message e.g. I send 450 messages but the onMessage is only executed 210 times. When I look in the JBM_MSG table I see what I believe are the missing messages (I check the headers column using the SQL below).
Can anyone suggest a reason why the onMessage method would not be called for every message? I know it's being called sometimes, just not all the time. I think I must be missing a config parameter or something.
I am using JBM 1.3 GA and Oracle.
Peace, Anders
SQL to check jbm_msg.headers:
SELECT UTL_RAW.CAST_TO_VARCHAR2 (DBMS_LOB.SUBSTR (headers))
FROM jbm_msg
/
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4069833#4069833
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4069833
17Â years, 3Â months
[JBossCache] - Performing cache operations while in a catch() section
by dfraser
Hi all,
the application I have written, when handling exceptions in one part, performs a cache operation (setting a node's value) to inform the other members of the cluster as to what is happening with a resource shared amongst the cluster.
everything looks and acts fine, then a minute or two later after the dust has settled, a warning pops up in server.log
17:56:19,454 WARN [TreeCache] status is 1 (not ACTIVE or PREPARING); returning null)
java.lang.Throwable
at org.jboss.cache.TreeCache.getCurrentTransaction(TreeCache.java:5805)
at org.jboss.cache.TreeCache.getCurrentTransaction(TreeCache.java:5775)
at org.jboss.cache.TreeCache.put(TreeCache.java:3831)
at sun.reflect.GeneratedMethodAccessor116.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy56.put(Unknown Source)
at com.mec.management.mbeans.TreeCacheFacade.setValue(TreeCacheFacade.java:296)
[and so on]
there are a few of these - it seems every cache related operation done while handling an exception has problems. there is a transaction timeout message before all this
17:55:17,034 WARN [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=xbod-app01.xb-online.com/37, BranchQual=, localId=37] timed out. status=STATUS_ACTIVE
the cache is in REPL_SYNC mode, but I don't know what else to say as I'm not sure what else is important
I am sensing that this general idea of using the cache to update information within catch() blocks is not a good idea. I am lost as how to deal with this - is there some general principles I should follow or should I move the cache operation out of the exception handling all together (and how to?)?
yeah, they're only warnings but they look important. If someone could possibly explain what is going on, I would greatly appreciate it
doug
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4069830#4069830
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4069830
17Â years, 3Â months