MCPcopy Index your code
hub / github.com/dasniko/ozark-react

github.com/dasniko/ozark-react @1.2.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.2.0 ↗ · + Follow
57 symbols 81 edges 17 files 9 documented · 16% updated 8y ago1.2.0 · 2016-09-02★ 441 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Isomorphic (Universal) Ozark ReactJS ViewEngine Demo

Release Build Status License

This is a simple demo application demonstrating how to use isomorphic/universal JavaScript with server-side pre-rendered ReactJS templates with the new Java EE MVC 1.0 (JSR-371) reference implementation Ozark.

To establish the use of React.JS on the Java server-side, I created a ViewEngine implementation for Ozark/MVC 1.0, which uses the server-side rendering option of React.JS.

Basics

MVC 1.0 is at a very early stage and this project uses snapshot versions of Ozark. So there might be some not yet known effects/troubles when running the application.

For your convenience, this project comes with all dependencies which are needed to run the application in a pure servlet-container like Apache Tomcat or Jetty. So you don't have to rely on your container to provide all of the technology and libraries (Ozark itself is yet developed for Glassfish only, but this might (hopefully) change in the future).

Getting Started

This project is Gradle based and comes with a Gradle Wrapper, so you don't have to have Gradle installed on your machine. To build the WAR file, just type

$ ./gradlew build

in your console/terminal. This will build a ozark-react.war in the build/libs folder.

The project comes with all mechanisms to install and bundle all dependencies. Not only the Java deps, but also the NPM JavaScript dependencies like React.JS (the actual runtime lib), Webpack and Babel (for transpiling and bundling)

You can deploy this WAR into an Apache Tomcat or Jetty servlet container. After starting your server, you should be able to access the application at this address:

http://localhost:8080/ozark/react

BTW: You don't have to use Gradle to use it in your project, just use whatever build tool you like (e.g. Maven, SBT, etc.)

Building the JavaScript artifacts

I worked a lot on building, bundling and packaging (frontend) JavaScript artifacts with toolks like Maven and Gradle, which are not really meant for JavaScript (although it is possible, somehow). But after all, I came (again) to the end, that you should use the right tool for the right job. In case of JavaScript artifacts, this means you should definetely use tools from this ecosystem, like NPM, Webpack, Babel, Grunt, Gulp, and/or whatever.

For this reason, I use Webpack with integrated Babel.js to transpile the JSX/ES6 components into executable JS (ES5) code and bundle it together with React.JS into one app file. This file is then used within the application at runtime (server- and client-side).

Also, if this means that you have two different build tools (like Gradle and NPM here) for one project, the configuration and result of the tools is much better than trying something else. Luckily, it's easily possible, to start the NPM tasks from within the Gradle build process, so it won't become pain in the ass to run both when needed.

Contribution / Issues

Don't hesitate to contribute to this project in any kind of sending PRs for improvements, enhancements, and/or bug-fixes.

I appreciate every issue that will be reported.

Core symbols most depended-on inside this repo

getRequestURI
called by 2
src/main/java/dasniko/ozark/react/ReactViewEngine.java
resolveView
called by 2
src/main/java/dasniko/ozark/react/ReactViewEngine.java
loadBooksFromServer
called by 1
src/main/resources/jsx/bookBox.jsx
render
called by 1
src/main/resources/jsx/book.jsx
getBooks
called by 1
src/main/java/dasniko/ozark/react/BookService.java
parseQueryString
called by 1
src/main/java/dasniko/ozark/react/ReactViewEngine.java
processRequest
called by 1
src/main/java/dasniko/ozark/react/ReactViewEngine.java
getViewExtension
called by 1
src/main/java/dasniko/ozark/react/ReactViewEngine.java

Shape

Method 38
Class 17
Function 2

Languages

Java65%
TypeScript35%

Modules by API surface

src/main/java/dasniko/ozark/react/ReactViewEngine.java11 symbols
src/main/resources/jsx/bookBox.jsx7 symbols
src/main/java/dasniko/ozark/react/Book.java6 symbols
src/main/resources/jsx/bookForm.jsx5 symbols
src/main/java/dasniko/ozark/react/NashornPoolFactory.java5 symbols
src/main/java/dasniko/ozark/react/BookService.java4 symbols
src/main/resources/jsx/bookList.jsx3 symbols
src/main/resources/jsx/book.jsx3 symbols
src/main/java/dasniko/ozark/react/NashornPool.java3 symbols
src/main/java/dasniko/ozark/react/BookController.java3 symbols
src/main/resources/jsx/index.jsx2 symbols
src/main/java/dasniko/ozark/react/ReactController.java2 symbols

For agents

$ claude mcp add ozark-react \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact