Skip to content

Commit c4ccf3d

Browse files
committed
Attempt nr. 2
1 parent 687cb9a commit c4ccf3d

9 files changed

Lines changed: 79 additions & 24 deletions

File tree

.classpath

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src/main/java">
4+
<attributes>
5+
<attribute name="FROM_GRADLE_MODEL" value="true"/>
6+
</attributes>
7+
</classpathentry>
8+
<classpathentry kind="src" path="src/main/resources">
9+
<attributes>
10+
<attribute name="FROM_GRADLE_MODEL" value="true"/>
11+
</attributes>
12+
</classpathentry>
13+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
14+
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
15+
<classpathentry kind="output" path="bin"/>
16+
</classpath>

.gitignore

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
*.class
2-
3-
# Mobile Tools for Java (J2ME)
4-
.mtj.tmp/
5-
6-
# Package Files #
7-
*.jar
8-
*.war
9-
*.ear
10-
11-
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
12-
hs_err_pid*
1+
*.class
2+
3+
# Mobile Tools for Java (J2ME)
4+
.mtj.tmp/
5+
6+
# Package Files #
7+
*.jar
8+
*.war
9+
*.ear
10+
11+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
12+
hs_err_pid*
13+
/build/

.project

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>ReactSSR</name>
4+
<comment>Project ReactSSR created by Buildship.</comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
</buildSpec>
19+
<natures>
20+
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
21+
<nature>org.eclipse.jdt.core.javanature</nature>
22+
</natures>
23+
</projectDescription>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
build.commands=org.eclipse.jdt.core.javabuilder
2+
connection.arguments=
3+
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
4+
connection.gradle.user.home=null
5+
connection.java.home=null
6+
connection.jvm.arguments=
7+
connection.project.dir=
8+
derived.resources=.gradle,build
9+
eclipse.preferences.version=1
10+
natures=org.eclipse.jdt.core.javanature
11+
project.path=\:

bin/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/no/
2+
/react-dom-server.min.js
3+
/react.min.js
4+
/site/
211 Bytes
Binary file not shown.

build.gradle

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,10 @@ app {
2323

2424
repositories {
2525
jcenter()
26-
maven {
27-
url 'http://repo.enonic.com/public'
28-
}
26+
maven { url 'http://repo.enonic.com/public' }
2927
}
3028

3129
dependencies {
32-
compile('com.enonic.xp:core-api:6.7.2-RC3')
33-
compile('com.enonic.xp:portal-api:6.7.2-RC3')
30+
compile 'com.enonic.xp:core-api:6.7.2-RC3'
31+
compile 'com.enonic.xp:portal-api:6.7.2-RC3'
3432
}

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
group = no.tine.xp.react
66
version = 0.1.0
7-
projectName = reactssr
7+
projectName = lib-react
88
appName = no.tine.xp.react
9-
displayName = ReactSSR
9+
displayName = lib-react
1010
xpVersion = 6.7.2

src/main/java/no/tine/xp/lib/react/ReactProcessor.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package no.tine.xp.lib.react;
22

3+
import java.io.File;
34
import java.io.FileNotFoundException;
45
import java.io.FileReader;
56

@@ -59,13 +60,14 @@ private String doProcess() throws ScriptException
5960

6061
String html = "";
6162
try {
62-
nashorn.eval(new FileReader("react.min.js"));
63-
nashorn.eval(new FileReader("react-dom-server.min.js"));
64-
65-
html = (String)nashorn.eval("ReactDOMServer.renderToString(React.createElement('div', null, 'Hello World From Java!'));");
63+
html += "Currently running in " + new File(".").getAbsolutePath();
64+
nashorn.eval(new FileReader("/react.min.js"));
65+
nashorn.eval(new FileReader("/react-dom-server.min.js"));
66+
67+
html += (String)nashorn.eval("ReactDOMServer.renderToString(React.createElement('div', null, 'Hello World From Java!'));");
6668
}
6769
catch(FileNotFoundException e) {
68-
html = "Unable to find included file: " + e.getMessage();
70+
html += "Unable to find included file: " + e.getMessage();
6971
}
7072

7173
return html;

0 commit comments

Comments
 (0)