I am using execAndWait interceptor and it seems the session is lost after the interceptor..
my code is - struts-lcms.xml
...
<action name="testAction" class="com.lcms.presentation.TestAction">
<interceptor-ref name="execAndWait"></interceptor-ref>
<param name="delay">3000</param>
<param name="delaySleepInterval">50</param>
<result name="wait" type="tiles">tiles.ques</result>
<result name="success" type="tiles">tiles.ques</result>
<result name="diag" type="redirectAction">diagnosticAction</result>
</action>
...
If I remove the interceptor code then it takes me to the question page (tiles.ques) .. However, with the interceptor the session is null..
This code in execute method in the TestAction file
SessionObject sess = (SessionObject)getSession().getAttribute(LcmsConstants.SESSION_OBJECT);
it gives the session correctly if the interceptor is not used.. however, if the interceptor code is used then it throws NULL pointer exception..
Please tell me how to overcome this problem..
implements SessionAware
http://struts.apache.org/2.0.6/struts2-core/apidocs/org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.html
Important: Because the action will be running in a seperate thread, you can't use ActionContext because it is a ThreadLocal. This means if you need to access, for example, session data, you need to implement SessionAware rather than calling ActionContext.getSesion().
mention in struts.xml as
<interceptor-stack name="loadingStack">
<interceptor-ref name="completeStack" />
<interceptor-ref name="execAndWait">
<param name="delay">1000</param>
<param name="delaySleepInterval">500</param>
</interceptor-ref>
</interceptor-stack>
<interceptor-ref name="loadingStack"/>
<result name="wait">ETAX/TDS/wait.jsp</result>
it is working fine on my machine
Related
I am exposing a REST endpoint to control Camel Routes:
<get uri="/camel/route/{id}" produces="text/plain">
<description>stop a camel route by its ID</description>
<param name="id" type="path" description="Route ID" dataType="string"/>
<param name="action" type="query" description="Action to take" dataType="string"/>
<responseMessage message="OK" code="200" />
<to uri="controlbus:route?routeId=${header.id}&action=${header.action}"/>
</get>
But the control bus seems fail to resolve ID and Action as it log as:
ControlBusProducer - ControlBus task done [${header.action} route ${header.id}] with result -> void
How do I resolve REST path and query parameters in the route?
Expressions such as ${header.action} are not evaluated in <to> processors. If you are using a recent version of Camel use <toD> instead. If that's not available in your version, <recipientList> can do the job.
http://camel.apache.org/how-to-use-a-dynamic-uri-in-to.html
class="org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager">
<param name="driver" value="org.postgresql.Driver" />
<param name="url" value="jdbc:postgresql://192.168.1.200:5433/NEWDMS" />
<param name="user" value="postgres" />
<param name="password" value="eminence" />
<param name="schema" value="postgresql" />
<param name="schemaObjectPrefix" value="${wsp.name}_" />
<param name="externalBLOBs" value="false" />
</PersistenceManager>
I have created a transient Repository and done changes in repository.xml file
while accessing jackrabbit repository i am getting following exception : org.apache.jackrabbit.core.state.ItemStateException: failed to read bundle: deadbeef-face-babe-cafe-babecafebabe
java.lang.IllegalArgumentException: Invalid namespace index: 3158064
The "failed to read bundle: deadbeef-face-babe..." message is a symptom of a repository inconsistency. Start with these knowledge base articles: Fix the "jcr:system" node, Consistency Check, and Tar Data File Rotation. The third link highlights this configuration parameter of the persistence manager that might be of interest (although I see that you are not using the default TPM persistence manager, so it might not be relevant):
<param name="maxFileSize" value="512" />
I can pass parameter in Struts 2 (GAE app) Url something like below:
http://localhost:8888/user/jr
http://localhost:8888/user/jr#jrgalia
But i got an error for
http://localhost:8888/user/jr#jrgalia.com
How to allow to pass parameter with dot character?
Below is in struts.xml
....
<constant name="struts.enable.SlashesInActionNames" value="true"/>
<constant name="struts.mapper.alwaysSelectFullNamespace" value="false"/>
...
<action name="/user/*" class="LinkAction" method="usersLink">
<param name="userName">{1}</param>
<result>
<param name="location">/index.jsp</param>
<param name="parse">false</param>
<param name="encode">false</param>
</result>
</action>
Below is the error:
HTTP ERROR 404
Problem accessing /user/jr#jrgalia.com. Reason:
NOT_FOUND
Powered by Jetty://
when i debug my GAE application on localhost, how can i save the log created with Logger class to file? I can see it in console now(stderr) but dont want to redirct console to file. I found some solutions for python but cant make it work for java. Please can you help me?
Add an ApplicationAppender in your log.xml setting file:
<appender name="applicationAppender" class="org.apache.log4j.DailyRollingFileAppender">
<param name="encoding" value="UTF-8"/>
<param name="file" value="C:/logs/yourlogname.log"/>
<param name="DatePattern" value="'.'yyyy-MM-dd" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{HH:mm:ss} %-5p %l - %m%n" />
</layout>
</appender>
This is for log4j, but it is a standard logging paradigm. Also you need to have your logger definition use the appender you create.
In Linux and OSX, you can use tee to direct output to a file while still making it visible on standard out:
my_command | tee filename
How I stop Jackrabbit using SimpleSecurityManager?
I'm trying to call session.getUserManager() but I get a repository exception as SimpleSecurityManager.getUserManager() explicity throws it.
<Security appName="Jackrabbit">
<SecurityManager class="org.apache.jackrabbit.core.DefaultSecurityManager" workspaceName="security">
</SecurityManager>
<AccessManager class="org.apache.jackrabbit.core.security.simple.SimpleAccessManager">
<!-- <param name="config" value="${rep.home}/access.xml"/> -->
</AccessManager>
<LoginModule class="org.apache.jackrabbit.core.security.authentication.DefaultLoginModule">
<param name="anonymousId" value="anonymous"/>
<param name="adminId" value="admin"/>
</LoginModule>
</Security>
Rest of code for those that will ask...
Repository repository = new TransientRepository();
Session jackrabbitSession = repository.login(credentials);
UserManager userManager = session.getUserManager();
The user manager is a Jackrabbit extension. It's not a part of the JCR. So, you need to use a JackrabbitSession, not just a Session. Here's a link to the wiki:
http://wiki.apache.org/jackrabbit/UserManagement