Is it possible to invalidate a spring security session?

You can’t usually invalidate a user session(s) immediately you change their account information without resorting to a container specific API, since the only way to access the HttpSession is through the HttpServletRequest object. Instead you can cache the username in an in-memory store and consult it either in a filter or a custom AccessDecisionVoter. Using … Read more

How to use HttpServletRequest#getParts() in a servlet filter running on Tomcat?

In order to get HttpServletRequest#getParts() to work in a Filter in Tomcat, you need to set allowCasualMultipartParsing=”true” in the webapp’s <Context> element in Webapp/META-INF/context.xml or Tomcat/conf/server.xml. <Context … allowCasualMultipartParsing=”true”> Because as per the servlet 3.0 specification the HttpServletRequest#getParts() should only be available inside a HttpServlet with the @MultipartConfig annotation. See also the documentation of the … Read more

How to pass tomcat port number on command line?

Change your server.xml so that it will use port numbers expanded from properties instead of hardcoded ones: <Server port=”${port.shutdown}” shutdown=”SHUTDOWN”> … <Connector port=”${port.http}” protocol=”HTTP/1.1″/> … </Server> Here’s how you can start in Linux (assuming your current directory is CATALINA_HOME): JAVA_OPTS=”-Dport.shutdown=8005 -Dport.http=8080″ bin/startup.sh In windows it should be smth like following: set “JAVA_OPTS=-Dport.shutdown=8005 -Dport.http=8080” bin\startup.bat

Where is the deployment directory in Eclipse?

I’m developing a web app in Eclipse. where is the deployment directory tree situated? In the Apache directory structure or some sub-directory tree structure in my Java workspace tree? It all depends on how your Tomcat Server is configured. The default should be: .metadata/.plugins/org.eclipse.wst.server.core/tmp0. But you can change this in the Tomcat server configuration. To … Read more

Why does Intellij-IDEA ignore my tomcat/conf/server.xml Context tag?

By default IntelliJ IDEA modifies CATALINA_BASE environment so that Tomcat uses adjusted configuration files for deploying applications directly from the artifact output location, however it’s possible to override this behavior and configure everything manually (either by changing the artifact output to go into webapps or by changing the server configuration in the same way IDEA … Read more