Setting up Polymer as a Web App under Resin (or any JEE app server)

126 views
Skip to first unread message

Carl Whalley

unread,
Dec 31, 2015, 2:36:35 PM12/31/15
to Polymer
Hi - I'm struggling with this, mainly because I want to combine Polymers local offline routing with the online session management Resin provides. I'm sure there are only 
3 changes I need to make to the Starter Kit to do this, and one of them is easy ;-) To clarify - a web-app is named, here it's "example.com" - and all 
routes refer to this in the URL. In production it's virtually the default, but the setup I'm aiming for here would be great for dev.

The changes I need:

1. Stop using !# in URLs

2. With a web-app called "example.com", ensure all references use localhost:8080/example.com/* So for example, the Starter Kit home is now localhost:8080/example.com and users becomes localhost:8080/example.com/users etc. NB - this change has nothing to do with Resin or Web-apps at this stage, it's just a funky Polymer config. I think this needs a baseUrl setting somewhere.

3. If an example.com/* url isn't matched in the local route list, don't give up and go to the home page but hit it anyway. For example, localhost:8080/example.com/login.jsp

Thanks

Carl Whalley

unread,
Jan 1, 2016, 10:27:33 AM1/1/16
to Polymer
On Thursday, December 31, 2015 at 7:36:35 PM UTC, Carl Whalley wrote:
Hi - I'm struggling with this, mainly because I want to combine Polymers local offline routing with the online session management Resin provides. I'm sure there are only 3 changes I need to
 
After more work I can show where the trouble is. 

1. Install the starter kit with yeoman and run polyserve.

2. Notice the urls are localhost:5000 for Home, localhost:5000/users for Users etc. We want localhost:5000/example.com, localhost:5000/example.com/users - even though there is no folder "example.com". The files are still served from the default.

3. In routing.html set the page hashbang from true to false.

4. Edit app.js so that at line 19 the app.BaseUrl = '/example.com/';

5. Mouse over the menu links and see the urls look correct...

6. ...Until clicked, when the popup reports every url is not found and returns you to the Home screen.

So - what else should I edit to fix this please?

Rob Dodson

unread,
Jan 2, 2016, 6:30:16 PM1/2/16
to Carl Whalley, Polymer

Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/f038477c-6a71-4da0-a357-5b563bc75131%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Carl Whalley

unread,
Jan 3, 2016, 12:29:42 PM1/3/16
to Polymer, carl.w...@gmail.com
Thanks. I had actually tried that but when I got the errors below, gave up because it seemed too focused on Github rather than the "pseudo dir" in the URL I need:

Y:\polymer-starter-kit>gulp build-deploy-gh-pages
[17:18:29] Using gulpfile Y:\polymer-starter-kit\gulpfile.js
[17:18:29] Starting 'build-deploy-gh-pages'...
[17:18:29] Starting 'clean'...
[17:18:29] Finished 'clean' after 87 ms
[17:18:29] Starting 'default'...
[17:18:29] Starting 'copy'...
[17:18:29] Starting 'styles'...
[17:18:37] styles all files 98 B
[17:18:37] Finished 'styles' after 7.52 s
[17:19:09] copy all files 12.98 MB
[17:19:09] Finished 'copy' after 40 s
[17:19:09] Starting 'elements'...
[17:19:09] Finished 'elements' after 67 ms
[17:19:09] Starting 'lint'...
[17:19:32] Starting 'images'...
[17:19:37] Starting 'fonts'...
[17:19:37] Starting 'html'...
[17:19:41] Finished 'fonts' after 4.65 s
[17:19:43] Finished 'lint' after 34 s
[17:19:43] html all files 52.43 kB
[17:19:43] Finished 'html' after 6.49 s
[17:19:43] gulp-imagemin: Minified 6 images (saved 494 B - 1.4%)
[17:19:43] images all files 35.41 kB
[17:19:43] Finished 'images' after 12 s
[17:19:43] Starting 'vulcanize'...
[17:19:46] vulcanize all files 484.34 kB
[17:19:46] Finished 'vulcanize' after 2.96 s
[17:19:46] Finished 'default' after 1.28 min
[17:19:46] Starting 'deploy-gh-pages'...
[17:19:59] 'deploy-gh-pages' errored after 13 s
[17:19:59] Error in plugin 'gulp-gh-pages'
Message:
    Command failed: C:\Windows\system32\cmd.exe /s /c "git clone undefined .publ
ish"
fatal: repository 'undefined' does not exist

Details:
    killed: false
    code: 128
    signal: null
    cmd: C:\Windows\system32\cmd.exe /s /c "git clone undefined .publish"
[17:19:59] 'build-deploy-gh-pages' errored after 1.5 min
[17:19:59] Error in plugin 'run-sequence'
Message:
    An error occured in task 'deploy-gh-pages'.

Y:\polymer-starter-kit>

Carl Whalley

unread,
Jan 8, 2016, 5:37:58 AM1/8/16
to Polymer, carl.w...@gmail.com
On Sunday, January 3, 2016 at 5:29:42 PM UTC, Carl Whalley wrote:

Thanks. I had actually tried that but when I got the errors below, gave up because it seemed too focused on Github rather than the "pseudo dir" in the URL I need:

[17:19:59] Error in plugin 'gulp-gh-pages'
Message:
    Command failed: C:\Windows\system32\cmd.exe /s /c "git clone undefined .publ
ish"
fatal: repository 'undefined' does not exist

Details:
    killed: false
    code: 128
    signal: null
    cmd: C:\Windows\system32\cmd.exe /s /c "git clone undefined .publish"

"git clone undefined .publish"


"git clone undefined .publish"

It's telling the truth - there is no "undefined" repo because what I'm trying to do has nothing do do with git :-(

Any more thoughts on this please? Its something I thought would be so easy - just sticking a fake path in the Polymer target URL - that I was sure would be a cinch for anyone here.
All I'm trying to do is use Resin, Tomcat etc locally rather than node.js which needs this, even though it's actually not really anything to do with them.

Rob Dodson

unread,
Jan 8, 2016, 6:38:21 PM1/8/16
to Carl Whalley, Polymer
oh yeah you wouldn't run the deploy-gh-pages step, instead you'd just drop the dist dir on your server.

Reply all
Reply to author
Forward
0 new messages