Merge branch 'master' into sla-pr/1201-dhrubayotti-log4j2

This commit is contained in:
slavisa-baeldung 2017-02-20 19:42:59 +01:00
commit 30fccad5f4
49 changed files with 375 additions and 3 deletions

3
JGit/README.md Normal file
View File

@ -0,0 +1,3 @@
## Relevant articles:
- [A Guide to JGit](http://www.baeldung.com/jgit)

3
algorithms/README.md Normal file
View File

@ -0,0 +1,3 @@
## Relevant articles:
- [Dijkstra Algorithm in Java](http://www.baeldung.com/java-dijkstra)

2
apache-bval/README.md Normal file
View File

@ -0,0 +1,2 @@
### Relevant Articles:
- [Intro to Apache BVal](http://www.baeldung.com/apache-bval)

3
apache-thrift/README.md Normal file
View File

@ -0,0 +1,3 @@
## Relevant articles:
- [Working with Apache Thrift](http://www.baeldung.com/apache-thrift)

View File

@ -0,0 +1,3 @@
## Relevant articles:
- [Introduction to Apache Velocity](http://www.baeldung.com/apache-velocity)

View File

@ -6,3 +6,5 @@
### Relevant Articles:
- [Java 9 Stream API Improvements](http://www.baeldung.com/java-9-stream-api)
- [Java 9 Convenience Factory Methods for Collections](http://www.baeldung.com/java-9-collections-factory-methods)
- [New Stream Collectors in Java 9](http://www.baeldung.com/java9-stream-collectors)

View File

@ -58,3 +58,24 @@
- [Guide to java.util.concurrent.BlockingQueue](http://www.baeldung.com/java-blocking-queue)
- [Guide to CountDownLatch in Java](http://www.baeldung.com/java-countdown-latch)
- [How to Design a Genetic Algorithm in Java](http://www.baeldung.com/java-genetic-algorithm)
- [A Guide to ConcurrentMap](http://www.baeldung.com/java-concurrent-map)
- [Guide to PriorityBlockingQueue in Java](http://www.baeldung.com/java-priority-blocking-queue)
- [Guide to Java 8 groupingBy Collector](http://www.baeldung.com/java-groupingby-collector)
- [Avoiding the ConcurrentModificationException in Java](http://www.baeldung.com/java-concurrentmodificationexception)
- [Guide to WeakHashMap in Java](http://www.baeldung.com/java-weakhashmap)
- [Strategy Design Pattern in Java 8](http://www.baeldung.com/java-strategy-pattern)
- [Java 8 and Infinite Streams](http://www.baeldung.com/java-inifinite-streams)
- [Custom Thread Pools In Java 8 Parallel Streams](http://www.baeldung.com/java-8-parallel-streams-custom-threadpool)
- [String Operations with Java Streams](http://www.baeldung.com/java-stream-operations-on-strings)
- [Spring Security Cache Control Headers](http://www.baeldung.com/spring-security-cache-control-headers)
- [Basic Introduction to JMX](http://www.baeldung.com/java-management-extensions)
- [AWS Lambda With Java](http://www.baeldung.com/java-aws-lambda)
- [Introduction to Nashorn](http://www.baeldung.com/java-nashorn)
- [Exceptions in Java 8 Lambda Expressions](http://www.baeldung.com/java-lambda-exceptions)
- [Guide to the Guava BiMap](http://www.baeldung.com/guava-bimap)
- [Iterable to Stream in Java](http://www.baeldung.com/java-iterable-to-stream)
- [Java 8 Stream findFirst() vs. findAny()](http://www.baeldung.com/java-stream-findfirst-vs-findany)
- [Chained Exceptions in Java](http://www.baeldung.com/java-chained-exceptions)
- [The Java HashMap Under the Hood](http://www.baeldung.com/java-hashmap)
- [A Guide to LinkedHashMap in Java](http://www.baeldung.com/java-linked-hashmap)
- [A Guide to TreeMap in Java](http://www.baeldung.com/java-treemap)

View File

@ -1,2 +0,0 @@
### Relevant Articles:
- [The Java HashMap Under the Hood](http://www.baeldung.com/java-hashmap)

View File

@ -4,6 +4,7 @@
- [Introduction to Couchbase SDK for Java](http://www.baeldung.com/java-couchbase-sdk)
- [Using Couchbase in a Spring Application](http://www.baeldung.com/couchbase-sdk-spring)
- [Asynchronous Batch Opereations in Couchbase](http://www.baeldung.com/async-batch-operations-in-couchbase)
- [Querying Couchbase with MapReduce Views](http://www.baeldung.com/couchbase-query-mapreduce-view)
### Overview
This Maven project contains the Java code for the Couchbase entities and Spring services

View File

@ -0,0 +1,3 @@
## Relevant articles:
- [Concurrency with LMAX Disruptor An Introduction](http://www.baeldung.com/lmax-disruptor-concurrency)

3
ejb/README.md Normal file
View File

@ -0,0 +1,3 @@
## Relevant articles:
- [Guide to EJB Set-up](http://www.baeldung.com/ejb-intro)

View File

@ -16,3 +16,11 @@
- [Guava Sets](http://www.baeldung.com/guava-sets)
- [Guava Maps](http://www.baeldung.com/guava-maps)
- [Guava Set + Function = Map](http://www.baeldung.com/guava-set-function-map-tutorial)
- [Guide to Guavas Ordering](http://www.baeldung.com/guava-ordering)
- [Guide to Guavas PreConditions](http://www.baeldung.com/guava-preconditions)
- [Introduction to Guava CacheLoader](http://www.baeldung.com/guava-cacheloader)
- [Guide to Guavas EventBus](http://www.baeldung.com/guava-eventbus)
- [Guide to Guava Multimap](http://www.baeldung.com/guava-multimap)
- [Guide to Guava RangeSet](http://www.baeldung.com/guava-rangeset)
- [Guide to Guava RangeMap](http://www.baeldung.com/guava-rangemap)
- [Guide to Guava Table](http://www.baeldung.com/guava-table)

View File

@ -19,3 +19,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [Multipart Upload with HttpClient 4](http://www.baeldung.com/httpclient-multipart-upload)
- [HttpAsyncClient Tutorial](http://www.baeldung.com/httpasyncclient-tutorial)
- [HttpClient 4 Tutorial](http://www.baeldung.com/httpclient-guide)
- [Advanced HttpClient Configuration](http://www.baeldung.com/httpclient-advanced-config)

View File

@ -25,3 +25,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [More Jackson Annotations](http://www.baeldung.com/jackson-advanced-annotations)
- [Inheritance with Jackson](http://www.baeldung.com/jackson-inheritance)
- [Guide to @JsonFormat in Jackson](http://www.baeldung.com/jackson-jsonformat)
- [A Guide to Optional with Jackson](http://www.baeldung.com/jackson-optional)

3
java-mongodb/README.md Normal file
View File

@ -0,0 +1,3 @@
## Relevant articles:
- [A Guide to MongoDB with Java](http://www.baeldung.com/java-mongodb)

View File

@ -1,2 +1,4 @@
### Relevant Articles:
- [Introduction to Javaslang](http://www.baeldung.com/javaslang)
- [Guide to Try in Javaslang](http://www.baeldung.com/javaslang-try)
- [Guide to Pattern Matching in Javaslang](http://www.baeldung.com/javaslang-pattern-matching)

View File

@ -1,2 +1,3 @@
### Relevant Articles:
- [Scheduling in Java EE](http://www.baeldung.com/scheduling-in-java-enterprise-edition)
- [JSON Processing in Java EE 7](http://www.baeldung.com/jee7-json)

View File

@ -0,0 +1,57 @@
package com.baeldung.javaeeannotations;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.annotation.HttpConstraint;
import javax.servlet.annotation.HttpMethodConstraint;
import javax.servlet.annotation.ServletSecurity;
import javax.servlet.annotation.WebInitParam;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(
name = "BankAccountServlet",
description = "Represents a Bank Account and it's transactions",
urlPatterns = {"/account", "/bankAccount" },
initParams = { @WebInitParam(name = "type", value = "savings") }
)
@ServletSecurity(
value = @HttpConstraint(rolesAllowed = {"admin"}),
httpMethodConstraints = {@HttpMethodConstraint(value = "POST", rolesAllowed = {"admin"})}
)
public class AccountServlet extends javax.servlet.http.HttpServlet {
String accountType = null;
@Override
public void init(ServletConfig config) throws ServletException {
accountType = config.getInitParameter("type");
}
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
PrintWriter writer = response.getWriter();
writer.println("<html>Hello, I am an AccountServlet!</html>");
writer.flush();
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
double accountBalance = 1000d;
double interestRate = Double.parseDouble(request.getAttribute("interest").toString());
String paramDepositAmt = request.getParameter("dep");
double depositAmt = Double.parseDouble(paramDepositAmt);
accountBalance = accountBalance + depositAmt;
PrintWriter writer = response.getWriter();
writer.println("<html> Balance of " + accountType + " account is: " +
accountBalance + "<br> This account bares an interest rate of " + interestRate +
" % </html>");
writer.flush();
}
}

View File

@ -0,0 +1,17 @@
package com.baeldung.javaeeannotations;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
@WebListener
public class BankAppServletContextListener implements ServletContextListener {
public void contextInitialized(ServletContextEvent sce) {
sce.getServletContext().setAttribute("ATTR_DEFAULT_LANGUAGE", "english");
}
public void contextDestroyed(ServletContextEvent sce) {
System.out.println("CONTEXT DESTROYED");
}
}

View File

@ -0,0 +1,36 @@
package com.baeldung.javaeeannotations;
import java.io.IOException;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebFilter(
urlPatterns = "/bankAccount/*",
filterName = "LoggingFilter",
description = "Filter all account transaction URLs"
)
public class LoggingFilter implements javax.servlet.Filter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse res = (HttpServletResponse) response;
res.sendRedirect(req.getContextPath() + "/login.jsp");
chain.doFilter(request, response);
}
@Override
public void destroy() {
}
}

View File

@ -0,0 +1,29 @@
package com.baeldung.javaeeannotations;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Part;
@WebServlet(urlPatterns = { "/uploadCustDocs" })
@MultipartConfig(
fileSizeThreshold = 1024 * 1024 * 20,
maxFileSize = 1024 * 1024 * 20,
maxRequestSize = 1024 * 1024 * 25,
location = "D:/custDocs"
)
public class UploadCustomerDocumentsServlet extends HttpServlet {
protected void doPost(
HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
for (Part part : request.getParts()) {
part.write("myFile");
}
}
}

View File

@ -0,0 +1,11 @@
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1">
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>default</realm-name>
</login-config>
</web-app>

View File

@ -0,0 +1,16 @@
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>My Account</title>
</head>
<body>
<form action="account" method="post">
Width: <input type="text" size="5" name="dep"/>
&nbsp;&nbsp;
<input type="submit" value="Deposit" />
</form>
</body>
</html>

View File

@ -0,0 +1,12 @@
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Login</title>
</head>
<body>
Login Here...
</body>
</html>

View File

@ -0,0 +1,16 @@
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action="uploadCustDocs" method="post" enctype="multipart/form-data">
<input type="file" name="file" size="50" />
<br />
<input type="submit" value="Upload File" />
</form>
</body>
</html>

3
kotlin/README.md Normal file
View File

@ -0,0 +1,3 @@
## Relevant articles:
- [Introduction to the Kotlin Language](http://www.baeldung.com/kotlin)

3
metrics/README.md Normal file
View File

@ -0,0 +1,3 @@
## Relevant articles:
- [Intro to Dropwizard Metrics](http://www.baeldung.com/dropwizard-metrics)

View File

@ -1,2 +1,3 @@
### Relevant Articles:
- [PDF Conversions in Java](http://www.baeldung.com/pdf-conversions-java)
- [Creating PDF Files in Java](http://www.baeldung.com/java-pdf-creation)

4
rxjava/README.md Normal file
View File

@ -0,0 +1,4 @@
## Relevant articles:
- [Dealing with Backpressure with RxJava](http://www.baeldung.com/rxjava-backpressure)
- [How to Test RxJava?](http://www.baeldung.com/rxjava-testing)

View File

@ -16,3 +16,5 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [Quick Guide to Spring Controllers](http://www.baeldung.com/spring-controllers)
- [Quick Guide to Spring Bean Scopes](http://www.baeldung.com/spring-bean-scopes)
- [Introduction To Ehcache](http://www.baeldung.com/ehcache)
- [A Guide to the Spring Task Scheduler](http://www.baeldung.com/spring-task-scheduler)
- [Guide to Spring Retry](http://www.baeldung.com/spring-retry)

3
spring-amqp/README.md Normal file
View File

@ -0,0 +1,3 @@
## Relevant articles:
- [Messaging With Spring AMQP](http://www.baeldung.com/spring-amqp)

View File

@ -7,3 +7,6 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [A Guide to Spring in Eclipse STS](http://www.baeldung.com/eclipse-sts-spring)
- [Introduction to WebJars](http://www.baeldung.com/maven-webjars)
- [Create a Fat Jar App with Spring Boot](http://www.baeldung.com/deployable-fat-jar-spring-boot)
- [The @ServletComponentScan Annotation in Spring Boot](http://www.baeldung.com/spring-servletcomponentscan)
- [A Custom Data Binder in Spring MVC](http://www.baeldung.com/spring-mvc-custom-data-binder)
- [Intro to Building an Application with Spring Boot](http://www.baeldung.com/intro-to-spring-boot)

View File

@ -0,0 +1,20 @@
package com.baeldung;
public class Ebook {
private int bookId;
private String bookTitle;
public int getBookId() {
return bookId;
}
public void setBookId(int bookId) {
this.bookId = bookId;
}
public String getBookTitle() {
return bookTitle;
}
public void setBookTitle(String bookTitle) {
this.bookTitle = bookTitle;
}
}

View File

@ -0,0 +1,5 @@
package com.baeldung;
public interface EbookRepository {
String titleById(int id);
}

View File

@ -0,0 +1,12 @@
package com.baeldung;
import org.springframework.beans.factory.annotation.Autowired;
public class LibraryUtils {
@Autowired
private EbookRepository eBookRepository;
public String findBook(int id) {
return eBookRepository.titleById(id);
}
}

View File

@ -0,0 +1,20 @@
package com.baeldung;
public class Member {
private int memberId;
private String memberName;
public int getMemberId() {
return memberId;
}
public void setMemberId(int memberId) {
this.memberId = memberId;
}
public String getMemberName() {
return memberName;
}
public void setMemberName(String memberName) {
this.memberName = memberName;
}
}

View File

@ -0,0 +1,14 @@
package com.baeldung;
import org.springframework.beans.factory.annotation.Autowired;
public class Reservation {
private Member member;
private Ebook eBook;
@Autowired
public Reservation(Member member, Ebook eBook) {
this.member = member;
this.eBook = eBook;
}
}

View File

@ -9,3 +9,4 @@
- [Custom Cascading in Spring Data MongoDB](http://www.baeldung.com/cascading-with-dbref-and-lifecycle-events-in-spring-data-mongodb)
- [GridFS in Spring Data MongoDB](http://www.baeldung.com/spring-data-mongodb-gridfs)
- [Introduction to Spring Data MongoDB](http://www.baeldung.com/spring-data-mongodb-tutorial)
- [Spring Data MongoDB: Projections and Aggregations](http://www.baeldung.com/spring-data-mongodb-projections-aggregations)

View File

@ -2,6 +2,7 @@
### Relevant Articles:
- [Introduction to Spring Data Neo4j](http://www.baeldung.com/spring-data-neo4j-intro)
- [A Guide to Neo4J with Java](http://www.baeldung.com/java-neo4j)
### Build the Project with Tests Running
```

View File

@ -12,6 +12,7 @@
- [Hibernate: save, persist, update, merge, saveOrUpdate](http://www.baeldung.com/hibernate-save-persist-update-merge-saveorupdate/)
- [Eager/Lazy Loading In Hibernate](http://www.baeldung.com/hibernate-lazy-eager-loading)
- [Hibernate Criteria Queries](http://www.baeldung.com/hibernate-criteria-queries)
- [Hibernate One to Many Annotation Tutorial](http://www.baeldung.com/hibernate-one-to-many)
### Quick Start
@ -22,3 +23,4 @@ mvn install
mvn cargo:run
```
- **note**: starts on port `8082`

View File

@ -1,3 +1,5 @@
=========
## REST API with Jersey & Spring Example Project
- [REST API with Jersey and Spring](http://www.baeldung.com/jersey-rest-api-with-spring)
- [JAX-RS Client with Jersey](http://www.baeldung.com/jersey-jax-rs-client)

4
spring-mobile/README.md Normal file
View File

@ -0,0 +1,4 @@
## Relevant articles:
- [A Guide to Spring Mobile](http://www.baeldung.com/spring-mobile)

View File

@ -1,3 +1,7 @@
## Relevant articles:
- [Guide to Spring Email](http://www.baeldung.com/spring-email)
## Spring MVC Email
Example Spring MVC project to send email from web form.
@ -10,4 +14,4 @@ Type http://localhost:8080 in your browser to open the application.
### Sending test emails
Follow UI links to send simple email, email using template or email with attachment.
Follow UI links to send simple email, email using template or email with attachment.

View File

@ -18,3 +18,6 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [Spring MVC Content Negotiation](http://www.baeldung.com/spring-mvc-content-negotiation-json-xml)
- [Circular Dependencies in Spring](http://www.baeldung.com/circular-dependencies-in-spring)
- [Introduction to HtmlUnit](http://www.baeldung.com/htmlunit)
- [Spring @RequestMapping New Shortcut Annotations](http://www.baeldung.com/spring-new-requestmapping-shortcuts)
- [Guide to Spring Handler Mappings](http://www.baeldung.com/spring-handler-mappings)
- [Uploading and Displaying Excel Files with Spring MVC](http://www.baeldung.com/spring-mvc-excel-files)

View File

@ -0,0 +1,3 @@
## Relevant articles:
- [HandlerAdapters in Spring MVC](http://www.baeldung.com/spring-mvc-handler-adapters)

3
spring-reactor/README.md Normal file
View File

@ -0,0 +1,3 @@
## Relevant articles:
- [Introduction to Spring Reactor](http://www.baeldung.com/spring-reactor)

View File

@ -13,3 +13,4 @@ The "Learn Spring Security" Classes: http://github.learnspringsecurity.com
- [Custom Error Message Handling for REST API](http://www.baeldung.com/global-error-handler-in-a-spring-rest-api)
- [An Intro to Spring HATEOAS](http://www.baeldung.com/spring-hateoas-tutorial)
- [Spring Security Context Propagation with @Async](http://www.baeldung.com/spring-security-async-principal-propagation)
- [Servlet 3 Async Support with Spring MVC and Spring Security](http://www.baeldung.com/spring-mvc-async-security)

3
spring-sleuth/README.md Normal file
View File

@ -0,0 +1,3 @@
## Relevant articles:
- [Spring Cloud Sleuth in a Monolith Application](http://www.baeldung.com/spring-cloud-sleuth-single-application)

View File

@ -0,0 +1,3 @@
## Relevant articles:
- [Introduction to PMD](http://www.baeldung.com/pmd)