Working version of React integration to GWT
BIN
GWTReactApp/.DS_Store
vendored
Normal file
12
GWTReactApp/.classpath
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" output="test-classes" path="test"/>
|
||||
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="lib" path="war/WEB-INF/lib/gwt-react-0.6.0.jar"/>
|
||||
<classpathentry kind="lib" path="war/WEB-INF/lib/gwt-servlet.jar"/>
|
||||
<classpathentry kind="lib" path="war/WEB-INF/lib/gwt-interop-utils-0.4.0.jar"/>
|
||||
<classpathentry kind="lib" path="war/WEB-INF/lib/gwt-redux-0.4.0.jar"/>
|
||||
<classpathentry kind="output" path="war/WEB-INF/classes"/>
|
||||
</classpath>
|
||||
34
GWTReactApp/.project
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>GWTReactApp</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>com.google.gwt.eclipse.core.gwtNature</nature>
|
||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
3
GWTReactApp/.settings/com.google.gdt.eclipse.core.prefs
Normal file
@@ -0,0 +1,3 @@
|
||||
eclipse.preferences.version=1
|
||||
warSrcDir=war
|
||||
warSrcDirIsOutput=true
|
||||
2
GWTReactApp/.settings/com.google.gwt.eclipse.core.prefs
Normal file
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
filesCopiedToWebInfLib=gwt-servlet.jar
|
||||
7
GWTReactApp/.settings/org.eclipse.jdt.core.prefs
Normal file
@@ -0,0 +1,7 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<faceted-project>
|
||||
<installed facet="java" version="1.8"/>
|
||||
</faceted-project>
|
||||
BIN
GWTReactApp/src/.DS_Store
vendored
Normal file
BIN
GWTReactApp/src/com/.DS_Store
vendored
Normal file
BIN
GWTReactApp/src/com/gwt/.DS_Store
vendored
Normal file
BIN
GWTReactApp/src/com/gwt/app/.DS_Store
vendored
Normal file
36
GWTReactApp/src/com/gwt/app/GWTReactApp.gwt.xml
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
When updating your version of GWT, you should also update this DTD reference,
|
||||
so that your app can take advantage of the latest GWT module capabilities.
|
||||
-->
|
||||
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.8.1//EN"
|
||||
"http://gwtproject.org/doctype/2.8.1/gwt-module.dtd">
|
||||
<module rename-to='gwtreactapp'>
|
||||
<!-- Inherit the core Web Toolkit stuff. -->
|
||||
<inherits name='com.google.gwt.user.User'/>
|
||||
|
||||
<!-- Inherit the default GWT style sheet. You can change -->
|
||||
<!-- the theme of your GWT application by uncommenting -->
|
||||
<!-- any one of the following lines. -->
|
||||
<inherits name='com.google.gwt.user.theme.clean.Clean'/>
|
||||
<!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
|
||||
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
|
||||
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
|
||||
|
||||
<!-- Other module inherits -->
|
||||
<inherits name="com.google.gwt.resources.Resources" />
|
||||
<inherits name="gwt.interop.utils.InteropUtils" />
|
||||
<inherits name="gwt.react.React" />
|
||||
|
||||
<!-- Specify the app entry point class. -->
|
||||
<entry-point class='com.gwt.app.client.GWTReactApp'/>
|
||||
|
||||
<!-- Specify the paths for translatable code -->
|
||||
<source path='client'/>
|
||||
<source path='shared'/>
|
||||
|
||||
<!-- allow Super Dev Mode -->
|
||||
<add-linker name="xsiframe"/>
|
||||
<set-configuration-property name="devModeRedirectEnabled" value="true"/>
|
||||
<set-property name="compiler.useSourceMaps" value="true" />
|
||||
</module>
|
||||
BIN
GWTReactApp/src/com/gwt/app/client/.DS_Store
vendored
Normal file
238
GWTReactApp/src/com/gwt/app/client/GWTReactApp.java
Normal file
@@ -0,0 +1,238 @@
|
||||
package com.gwt.app.client;
|
||||
|
||||
import com.gwt.app.client.components.EmbeddedReact;
|
||||
import com.gwt.app.shared.UserDTO;
|
||||
import java.util.Date;
|
||||
import com.google.gwt.core.client.EntryPoint;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Document;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.dom.client.KeyCodes;
|
||||
import com.google.gwt.event.dom.client.KeyUpEvent;
|
||||
import com.google.gwt.event.dom.client.KeyUpHandler;
|
||||
import com.google.gwt.user.client.Cookies;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.PasswordTextBox;
|
||||
import com.google.gwt.user.client.ui.RootPanel;
|
||||
import com.google.gwt.user.client.ui.TextBox;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import gwt.react.client.api.React;
|
||||
import gwt.react.client.api.ReactDOM;
|
||||
import gwt.react.client.events.MouseEventHandler;
|
||||
import gwt.react.client.events.MouseEvent;
|
||||
|
||||
/**
|
||||
* Entry point classes define <code>onModuleLoad()</code>.
|
||||
*/
|
||||
public class GWTReactApp implements EntryPoint {
|
||||
/**
|
||||
* The message displayed to the user when the server cannot be reached or
|
||||
* returns an error.
|
||||
*/
|
||||
private static final String SERVER_ERROR = "An error occurred while "
|
||||
+ "attempting to contact the server. Please check your network " + "connection and try again.";
|
||||
|
||||
|
||||
/**
|
||||
* Inject gwt-react library script
|
||||
*/
|
||||
/*public interface JsClientBundle extends ClientBundle {
|
||||
final JsClientBundle INSTANCE = GWT.create(JsClientBundle.class);
|
||||
|
||||
@Source("resources/gwt-react-bundle.min.js")
|
||||
TextResource gwtreactbundlejs();
|
||||
@Source("resources/gwt-react-router-bundle.min.js")
|
||||
TextResource gwtreactrouterbundlejs();
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a remote service proxy to talk to the server-side Login service.
|
||||
*/
|
||||
private final LoginServiceAsync loginService = GWT.create(LoginService.class);
|
||||
|
||||
final TextBox userNameField = new TextBox();
|
||||
final TextBox passwordField = new PasswordTextBox();
|
||||
final Button loginButton = new Button("LOGIN");
|
||||
final Button goToReactButton = new Button("GO TO REACT APP");
|
||||
final Label loggedUserInfo = new Label();
|
||||
|
||||
private void setLoginFormVisibility(boolean displayLoginForm){
|
||||
RootPanel.get("loginFormDiv").setVisible(displayLoginForm);
|
||||
RootPanel.get("loggedInDiv").setVisible(!displayLoginForm);
|
||||
}
|
||||
|
||||
private void setReactComponentVisibility(boolean displayReactComponent){
|
||||
RootPanel.get("gwtAppDiv").setVisible(!displayReactComponent);
|
||||
RootPanel.get("reactAppDiv").setVisible(displayReactComponent);
|
||||
}
|
||||
|
||||
private void setLoggedInUserInfo(String username){
|
||||
loggedUserInfo.setText("Current logged in user: " + username);
|
||||
}
|
||||
|
||||
private void displayLoginWindow(boolean displayLogin){
|
||||
// Hide info and React button
|
||||
if(displayLogin)
|
||||
loggedUserInfo.setText("");
|
||||
|
||||
goToReactButton.setVisible(!displayLogin);
|
||||
RootPanel.get("userNameFieldLabel").setVisible(displayLogin);
|
||||
RootPanel.get("passwordFieldLabel").setVisible(displayLogin);
|
||||
userNameField.setVisible(displayLogin);
|
||||
passwordField.setVisible(displayLogin);
|
||||
loginButton.setVisible(displayLogin);
|
||||
}
|
||||
|
||||
private void checkWithServerIfSessionIdIsStillLegal(String sessionID, boolean goToReactApp)
|
||||
{
|
||||
loginService.loginFromSessionServer(new AsyncCallback<UserDTO>()
|
||||
{
|
||||
@Override
|
||||
public void onFailure(Throwable caught)
|
||||
{
|
||||
setLoginFormVisibility(true);
|
||||
Window.alert(SERVER_ERROR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(UserDTO result)
|
||||
{
|
||||
if (result == null)
|
||||
{
|
||||
setLoginFormVisibility(true);
|
||||
} else
|
||||
{
|
||||
if (result.getLoggedIn())
|
||||
{
|
||||
if(!goToReactApp){
|
||||
setLoginFormVisibility(false);
|
||||
setLoggedInUserInfo(result.getUserName());
|
||||
}
|
||||
else{
|
||||
setReactComponentVisibility(true);
|
||||
EmbeddedReact.ReactComponentProps componentProps = new EmbeddedReact.ReactComponentProps();
|
||||
|
||||
componentProps.onGoToGWTAppClicked = new MouseEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onMouseEvent(MouseEvent event) {
|
||||
setReactComponentVisibility(false);
|
||||
String sessionID = Cookies.getCookie("sid");
|
||||
if (sessionID == null)
|
||||
setLoginFormVisibility(true);
|
||||
else
|
||||
checkWithServerIfSessionIdIsStillLegal(sessionID, false);
|
||||
|
||||
}
|
||||
};
|
||||
componentProps.currentLoggedUser = result.getUserName();
|
||||
ReactDOM.render(React.createElement(EmbeddedReact::loggedInComponent, componentProps), Document.get().getElementById("reactAppDiv"));
|
||||
}
|
||||
|
||||
} else
|
||||
{
|
||||
displayLoginWindow(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the entry point method.
|
||||
*/
|
||||
@Override
|
||||
public void onModuleLoad() {
|
||||
RootPanel.get("userNameFieldContainer").add(userNameField);
|
||||
RootPanel.get("passwordFieldContainer").add(passwordField);
|
||||
RootPanel.get("loginButtonContainer").add(loginButton);
|
||||
RootPanel.get("loggedInUserInfoContainer").add(loggedUserInfo);
|
||||
RootPanel.get("goToReactApplicationButtonContainer").add(goToReactButton);
|
||||
|
||||
// Focus the cursor on the name field when the app loads
|
||||
userNameField.setFocus(true);
|
||||
userNameField.selectAll();
|
||||
|
||||
String sessionID = Cookies.getCookie("sid");
|
||||
if (sessionID == null)
|
||||
setLoginFormVisibility(true);
|
||||
else
|
||||
checkWithServerIfSessionIdIsStillLegal(sessionID, false);
|
||||
|
||||
// Create a handler for the sendButton and nameField
|
||||
class MyHandler implements ClickHandler, KeyUpHandler {
|
||||
/**
|
||||
* Fired when the user clicks on the sendButton.
|
||||
*/
|
||||
public void onClick(ClickEvent event) {
|
||||
Widget sender = (Widget) event.getSource();
|
||||
if (sender == loginButton) {
|
||||
loginUser();
|
||||
} else if (sender == goToReactButton) {
|
||||
String sessionID = Cookies.getCookie("sid");
|
||||
if (sessionID == null)
|
||||
setLoginFormVisibility(true);
|
||||
else
|
||||
checkWithServerIfSessionIdIsStillLegal(sessionID, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the user types in the nameField.
|
||||
*/
|
||||
public void onKeyUp(KeyUpEvent event) {
|
||||
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
|
||||
loginUser();
|
||||
}
|
||||
}
|
||||
|
||||
private void loginUser(){
|
||||
|
||||
loginService.loginServer(userNameField.getValue(), passwordField.getValue(), new AsyncCallback<UserDTO>()
|
||||
{
|
||||
@Override
|
||||
public void onSuccess(UserDTO result)
|
||||
{
|
||||
|
||||
if (result.getLoggedIn())
|
||||
{
|
||||
//Set session cookie for 60s
|
||||
String sessionID = result.getSessionId();
|
||||
final long DURATION = 1000 * 10;
|
||||
Date expires = new Date(System.currentTimeMillis() + DURATION);
|
||||
Cookies.setCookie("sid", sessionID, expires, null, "/", false);
|
||||
setLoginFormVisibility(false);
|
||||
setLoggedInUserInfo(result.getUserName());
|
||||
} else
|
||||
{
|
||||
Window.alert(SERVER_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught)
|
||||
{
|
||||
|
||||
Window.alert(SERVER_ERROR);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Add a handler to send the name to the server
|
||||
MyHandler handler = new MyHandler();
|
||||
loginButton.addClickHandler(handler);
|
||||
passwordField.addKeyUpHandler(handler);
|
||||
goToReactButton.addClickHandler(handler);
|
||||
}
|
||||
}
|
||||
14
GWTReactApp/src/com/gwt/app/client/LoginService.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.gwt.app.client;
|
||||
import com.google.gwt.user.client.rpc.RemoteService;
|
||||
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
||||
import com.gwt.app.shared.UserDTO;
|
||||
|
||||
@RemoteServiceRelativePath("login")
|
||||
public interface LoginService extends RemoteService
|
||||
{
|
||||
UserDTO loginServer(String name, String password);
|
||||
|
||||
UserDTO loginFromSessionServer();
|
||||
|
||||
void logout();
|
||||
}
|
||||
13
GWTReactApp/src/com/gwt/app/client/LoginServiceAsync.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package com.gwt.app.client;
|
||||
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.gwt.app.shared.UserDTO;
|
||||
|
||||
public interface LoginServiceAsync
|
||||
{
|
||||
void loginServer(String name, String password, AsyncCallback<UserDTO> callback);
|
||||
|
||||
void loginFromSessionServer(AsyncCallback<UserDTO> callback);
|
||||
|
||||
void logout(AsyncCallback<Void> callback);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.gwt.app.client.components;
|
||||
import static gwt.react.client.api.React.DOM.*;
|
||||
import gwt.react.client.elements.DOMElement;
|
||||
import gwt.react.client.events.MouseEventHandler;
|
||||
import gwt.react.client.proptypes.BaseProps;
|
||||
import gwt.react.client.proptypes.html.BtnProps;
|
||||
import gwt.react.client.proptypes.html.HtmlProps;
|
||||
import jsinterop.annotations.JsPackage;
|
||||
import jsinterop.annotations.JsType;
|
||||
|
||||
public class EmbeddedReact {
|
||||
|
||||
@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object")
|
||||
public
|
||||
static class ReactComponentProps extends BaseProps {
|
||||
// Add getters instead of public identifiers
|
||||
public String currentLoggedUser;
|
||||
public MouseEventHandler onGoToGWTAppClicked;
|
||||
}
|
||||
|
||||
public static DOMElement<HtmlProps> loggedInComponent(ReactComponentProps props) {
|
||||
return div(null,
|
||||
h1(null, "Test application - React"),
|
||||
table(new HtmlProps().className("tableCenter"),
|
||||
tr(new HtmlProps().className("largeTextField"),
|
||||
div(null, "Current logged in user: " + props.currentLoggedUser)),
|
||||
tr(new HtmlProps().className("tableCenterRow"),
|
||||
button(
|
||||
new BtnProps()
|
||||
.className("gwt-Button")
|
||||
.onClick(props.onGoToGWTAppClicked),
|
||||
"GO TO GWT APP"
|
||||
)
|
||||
)));
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
BIN
GWTReactApp/src/com/gwt/app/server/.DS_Store
vendored
Normal file
61
GWTReactApp/src/com/gwt/app/server/LoginServiceImpl.java
Normal file
@@ -0,0 +1,61 @@
|
||||
package com.gwt.app.server;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||
import com.gwt.app.client.LoginService;
|
||||
import com.gwt.app.shared.UserDTO;
|
||||
|
||||
public class LoginServiceImpl extends RemoteServiceServlet implements LoginService
|
||||
{
|
||||
private static final long serialVersionUID = 4456105400553118785L;
|
||||
|
||||
@Override
|
||||
public UserDTO loginServer(String name, String password)
|
||||
{
|
||||
UserDTO user = new UserDTO(name, password);
|
||||
user.setLoggedIn(true);
|
||||
storeUserInSession(user);
|
||||
return user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserDTO loginFromSessionServer()
|
||||
{
|
||||
return getUserAlreadyFromSession();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logout()
|
||||
{
|
||||
deleteUserFromSession();
|
||||
}
|
||||
|
||||
private UserDTO getUserAlreadyFromSession()
|
||||
{
|
||||
UserDTO user = null;
|
||||
HttpServletRequest httpServletRequest = this.getThreadLocalRequest();
|
||||
HttpSession session = httpServletRequest.getSession();
|
||||
Object userObj = session.getAttribute("user");
|
||||
if (userObj != null && userObj instanceof UserDTO)
|
||||
{
|
||||
user = (UserDTO) userObj;
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
private void storeUserInSession(UserDTO user)
|
||||
{
|
||||
HttpServletRequest httpServletRequest = this.getThreadLocalRequest();
|
||||
HttpSession session = httpServletRequest.getSession(true);
|
||||
user.setSessionId(session.getId());
|
||||
session.setAttribute("user", user);
|
||||
}
|
||||
|
||||
private void deleteUserFromSession()
|
||||
{
|
||||
HttpServletRequest httpServletRequest = this.getThreadLocalRequest();
|
||||
HttpSession session = httpServletRequest.getSession();
|
||||
session.removeAttribute("user");
|
||||
}
|
||||
|
||||
}
|
||||
58
GWTReactApp/src/com/gwt/app/shared/UserDTO.java
Normal file
@@ -0,0 +1,58 @@
|
||||
package com.gwt.app.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class UserDTO implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 3196402615838002153L;
|
||||
|
||||
private String userName;
|
||||
|
||||
private String password;
|
||||
|
||||
private boolean loggedIn;
|
||||
|
||||
private String sessionId;
|
||||
|
||||
public UserDTO()
|
||||
{
|
||||
}
|
||||
|
||||
public UserDTO(String name, String password)
|
||||
{
|
||||
setUserName(name);
|
||||
setPassword(password);
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public boolean getLoggedIn() {
|
||||
return loggedIn;
|
||||
}
|
||||
|
||||
public void setLoggedIn(boolean loggedIn) {
|
||||
this.loggedIn = loggedIn;
|
||||
}
|
||||
|
||||
public String getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
public void setSessionId(String sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
}
|
||||
BIN
GWTReactApp/test-classes/.DS_Store
vendored
Normal file
BIN
GWTReactApp/test-classes/com/.DS_Store
vendored
Normal file
BIN
GWTReactApp/test-classes/com/gwt/.DS_Store
vendored
Normal file
BIN
GWTReactApp/test/.DS_Store
vendored
Normal file
BIN
GWTReactApp/test/com/.DS_Store
vendored
Normal file
BIN
GWTReactApp/test/com/gwt/.DS_Store
vendored
Normal file
42
GWTReactApp/war/GWTReactApp.css
Normal file
@@ -0,0 +1,42 @@
|
||||
/** Add css rules here for your application. */
|
||||
|
||||
|
||||
/** Example rules used by the template application (remove for your app) */
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
font-weight: bold;
|
||||
color: #777777;
|
||||
margin: 40px 0px 70px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.sendButton {
|
||||
display: block;
|
||||
font-size: 16pt;
|
||||
}
|
||||
|
||||
/** Most GWT widgets already have a style name defined */
|
||||
.gwt-DialogBox {
|
||||
width: 400px;
|
||||
}
|
||||
|
||||
.dialogVPanel {
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
.tableCenter {
|
||||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
}
|
||||
|
||||
.serverResponseLabelError {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.tableCenterRow{
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
.largeTextField{
|
||||
font-size: large;
|
||||
}
|
||||
84
GWTReactApp/war/GWTReactApp.html
Normal file
@@ -0,0 +1,84 @@
|
||||
<!doctype html>
|
||||
<!-- The DOCTYPE declaration above will set the -->
|
||||
<!-- browser's rendering engine into -->
|
||||
<!-- "Standards Mode". Replacing this declaration -->
|
||||
<!-- with a "Quirks Mode" doctype is not supported. -->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
|
||||
<!-- -->
|
||||
<!-- Consider inlining CSS to reduce the number of requested files -->
|
||||
<!-- -->
|
||||
<link type="text/css" rel="stylesheet" href="GWTReactApp.css">
|
||||
|
||||
<!-- -->
|
||||
<!-- Any title is fine -->
|
||||
<!-- -->
|
||||
<title>Web Application Starter Project</title>
|
||||
|
||||
<!-- -->
|
||||
<!-- This script loads your compiled module. -->
|
||||
<!-- If you add any GWT meta tags, they must -->
|
||||
<!-- be added before this line. -->
|
||||
<!-- -->
|
||||
|
||||
</head>
|
||||
|
||||
<!-- -->
|
||||
<!-- The body can have arbitrary html, or -->
|
||||
<!-- you can leave the body empty if you want -->
|
||||
<!-- to create a completely dynamic UI. -->
|
||||
<!-- -->
|
||||
<body>
|
||||
|
||||
<!-- RECOMMENDED if your web app will not function without JavaScript enabled -->
|
||||
<noscript>
|
||||
<div style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif">
|
||||
Your web browser must have JavaScript enabled
|
||||
in order for this application to display correctly.
|
||||
</div>
|
||||
</noscript>
|
||||
|
||||
<div id="gwtAppDiv">
|
||||
<h1>Test application - GWT</h1>
|
||||
<div id="loginFormDiv">
|
||||
<table class="tableCenter" >
|
||||
<tr>
|
||||
<td colspan="2" id="userNameFieldLabel" style="font-size: large;">Username:</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id="userNameFieldContainer"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" id="passwordFieldLabel" style="font-size: large;">Password:</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id="passwordFieldContainer"></td>
|
||||
</tr>
|
||||
<tr class="tableCenterRow">
|
||||
<td id="loginButtonContainer"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="loggedInDiv">
|
||||
<table class="tableCenter">
|
||||
<tr>
|
||||
<td colspan="2" id="loggedInUserInfoContainer" style="font-size: large;"></td>
|
||||
</tr>
|
||||
<tr class="tableCenterRow">
|
||||
<td id="goToReactApplicationButtonContainer"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="reactAppDiv">
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" language="javascript" src="gwtreactapp/gwtreactapp.nocache.js"></script>
|
||||
<script src="gwtreactapp/gwt-react-bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
BIN
GWTReactApp/war/WEB-INF/classes/.DS_Store
vendored
Normal file
BIN
GWTReactApp/war/WEB-INF/classes/com/.DS_Store
vendored
Normal file
BIN
GWTReactApp/war/WEB-INF/classes/com/gwt/.DS_Store
vendored
Normal file
BIN
GWTReactApp/war/WEB-INF/classes/com/gwt/app/.DS_Store
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
When updating your version of GWT, you should also update this DTD reference,
|
||||
so that your app can take advantage of the latest GWT module capabilities.
|
||||
-->
|
||||
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.8.1//EN"
|
||||
"http://gwtproject.org/doctype/2.8.1/gwt-module.dtd">
|
||||
<module rename-to='gwtreactapp'>
|
||||
<!-- Inherit the core Web Toolkit stuff. -->
|
||||
<inherits name='com.google.gwt.user.User'/>
|
||||
|
||||
<!-- Inherit the default GWT style sheet. You can change -->
|
||||
<!-- the theme of your GWT application by uncommenting -->
|
||||
<!-- any one of the following lines. -->
|
||||
<inherits name='com.google.gwt.user.theme.clean.Clean'/>
|
||||
<!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
|
||||
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
|
||||
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
|
||||
|
||||
<!-- Other module inherits -->
|
||||
<inherits name="com.google.gwt.resources.Resources" />
|
||||
<inherits name="gwt.interop.utils.InteropUtils" />
|
||||
<inherits name="gwt.react.React" />
|
||||
|
||||
<!-- Specify the app entry point class. -->
|
||||
<entry-point class='com.gwt.app.client.GWTReactApp'/>
|
||||
|
||||
<!-- Specify the paths for translatable code -->
|
||||
<source path='client'/>
|
||||
<source path='shared'/>
|
||||
|
||||
<!-- allow Super Dev Mode -->
|
||||
<add-linker name="xsiframe"/>
|
||||
<set-configuration-property name="devModeRedirectEnabled" value="true"/>
|
||||
<set-property name="compiler.useSourceMaps" value="true" />
|
||||
</module>
|
||||
BIN
GWTReactApp/war/WEB-INF/classes/com/gwt/app/client/.DS_Store
vendored
Normal file
BIN
GWTReactApp/war/WEB-INF/classes/com/gwt/app/server/.DS_Store
vendored
Normal file
24
GWTReactApp/war/WEB-INF/web.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
|
||||
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
||||
version="2.5"
|
||||
xmlns="http://java.sun.com/xml/ns/javaee">
|
||||
|
||||
<!-- Servlets -->
|
||||
<servlet>
|
||||
<servlet-name>LoginServiceImpl</servlet-name>
|
||||
<servlet-class>com.gwt.app.server.LoginServiceImpl</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>LoginServiceImpl</servlet-name>
|
||||
<url-pattern>/gwtreactapp/login</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<!-- Default page to serve -->
|
||||
<welcome-file-list>
|
||||
<welcome-file>GWTReactApp.html</welcome-file>
|
||||
</welcome-file-list>
|
||||
|
||||
</web-app>
|
||||
BIN
GWTReactApp/war/favicon.ico
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,11 @@
|
||||
@FinalFields, false
|
||||
com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException, true, true, true, true, com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException/3936916533, 3936916533
|
||||
com.google.gwt.user.client.rpc.RpcTokenException, true, true, false, false, com.google.gwt.user.client.rpc.RpcTokenException/2345075298, 2345075298
|
||||
com.google.gwt.user.client.rpc.XsrfToken, false, false, true, true, com.google.gwt.user.client.rpc.XsrfToken/4254043109, 4254043109
|
||||
com.gwt.app.client.GreetingService, false, false, false, false, _, 1638119995
|
||||
java.lang.Exception, true, false, true, false, java.lang.Exception/1920171873, 1920171873
|
||||
java.lang.IllegalArgumentException, true, true, false, false, java.lang.IllegalArgumentException/1755012560, 1755012560
|
||||
java.lang.NumberFormatException, true, true, false, false, java.lang.NumberFormatException/3305228476, 3305228476
|
||||
java.lang.RuntimeException, true, false, true, false, java.lang.RuntimeException/515124647, 515124647
|
||||
java.lang.String, true, true, true, true, java.lang.String/2004016611, 2004016611
|
||||
java.lang.Throwable, true, false, true, false, java.lang.Throwable/2953622131, 2953622131
|
||||
@@ -0,0 +1,10 @@
|
||||
@FinalFields, false
|
||||
com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException, true, true, true, true, com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException/3936916533, 3936916533
|
||||
com.google.gwt.user.client.rpc.RpcTokenException, true, true, false, false, com.google.gwt.user.client.rpc.RpcTokenException/2345075298, 2345075298
|
||||
com.google.gwt.user.client.rpc.XsrfToken, false, false, true, true, com.google.gwt.user.client.rpc.XsrfToken/4254043109, 4254043109
|
||||
com.gwt.app.client.LoginService, false, false, false, false, _, 2875975256
|
||||
com.gwt.app.shared.UserDTO, true, true, false, false, com.gwt.app.shared.UserDTO/3966925806, 3966925806
|
||||
java.lang.Exception, true, false, true, false, java.lang.Exception/1920171873, 1920171873
|
||||
java.lang.RuntimeException, true, false, true, false, java.lang.RuntimeException/515124647, 515124647
|
||||
java.lang.String, true, true, true, true, java.lang.String/2004016611, 2004016611
|
||||
java.lang.Throwable, true, false, true, false, java.lang.Throwable/2953622131, 2953622131
|
||||
BIN
GWTReactApp/war/gwtreactapp/clear.cache.gif
Normal file
|
After Width: | Height: | Size: 43 B |
8225
GWTReactApp/war/gwtreactapp/gwt-react-bundle.js
Normal file
29
GWTReactApp/war/gwtreactapp/gwt-react-bundle.min.js
vendored
Normal file
1121
GWTReactApp/war/gwtreactapp/gwt/clean/clean.css
Normal file
1122
GWTReactApp/war/gwtreactapp/gwt/clean/clean_rtl.css
Normal file
BIN
GWTReactApp/war/gwtreactapp/gwt/clean/images/circles.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
GWTReactApp/war/gwtreactapp/gwt/clean/images/corner.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
GWTReactApp/war/gwtreactapp/gwt/clean/images/hborder.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
GWTReactApp/war/gwtreactapp/gwt/clean/images/thumb_horz.png
Normal file
|
After Width: | Height: | Size: 222 B |
BIN
GWTReactApp/war/gwtreactapp/gwt/clean/images/thumb_vertical.png
Normal file
|
After Width: | Height: | Size: 231 B |
BIN
GWTReactApp/war/gwtreactapp/gwt/clean/images/vborder.png
Normal file
|
After Width: | Height: | Size: 298 B |
67
GWTReactApp/war/gwtreactapp/gwtreactapp.nocache.js
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright 2014 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This startup script is used when we run superdevmode from an app server.
|
||||
*/
|
||||
(function($wnd, $doc){
|
||||
// document.head does not exist in IE8
|
||||
var $head = $doc.head || $doc.getElementsByTagName('head')[0];
|
||||
// Compute some codeserver urls so as the user does not need bookmarklets
|
||||
var hostName = $wnd.location.hostname;
|
||||
var serverUrl = 'http://' + hostName + ':9876';
|
||||
var module = 'gwtreactapp';
|
||||
var nocacheUrl = serverUrl + '/recompile-requester/' + module;
|
||||
|
||||
// Insert the superdevmode nocache script in the first position of the head
|
||||
var devModeScript = $doc.createElement('script');
|
||||
devModeScript.src = nocacheUrl;
|
||||
|
||||
// Everybody except IE8 does fire an error event
|
||||
// This means that we do not detect a non running SDM with IE8.
|
||||
if (devModeScript.addEventListener) {
|
||||
var callback = function() {
|
||||
// Don't show the confirmation dialogue twice (multimodule)
|
||||
if (!$wnd.__gwt__sdm__confirmed &&
|
||||
(!$wnd.__gwt_sdm__recompiler || !$wnd.__gwt_sdm__recompiler.loaded)) {
|
||||
$wnd.__gwt__sdm__confirmed = true;
|
||||
if ($wnd.confirm(
|
||||
"Couldn't load " + module + " from Super Dev Mode\n" +
|
||||
"server at " + serverUrl + ".\n" +
|
||||
"Please make sure this server is ready.\n" +
|
||||
"Do you want to try again?")) {
|
||||
$wnd.location.reload();
|
||||
}
|
||||
}
|
||||
};
|
||||
devModeScript.addEventListener("error", callback, true);
|
||||
}
|
||||
|
||||
var injectScriptTag = function(){
|
||||
$head.insertBefore(devModeScript, $head.firstElementChild || $head.children[0]);
|
||||
};
|
||||
|
||||
if (/loaded|complete/.test($doc.readyState)) {
|
||||
injectScriptTag();
|
||||
} else {
|
||||
//defer app script insertion until the body is ready
|
||||
if($wnd.addEventListener){
|
||||
$wnd.addEventListener('load', injectScriptTag, false);
|
||||
} else{
|
||||
$wnd.attachEvent('onload', injectScriptTag);
|
||||
}
|
||||
}
|
||||
})(window, document);
|
||||