docker run --name my-own-name -p 5432:5432 -e POSTGRES_PASSWORD=myownpassword -d postgres netstat -pan | grep 5432
Category: Tech
How to specify another webapps directory in tomcat
in conf/server.xml
Method 1: Define a Task that implements Callable Method 2: Use Java 8 Lambda Method 3: Use RxJava Method 4: Multiples
Two Spring Security Filter Chain Lists
( Called earlier -> later ) MetadataGeneratorFilter OncePerRequestFilter WebAsyncManagerIntegrationFilter SecurityContextPersistenceFilter OncePerRequestFilter HeaderWriterFilter LogoutFilter AbstractAuthenticationProcessingFilter DefaultLoginPageGeneratingFilter BasicAuthenticationFilter SAMLProcessingFilter ( Called earlier -> later ) BasicUserApprovalFilter SecurityContextPersistenceFilter LogoutFilter UsernamePasswordAuthenticationFilter BasicAuthenticationFilter RequestCacheAwareFilter SecurityContextHolderAwareRequestFilter RememberMeAuthenticationFilter ForgotPasswordAuthenticationFilter AnonymousAuthenticationFilter SessionManagementFilter ExceptionTranslationFilter OAuth2ExceptionHandlerFilter VerificationCodeFilter OAuth2AuthorizationFilter OAuth2ProtectedResourceFilter FilterSecurityInterceptor
Add HttpSessionListener to embedded jetty
then,
attach a volume to CentOS in Amazon AWS
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-using-volumes.html 6 df -a 7 lsblk 8 sudo file -s /dev/xvdf 9 sudo mkfs -t ext4 /dev/xvdf 10 sudo mkdir /data 11 sudo mount /dev/xvdf /data 12 df -a 13 sudo cp /etc/fstab /etc/fstab.orig 14 sudo vi /etc/fstab 15 df -a 16 sudo mount -a
REST API with Tomcat and Jersey, Part 3
The earlier example code I found returns a (javax.ws.rs.core.)Response object, which contains a String. For my project I need to return a Java Object in JSON format. It turns out that this is not built in by default, we need to configure the following:
REST API with Tomcat and Jersey, part 2
I have to use old style authentication with this project, and the user authentication information is stored in cookies (Ugh! I know). So for the REST APIs to read cookies to make sure an incoming request is valid (logged in), we can use
Combine multiple jars into one
To combine multiple (say 20+) jar files, for example all jersey related, into one large jar file, for easier tomcat deployment, one can do the following with ANT: (assuming ant is already installed) 1: create a temporary directory: C:\tmp 2: copy all the jar files into C:\tmp\lib 3: create a new file, C:\tmp\build.xml 4: in… Continue reading Combine multiple jars into one
REST API on Tomcat: Jersey 2, the most basic setup
I have been using Apache CXF on tomcat for years, for its excellent SOAP support. Finally decided to switch to REST, and tried to get Jersey 2 to work, side by side with CXF. 1) in web.xml, add 2) Write a REST handler: 3) With the above two, and all the required jars in Tomcat's… Continue reading REST API on Tomcat: Jersey 2, the most basic setup