Chuyển đến nội dung chính

Bài đăng

[Shiro][Spring-MVC] Apache Shiro with Spring framework, Java config and WebApplicationInitializer

Recently I was adding  Apache Shiro  security framework to Spring based web application which is using Java config and doesn't have xml configuration at all, not even web.xml Apache Shiro documentation is mostly using xml examples so it took some time to put it all together in Java config based application. Central part of Shiro security is  a realm. Here is how official Shiro documentation defines realms: " A Realm is a component that can access application-specific security data such as users, roles, and permissions. The Realm translates this application-specific data into a format that Shiro understands so Shiro can in turn provide a single easy-to-understand  Subject  programming API no matter how many data sources exist or how application-specific your data might be ." Shiro comes with number of out-of-the-box Realm  implementations that connects directly to database, to LDAP, etc, but in this example we will use custom Realm ...

Compare Message Queue vs Webservice

STT Web Service Message Queue Notes 1 If the server fails the client must take responsibility to handle the error.  If the server fails, the queue persist the message (optionally, even if the machine shutdown). + Some Message Queue: RabbitMQ, Beanstalkd, ActiveMQ, IBM MQ Series, Tuxedo. + Web service: Restful, SOAP Service. 2  When the server is working again the client is responsible of resending it.  When the server is working again, it receives the pending message. 3  If the server gives a response to the call and the client fails the operation is lost.  If the server gives a response to the call and the client fails, if the client didn't acknowledge the response the message is persisted. 4  You don't have contention, that is: if million of clients call a web service on one server in a second, most probably your server will go down.  You have contentio...

[Source tree] Fix lỗi "***please tell me who you are"

Vào  Repository -> Repository Settings --> Advanced. Sửa thông tin  "Use global user settings" 

[Android Studio] Add *.jar file into project

Bước 1 : Copy tất cả *.jar vào thư mục libs   Bước 2 : Tại khu vực Navigator, chọn view ở mode Project : Bước 3 : Click chuột phải vào file *.jar trong thực mục libs , chọn ' Add as library ' Bước 4 : Trong file build.gradle của ứng dụng, thêm dòng: compile fileTree( include : [ '*.jar' ], dir : 'libs' ) Bước 5 : Clean Project và Build ------------------------------------ Step 1: Put the *.jar (example:  gson-2.2.4.jar ) into the  libs  folder Step 2: Right click it and hit 'Add as library' Step 3: Ensure that  compile files('libs/gson-2.2.4.jar')  is in your  build.gradle  file (or  compile fileTree(dir: 'libs', include: '*.jar')  if you are using many jar files) Step 4 : Do a clean build (you can probably do this fine in Android Studio, but to make sure I navigated in a terminal to the root folder of my app and typed  gradlew clean . I'm on Mac OS X, the command might be different on your s...

[LB-HA] Configuration Load balancing and High available on HA PROXY tool

Install HAProxy Load Balancer on CentOS Understand about High Available (HA) and Load Balancing Configuring the load balancer Setting up HAProxy for load balancing is a quite straight forward process. Basically all you need to do is tell HAProxy what kind of connections it should be listening for and which servers it should relay the connections to. This is done by creating a configuration file  /etc/haproxy/haproxy.cfg  with the defining settings. You can read about the configuration options at  HAProxy documentation  if you wish to find out more. Open a .cfg file for edit for example using  vi  with the following command sudo vi /etc/haproxy/haproxy.cfg Add the following sections to the the file. Replace the   with what ever you want to call you servers on the statistics page and the  > with the private IPs for the servers you wish to direct the web traffic to. You can check the private IPs at your  UpCloud Co...