Skip to content
This repository has been archived by the owner on May 27, 2022. It is now read-only.

[FIX] Non root url #214

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ public class AppStartup implements ApplicationListener<ApplicationEvent> {
@Value("${server.port}")
private String SERVER_PORT;

@Value("${server.servlet.context-path}")
private String CONTEXT_PATH;

@Value("${nodejs.binary:node}")
String nodeJsBinaryName;

Expand Down Expand Up @@ -124,7 +127,7 @@ private void printWelcomeMessage() {
System.out.println(" version: " + AppVersion.BUILD_VERSION);
System.out.println(" build id: " + AppVersion.BUILD_ID);
System.out.println(" build date: " + AppVersion.BUILD_DATE);
System.out.println(" Access the Cakeshop UI at: http://localhost:" + SERVER_PORT);
System.out.println(" Access the Cakeshop UI at: http://localhost:" + SERVER_PORT + CONTEXT_PATH);
}

public String getDebugInfo(ServletContext servletContext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void registerStompEndpoints(StompEndpointRegistry registry) {
.addEndpoint("ws")
.setAllowedOrigins("*")
.withSockJS()
.setClientLibraryUrl("/cakeshop/js/vendor/sockjs-1.0.3.min.js");
.setClientLibraryUrl("/cakeshop/js/vendor/sockjs-1.5.0.min.js");
}

}
2 changes: 2 additions & 0 deletions cakeshop-api/src/main/resources/config/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ spring.data.rest.basePath=/api

server.port=8080

server.servlet.context-path=/

logging.level.root=WARN
logging.level.io.swagger=DEBUG
logging.level.org.springframework=INFO
Expand Down
4 changes: 3 additions & 1 deletion cakeshop-api/src/main/webapp/js/components/Manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ export default class Manage extends Component {
}).then(response => {
if (response.status === 200) {
console.log("Success:", response.status, response.statusText);
window.location = "/";
var loc = window.location.pathname;
var dir = loc.substring(0, loc.lastIndexOf('/'));
window.location = dir + "/";
} else {
console.log("Error:", response.status, response.statusText);
}
Expand Down
2 changes: 1 addition & 1 deletion cakeshop-api/src/main/webapp/js/components/NodeChooser.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default class NodeChooser extends Component {

onChange = (option, action, other) => {
if (option.value === "manage") {
window.location = "/manage.html";
window.location = "manage.html";
return;
}

Expand Down
3 changes: 0 additions & 3 deletions cakeshop-api/src/main/webapp/js/vendor/sockjs-1.0.3.min.js

This file was deleted.

2 changes: 2 additions & 0 deletions cakeshop-api/src/main/webapp/js/vendor/sockjs-1.5.0.min.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ module.exports = function() {

_.each(hood, function(ip) {
var port = (window.location.port ? ':' + window.location.port : ''),
ep = window.location.protocol + '//' + ip + port + '/ws',
ep = window.location.protocol + '//' + ip + port + window.location.pathname + 'ws',
stomp = Stomp.over(new SockJS(ep));

stomp.debug = null;
Expand Down
2 changes: 1 addition & 1 deletion cakeshop-api/src/main/webapp/sandbox.html
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ <h3>Compiler Output</h3>
<script src="js/vendor/bluebird.core.min.js" charset="utf-8"></script>

<!-- blockchain sdk + deps -->
<script src="js/vendor/sockjs-1.0.3.min.js" charset="utf-8"></script>
<script src="js/vendor/sockjs-1.5.0.min.js" charset="utf-8"></script>
<script src="js/vendor/stomp.min.js" charset="utf-8"></script>
<script src="js/vendor/cakeshop.js" charset="utf-8"></script>

Expand Down
6 changes: 5 additions & 1 deletion cakeshop-api/src/main/webapp/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
// var stompTransClient = null;

function connect() {
var socket = new SockJS('/ws');
var loc = window.location.href;
var dir = loc.substring(0, loc.lastIndexOf('/'));

var wsUrl = dir + '/ws';
var socket = new SockJS(wsUrl);
stompClient = Stomp.over(socket);
stompClient.connect({}, function(frame) {
console.log('Connected NODE: ' + frame);
Expand Down
6 changes: 5 additions & 1 deletion cakeshop-api/src/main/webapp/test_trans.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
var stompClient = null;

function initilizeSocket() {
var socket = new SockJS('/ws');
var loc = window.location.href;
var dir = loc.substring(0, loc.lastIndexOf('/'));

var wsUrl = dir + '/ws';
var socket = new SockJS(wsUrl);
stompClient = Stomp.over(socket);
stompClient.connect({}, function (frame){});
}
Expand Down
2 changes: 2 additions & 0 deletions cakeshop-api/src/test/resources/config/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ spring.data.rest.basePath=/api

server.port=8080

server.servlet.context-path=/

logging.level.root=WARN
logging.level.io.swagger=DEBUG
logging.level.org.springframework=INFO
Expand Down
4 changes: 3 additions & 1 deletion cakeshop-client-js/src/main/javascript/lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@

Client.connected = false;
Client.connect = function() {
var loc = window.location.href;
var dir = loc.substring(0, loc.lastIndexOf('/'));

var wsUrl = '/ws';
var wsUrl = dir + '/ws';

var stomp = Client.stomp = Stomp.over(new SockJS(wsUrl));

Expand Down
7 changes: 5 additions & 2 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ The format of the JSON file is as follows:
]
```

The rpcUrl field should be the RPC endpoint on the GoQuorum (geth) node, and the transactionManagerUrl should be the Tessera 3rd Party API endpoint.
The rpcUrl field should be the RPC endpoint on the GoQuorum (geth) node, and the transactionManagerUrl should be the Tessera 3rd Party API endpoint.

Provide the location of the initial nodes file through application.properties or by using the `-D` flag mentioned above.
```sh
Expand Down Expand Up @@ -79,10 +79,13 @@ cakeshop.reporting.ui=http://localhost:3000
# port to run on
server.port=8080

# context
server.servlet.context-path=/

#logging levels
logging.level.root=WARN
logging.level.org.springframework=INFO
logging.level.com.jpmorgan.cakeshop=INFO
```

See the [default config file](../cakeshop-api/src/main/resources/config/application.properties) for more.
See the [default config file](../cakeshop-api/src/main/resources/config/application.properties) for more.