Web Development
Articles, notes, and tutorials filed under Web Development.
Latest articles
Showing 1-8 of 22Getting Started with JUnit 5: Test your Spring MVC Application with it
In this post, we described how to use JUnit 5 to test your Spring MVC application with Maven. Setup Maven Dependencies We can get the required dependencies by declaring the junit-jupiter-api (version 5.x) dependency in our pom.xml file. This dependency provides the public API for writing tests and extensions. <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-engine</artifactId> <version>5.1.0</version> <scope>test</scope> </dependency> If we are using an IDE that is bundled with an older JUnit 5 version, it throws an exception when we try to run our unit tests by using our IDE. We can fix this problem by adding the following dependency to our POM file:
Making Requests Non-blocking in Tornado
Tornado is one of the most popular web frameworks for Python, which is based on a single thread IO loop (aka event loop). You can handle high concurrency with optimal performance. However, Tornado is single-threaded (in its common usage, although it supports multiple threads in advanced configurations), therefore any “blocking” task will block the whole server. This means that a blocking task will not allow the framework to pick the next task waiting to be processed.
Configuring Apereo CAS
This tutorial is designed to help a new CAS user to set up the Apereo CAS server and client to their applications. The code of this tutorial is open-sourced on GitLab. What’s CAS? Enterprise Single Sign-On - CAS provides a friendly open source community that actively supports and contributes to the project. While the project is rooted in higher-ed open source, it has grown to an international audience spanning Fortune 500 companies and small special-purpose installations.
Create a Desktop App with Angular 2 and Electron
Last week, I took part in the Google Developer Day held in Beijing. The Angular team introduced their new Angular 2. Angular is a development platform for building mobile and desktop web applications. This tutorial shows how to configure and use Angular 2 web components with the Electron framework for creating native cross-platform applications with web technologies. As recommended by the Angular team, TypeScript will be used throughout this tutorial. TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. Any browser. Any host. Any OS. Open-source.
Use Server-Sent Event in Spring 4.2
Today, the Spring Framework was released to 4.2 RC2. In Spring 4.2, better application events and Server-Sent Event(SSE) are supported. In this article, I’ll introduce you to the two new features. What’s Server-Sent Event Server-sent events (SSE) is a technology where a browser receives automatic updates from a server via an HTTP connection. The Server-Sent Events EventSource API is standardized as part of HTML5 by the W3C. Server-sent event is a standard describing how servers can initiate data transmission toward clients once an initial client connection has been established. They are commonly used to send message updates or continuous data streams to a browser client and are designed to enhance native, cross-browser streaming through a JavaScript API called EventSource, through which a client requests a particular URL in order to receive an event stream.
Use WebSockets with Spring, SockJS and Stomp
This guide walks you through the process of creating a “hello world” application that sends messages back and forth, between a browser and the server. WebSocket is a very thin, lightweight layer above TCP. It makes it very suitable to use “subprotocols” to embed messages. In this guide, we’ll dive in and use STOMP messaging with Spring to create an interactive web application. Maven Dependencies First, we need to add the Spring messaging modules in the POM file:
Spring MVC MyBatis Integration Tutorial
Last few months, I’m working on a project with Spring MVC and Hibernate. Now, I want to try MyBatis. In this article, I’ll tell you how to useMyBatis with Spring MVC. According to Wikipedia, database transactions should provide an “all-or-nothing” proposition, stating that each work-unit performed in a database must either be completed in its entirety or have no effect whatsoever. Further, the system must isolate each transaction from other transactions, results must conform to existing constraints in the database, and transactions that complete successfully must get written to durable storage.
Use CDN Service in Spring MVC
A few days ago, I created TestZilla on Aliyun Elastic Compute Service. However, with the increment of PV, I decided to use CDN to cache static files(images, CSS, and javascript). But there’s no information on how to use CDN with Spring MVC, so I asked a question on StackOverflow. Setup Spring Configuration First of all, you need to use PropertyPlaceholderConfigurer in Spring Configuration(such as dispatcher-servlet.xml) <!-- Property File Location --> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>classpath:/testzilla.properties</value> </list> </property> </bean> <util:properties id="propertyConfigurer" location="classpath:/testzilla.properties"/> <context:property-placeholder properties-ref="propertyConfigurer" /> Of course, you need to add XML Namespaces: