Billy Yarosh
Java & Ruby Developer: Coding Cures, Concepts, API examples.
Java Base64 URL Safe Encoding
Microservices Tech Stack with Spring and Vert.X
It’s been awhile since my last blog post, and it’s been for several reasons. The primary, is that our team has been challenged to implement a Microservice Architecture (MSA) that fit’s my current company's needs. It’s been a process defining the stack, learning the new stack and providing tooling/components for developers to innovate.
Labels:
architecture
,
high availability
,
microservices
,
msa
,
rxnetty
,
scaling
,
software
,
spring
,
spring boot
,
spring data
,
vert x
,
vert.x
,
web development
Understanding Immutable Classes In Java
I recently reviewed an article that claimed immutable classes in Java are not always thread safe. Ultimately, this is not true since any immutable class cannot contain state and therefore no two threads could change it's state.
To understand this more, I would like to do a quick dive into what an Immutable class is in Java.
To understand this more, I would like to do a quick dive into what an Immutable class is in Java.
Labels:
classes
,
design patterns
,
developer
,
immutable
,
java
,
java 8
,
object oriented programming
,
objects
Yes, Immutable Means Thread Safe. It's that simple.
Plain and simple, IMMUTABLE IS ALWAYS THREAD SAFE, and it is a very simple concept. If somethings state cannot change upon instantiation, no two threads can ever write to the object and break it's state.
The other day I was curious what people thought about this topic. A top hit from DZone claimed not always, and I would like to rebuttal.
Here is a link. https://dzone.com/articles/do-immutability-really-means
And my response:
The other day I was curious what people thought about this topic. A top hit from DZone claimed not always, and I would like to rebuttal.
Here is a link. https://dzone.com/articles/do-immutability-really-means
And my response:
Spring HATEOAS - Embedded Resources with HAL
One common issue I see on the web is people having trouble rendering their JSON objects in HAL with embedded resources. For this example I am using groovy, but it explains how to configure the rendering of resources in a spring applicaiton.
Labels:
groovy
,
hal
,
hal+json
,
hapi
,
hateoas
,
hypermedia
,
rest
,
spring boot
,
spring framework
Rails Unfit for Microservices?
This is a relatively informal blog post. Looking more for feedback and response to get a conversation started. The prerequisite to this thread is that you have a fairly good understanding of Microservices. If not at least read the following link:
http://martinfowler.com/articles/microservices.html
http://martinfowler.com/articles/microservices.html
Labels:
grails microservice
,
groovy
,
java
,
microservices
,
netflix
,
rails
,
reactor
,
ruby
,
spring-boot
,
threading
,
web framework
The Java Enum: A Singleton Pattern
There are a few reasons why one would use an enum as a singleton in Java:
Bootstrap Guide: The Virtual Tour Library
Introducing a Virtual Tour Library (using TW Bootstrap)
Labels:
css3
,
help guide
,
html5
,
jquery
,
jquery library
,
twitter bootstrap
,
virtual tour
,
web development
Free Twitter Bootstrap Admin Theme
Labels:
css
,
css3
,
free
,
html
,
html5
,
media queries
,
responsive
,
software engineer
,
theme
,
twitter bootstrap
,
web development
Java Developers Need To Be Using Lombok
Adding Groovy Sources to Maven Build Path
Say you want to run a groovy class method from your Java project in Maven. You've placed the script file at
src/main/groovy/script/MyGroovyScriptClass.groovy
. In Java, you would load the class and execute its method like so:
Labels:
add-resources
,
add-sources
,
build-helper-maven-plugin
,
groovy
,
java
,
javaEE
,
maven
,
pom.xml
Ignore Header and Trailer Lines During Java InputStream Read
Ignore first + last lines in a file
After beating my head against the wall for some time, I was finally able to come up with a solution for this.Say you want to hand off an InputStream or InputStreamReader to an underlying API. The problem is that your input stream may have a header or trailer. Those header/trailers differ from the underlying format. This is commonly true for CSV, EDI, and fixed length file types. So if you want a CSV file parsed by a Java API like the Smooks api, you will need to hand the framework an InputStream.
Labels:
buffer
,
FilterInputStream
,
IOStream
,
java
,
javaEE
,
line buffer
,
queue
,
skip line
Grails Part 5 - Adding Basic Security
Click here to view the full tutorial
Continuing series: Developing a Grails Web Application.
Tutorial will: walk through steps of creating a robust Grails web application.
Application name:
The Goal: To track and record persons addresses.
Tutorial will: walk through steps of creating a robust Grails web application.
Application name:
grails-mongo-demo
The Goal: To track and record persons addresses.
This application will use the Grails Framework to develop a web application using:View Project on Github
1.MongoDB
2.Spring Security
3.Apache CXF
4.Jetty Web Server
5.
Maven build integration=> Removed upon Request
Previous Post: Grails Part 4 - Enhanced UI Design w/ tw Bootstrap
These Instructions Will Walk Through:
- Configuring Spring Security Plugin
- Adding static URL maps
- Bootstrapping in security data
- SecurityTagLib - Conditionally display gsp content
- Configure Security Pages with Twitter Bootstrap UI
Grails Part 4: Enhanced UI Design w/ Twitter Bootstrap
Click here to view the full tutorial
Continuing series: Developing a Grails Web Application.View Project on Github
This application will use the Grails Framework to develop a web application using:
1.MongoDB
2.Spring Security
3.Apache CXF
4.Jetty Web Server
5.
Maven build integration=> Removed upon Request
Previous Post: Grails Part 3 - Building a CRUD Application
These Instructions Will Walk Through:
- Enhanced UI Design with tw bootstrap
- Configure Bootstrap with lesscss-resources plugin
- Adding a custom controller
- Customizing Scaffold Templates
- Improving Scaffold Output
Labels:
custom grails templates
,
grails
,
grails framework
,
gsp
,
javascript
,
less
,
less-cssresource
,
springMVC
,
twitter bootstrap
Grails Part 3 - Building a CRUD Application
Click here to view the full tutorial
Continuing series: Developing a Grails Web Application.View Project on Github: Grails MongoDB Demo
This application will use the Grails Framework to develop a web application using:
1.MongoDB
2.Spring Security
3.Apache CXF
4.Jetty Web Server
5.
Maven build integration=> Removed upon Request
Previous Post: Grails Part 2 - Configuring the Plugins
These Instructions Will Walk Through:
-
Building a CRUD Application
- Building the Domain Model
- Controllers using Grails Scaffolding
Labels:
controller
,
crud application
,
domain model
,
grails
,
grails constraints
,
grails framework
,
groovy
,
maven
,
mongodb
,
spring-mvc
Grails Part 2 - Configuring Web Application Plugins
Click here to view the full tutorial
Continuing series: Developing a Grails Web Application.View Project on Github: Grails MongoDB Demo
This application will use the Grails Framework to develop a web application using:
1.MongoDB
2.Spring Security
3.Apache CXF
4.Jetty Web Server
5.
Maven build integration=> Removed upon Request
Previous Post: Grails Part 1 - Setting up a Project on Maven With IntelliJ
These Instructions Will Walk Through:
-
Configuring the Plugins
- MongoDB
- Jetty
- Spring Security
- Apache CXF (WSClient)
Labels:
Apache CXF
,
grails
,
grails framework
,
grails plugin
,
GroovyWS
,
install grails plugins
,
jetty
,
maven
,
mongodb
,
spring framework
,
spring security
Grails Part 1 - Setting up a Project
Click here to view the full tutorial
Continuing series: Developing a Grails Web Application.View Project on Github: Grails MongoDB Demo
This application will use the Grails Framework to develop a web application using:
1.MongoDB
2.Spring Security
3.Apache CXF
4.Jetty Web Server
5.Maven build integration
These Instructions Will Walk Through:
- Installing the Grails SDK
- Project Setup
- Creating a Grails Application
- Integrating with Maven
- Integrating with IntelliJ
Labels:
create-app
,
grails
,
grails framework
,
Grails SDK
,
Idea
,
intelliJ
,
IntelliJ 11
,
maven
,
project setup
,
software engineer
Applying the Strategy Pattern in Java
Working with strategy on Arrays.sort & java.util.Comparator
All these examples and more can be found on githubIn Java, you cannot pass function references through a method. With this being true, how do we then apply a strategy to a method? What is suggested, is that we define an interface with the function we want to pass. This way we can on the fly, define and pass an algorithm to a method for process.
In this demo, we will be working strictly with the strategy interface:
java.util.Comparator
. This is a java strategy interface, readily available in the Java API as of 1.5. It supplies a compare
algorithm, where its implementation is primarily for sorting large collections of objects.
Labels:
Array
,
Array sort
,
array sort by object element
,
c#
,
design patterns
,
developer
,
engineer
,
java
,
java.util
,
software engineer
,
strategy pattern
Atmosphere Websockets & Comet with Spring MVC
1. Messaging with Stomp over Websockets
2. Spring Messaging
On to the guide...
Feel free to clone the source of this project on github.
springMVC-atmosphere-comet-websockets
The Websocket protocol is defined by W3C here. The protocol is considered an HTTP upgrade protocol. Essentially what happens is, a websocket request is made by a client browser, via the HTTP protocol. Once, the request is in, the server should respond with a success. Then the browser and server establish a TCP link to handle communication from there on out. This protocol enables bi-directional communication between a client and server. Here is a link to browser and servers that support Websockets and/or Comet: comet/websocket support link
Labels:
atmosphere
,
atmosphere framework
,
comet
,
developer
,
java
,
javaEE
,
software engineer
,
spring
,
spring-mvc
,
springMVC
,
tomcat
,
tomcat7
,
twitter api
,
websocket
,
websockets
Subscribe to:
Posts
(
Atom
)