Skip to content
This repository
Browse code

fixed session login + updated docu

  • Loading branch information...
commit 634973d9f1aafca6e37aef791d956f9d19107bd9 1 parent bb755c2
Christian Meier authored
31 README.md
Source Rendered
@@ -42,6 +42,16 @@ with this you have already a GWT application with EntryPoint and could be starte
42 42
43 43 which is a GIN based setup. the __managed__ classes will be modified by the scaffold generators. the other files are once generated and can be changed as needed. the __MyAppModule.java__ can be changed with care (only the __super.configure();__ and __new GinFactoryModuleBuilder()__should stay as it is). the EntryPoint of the application is __MyAppEntryPoint.java__.
44 44
  45 +## binstubs which use bundler and setup the classpath (if needed)
  46 +
  47 +`rmvn bundle install`
  48 +
  49 +will get all the gems and jars in place and setup binstubs as bundler would do without ruby-maven. when you set your environment **PATH** to
  50 +
  51 +`export PATH=target/bin:$PATH`
  52 +
  53 +then you have all the `rails`, `rake`, `rspec` commands installed by your gems with gems + jars in place.
  54 +
45 55 ## compile to javascript ##
46 56
47 57 which is not needed for development. to compile the java code as follows.
@@ -54,7 +64,7 @@ the first compile does the java to classfile compilation which is needed for the
54 64
55 65 now you can scaffold a model
56 66
57   -`rmvn rails generate scaffold user name:string`
  67 +`rails generate scaffold user name:string`
58 68
59 69 this creates a rails like structure within the GWT _client_ package:
60 70
@@ -83,7 +93,7 @@ all other GIN bindings are done via annotations.
83 93
84 94 before running the application you need to migrate the database so the new table is in place
85 95
86   -`rmvn rake db:migrate`
  96 +`rake db:migrate`
87 97
88 98 ## start the gwt development shell ##
89 99
@@ -126,7 +136,7 @@ both *PUT* and *POST* send the new or changed resource back the GWT client, so c
126 136
127 137 the __CONFLICT__ status belongs to an optimistic persistence/transaction which can be scaffolded by adding **--optimistic** to the options (which also needs the **--timestamps** which is rails default):
128 138
129   -`rmvn rails generate scaffold user name:string --optimistic`
  139 +`rails generate scaffold user name:string --optimistic`
130 140
131 141 that optimistic persistence uses the __updated\_at__ attribute of the model to decide whether the data is still up to date or was already modified.
132 142
@@ -138,7 +148,7 @@ to run the application with default webrick you need first to compile the GWT pa
138 148
139 149 the compiler will output the GWT app in __public/MyApp__ and then start the webrick.
140 150
141   -`rmvn rails server`
  151 +`rails server`
142 152
143 153 the start url is [http://localhost:3000/MyApp.html](http://localhost:3000/MyApp.html).
144 154
@@ -154,7 +164,7 @@ when creating the application add __--menu__ switch to the commandline
154 164
155 165 or rerun the resty:setup generator with that extra switch
156 166
157   -`rmvn rails generate resty:setup com.example --menu`
  167 +`rails generate resty:setup com.example --menu`
158 168
159 169 with this you have already a GWT application with EntryPoint and could be started but does not do much. the class layout look as such:
160 170
@@ -172,7 +182,7 @@ with this you have already a GWT application with EntryPoint and could be starte
172 182
173 183 which basically adds a __MyAppMenuPanel.java__ to the application. with each scaffolded resource there will be a new button in that menu.
174 184
175   -`mvn rails generate scaffold user name:string`
  185 +`rails generate scaffold user name:string`
176 186
177 187 # login session and authorization #
178 188
@@ -184,7 +194,7 @@ when creating the application add a __--session__ switch to the commandline
184 194
185 195 or rerun the resty:setup generator with that extra switch inside an existing application
186 196
187   -`rmvn rails generate resty:setup com.example --session`
  197 +`rails generate resty:setup com.example --session`
188 198
189 199 > src/main/java/com/example/
190 200 ├── client
@@ -214,7 +224,7 @@ this comes with session handle and authorization on both the server and the clie
214 224
215 225 now a new scaffolded resource is protected by user authentication:
216 226
217   -`rmvn rails generate scaffold account name:string`
  227 +`rails generate scaffold account name:string`
218 228
219 229 `rmvn rake db:migrate`
220 230
@@ -226,7 +236,7 @@ the permissions get declared in __app/guards/accounts_guard.yml__ which is basic
226 236
227 237 now go to
228 238
229   -`http://127.0.0.1:8888/myApp.html?gwt.codesvr=127.0.0.1:9997|#accounts/new`
  239 +`http://127.0.0.1:8888/myApp.html?gwt.codesvr=127.0.0.1:9997#accounts/new`
230 240
231 241 the idle session timeout is 15 minutes and can be configured in __config/application.rb__ by adding
232 242
@@ -236,9 +246,7 @@ what's next
236 246 ----------
237 247
238 248 * error handling - i.e. validation errors (server side)
239   -* GWT editors (which will have client side validation in future)
240 249 * selenium/cabybara tests
241   -* more types on GWT, i.e. dates
242 250 * hide buttons if the logged in user does not have the permissions to use it
243 251
244 252 some little things would be
@@ -265,3 +273,4 @@ shortcomings
265 273
266 274 * ruby-maven might not support all possible configurations within the Gemfile and the maven DSL is not complete yet (from the maven point of view).
267 275 * and possible other things, but enjoy anyways ;-)
  276 +* binstub of `rspec` works with version 2.7.0.rc2 or later due the way it handled bundler before
4 resty-generators/lib/generators/resty/setup/setup_generator.rb
@@ -179,8 +179,8 @@ def csrf
179 179 ROUTE
180 180 gem 'ixtlan-session-timeout'
181 181 gem 'ixtlan-guard'
182   - # TODO until rmvn uses the right openssl gem
183   - #gem "jruby-openssl", "~> 0.7.4", :platforms => :jruby
  182 + # needs to be in Gemfile to have jruby find the gem
  183 + gem "jruby-openssl", "~> 0.7.4", :platforms => :jruby
184 184 end
185 185 end
186 186
11 resty-generators/lib/generators/resty/setup/templates/user.rb
@@ -23,7 +23,6 @@ def self.authenticate(login, password)
23 23 elsif password == "behappy"
24 24 result.login = login
25 25 result.name = login.humanize
26   - result.save
27 26 result.groups = [Group.new('name' => login)]
28 27 else
29 28 result.log = "wrong password for login: #{login}"
@@ -46,4 +45,14 @@ def to_log
46 45 "User(#{id})"
47 46 end
48 47 end
  48 +
  49 + def valid?
  50 + @log.nil?
  51 + end
  52 +
  53 + def new_record?
  54 + false
  55 + end
  56 + alias :destroyed? :new_record?
  57 +
49 58 end

0 comments on commit 634973d

Please sign in to comment.
Something went wrong with that request. Please try again.