Skip to content

Instantly share code, notes, and snippets.

public class SomeClass {
public List<Book> findSpecificBookInFile(String bookName, String filePath) {
/////////////////////////////
// Parsing the XML file ///
/////////////////////////////
ParseType xmlType = new ParseType(Parsing.Type.XML, Parsing.Xml.ExtraColumn);
ParseFileFactory xmlFileFactory = new ParseFileFactory(xmlType);
ParseFile<Parsing.Type.XML> xmlFile = xmlFileFactory.open(filePath);
public String saveNewBook() {
/////////////////////////////////
// Construct complex arguments //
/////////////////////////////////
Characteristics characteristics = new Characteristics(
"Moby Dick", // Title
"Herman Melville", // Author
704 // Num of pages
);
Price price = new Price(9.99);
public interface BookingService {
TrackingId bookNewCargo(Location origin, Location destination);
CargoRouting findCargoRoutingInformations(TrackingId Id);
List<RouteCandidateDTO> requestPossibleRoutesForCargo(TrackingId id);
void assignCargoToRoute(TrackingId id, RouteCandidate route);
void changeDestination(TrackingId id, String destinationUnLocode);
@RequestMapping("/itinerarySelection")
public String showItinerarySelection(Request request, Model model) {
// Retrieve ID (Here stored with the client)
String trackingId = request.getParameter("trackingId");
//////////////////////////////////
// Query the Application layer //
//////////////////////////////////
List<RouteCandidate> routeCandidates =
bookingService.requestPossibleRoutesForCargo(trackingId);
{"book": {
"title": "Moby Dick",
"author": "Herman Melville",
"reviews": [
{"reviewer": "Mark234", "rating_stars": "4.5"},
{"reviewer": "Frank12", "rating_stars": "3.5"},
{"reviewer": "NotPatrick", "rating_stars": "4"},
]
}
}
<div id="menu" style="visibility: hidden">
|
Javascript: when clicking menu, do: |
V
<div id="menu" style="visibility: visible">
<!DOCTYPE html>
<html>
<body>
<h1>This is the result</h1>
<p>4<p>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<h1>This is the result</h1>
<p>$$$$$$$</p>
</body>
</html>
The classic scenario - Server-side rendering
Don't fear the complex name, Server-side rendering is actually a pretty simple process.
To understand, let's first imagine a simple non-web application: A command line application.
@HelloThisIsFlo
HelloThisIsFlo / the-web-pt-1-2.py
Created January 26, 2017 08:23
Human Readable Result
####################
### RESULT ###
####################
// Hello, I am a human readable result! //
Computation: "2 * 2"
|> Result: 4