How to override session time out in spring web application - spring-security

I am writing an application in Spring to be deployed to a Cloudfoundry container and want to override the default tomcat session timeout value from the Java buildpack. What are the options available to me if I want it to be a configurable value outside my code? i.e. avoid the use of HttpSession.setMaxInactiveInterval(int).
set-env JAVA_OPTS -Dserver.session.timeout=30
some way in application properties?

It sounds like you are using Spring Boot. If so, you could set server.session.timeout=30 in an application.properties file that gets included with your app. This file is usually in /src/main/resources in the source tree and is bundled into the jar file at build time.

Related

Duplicated port of child tasks in Spring Cloud Data Flow

When I launch new task (Spring Batch Job) using Spring Cloud Data Flow, I see that SCDF auto initialize Tomcat with some "random" ports but I do not know if there ports are created randomly or following any rule of the framework?
Therefore, I sometime have a trouble that "Web server failed to start. Port 123456 was already in use".
In conclusion, my questions are:
1) How does the framework choose ports for initializing? (randomly or by principle)?
2) Are there anyway to launch task effectively without duplicated ports(fixed configuration or method for choosing unused port at particular time)?
I don't think SCDF has anything to do with the port assignment etc.,
It is your task application that gets launched. You need to decide whether you really need the web dependency that brings in the tomcat to your application.
Assuming you use Spring Boot, you can either exclude the web starter dependency in your dependencies or pass the command line arg server.port=<?> to a specific port when launching the task (if you really need this task app to be a web app).

How to keep log file in Spring Cloud Data Flow?

My Spring Cloud Data Flow deleted log file in folder after I stopped it.
Why SCDF does that and How can I keep these log files?
You can customize the logging configuration in the logback config file and pass it as a configuration properties for the SCDF server. Assuming you are trying this with the local data flow server, you can refer this documentation for logback configuration.

Adding IHS server details under ant script

I have an ant script to deploy the EAR file to my Websphere application server. This server is under clustered environment and has a cell with its respective nodes.
I also have an IHS server above this WAS instance which my application uses.
Requesting to kindly guide as to how the ant script can be used to deploy the EAR file on cluster by providing the required IHS server details.
Thanks
You should have a look at the section in $WASHOME/bin/configureWebserverDefinition.jacl that iterates through the existing web modules and maps them to the newly created webserver.
In Jython, from the manual:
AdminApp.edit('myapp', ['-MapModulesToServers',
[['.*', '.*', '-WebSphere:cell=mycell,node=mynode,server=server1']]])
But you'd need to substitue the full name for your webserver.

Is there a way make a Grails app aware of changes in properties file without server restart?

I've externalized the properties file for my production Grails app running on Tomcat.
I'm wondering if there is a way the Grails app will read the configs from the config file in real time instead of having the changes take affect only after server restart.
For example, I'm using the LDAP plugin which has the following config:
grails.plugin.springsecurity.ldap.context.managerDn = 'somethinghere'
If I change the above setting in the external config file the server needs to be restarted for it to take effect.
I googled "grails external reload" and the first result was http://grails.org/plugin/external-config-reload

How to specify Java Option (System Property) for embedded Tomcat while running Grails App?

Specifically, I want to have my grails app under development to connect to an Oracle db defined by an tnsnames.ora file. I have the tnsnames.ora file located in c:\drivers\Network\ on my PC. When I run the grails app via "grails run-war", the db connection string defined in the tnsnames.ora file doesn't seem to be picked up:
grails prod run-war -Dserver.port=62215 -Doracle.net.tns_admin=C:\drivers\Network\
It seems the name-value pair of oracle.net.tns_admin is not being passed to the JVM used by the the embedded Tomcat that comes with Grails 1.2.0. If not, what is the proper way of specifying it, or pass any JAVA_OPTS to the underlying JVM?
You're best off setting your JAVA_OPTS in the Grails startup script (%GRAILS_HOME%/bin/grails.bat). See this link for an example.

Resources