google-app-engine


gwt appengine - user service return page


I have an entire gwt home page, it has a sign in button (rpc).
This is the service implementation (just like the example):
UserService userService = UserServiceFactory.getUserService();
HttpServletRequest request = this.getThreadLocalRequest();
String message = "";
String thisURL = request.getRequestURI();
Principal principal = request.getUserPrincipal();
if(principal == null){
message = "<p>Please sign in.</p>";
}
else{
message = "Hola " + principal.getName() + ". Puedes <a href=\"" +
userService.createLogoutURL(thisURL)+ "\">sign out</a>.</p>";
}
return message;
I let the doGet method empty.
Then, when I sign in/sign out it redirects me to a blank page (to myApp/myServlet), but I want to back to the page I was (my gwt home or wherever I was).
Point A: request.getRequestURI(); method. This method would always return the URL of the servlet where the current request is being processed.
Point B: In userService.createLoginURL(thisURL) , the thisURL is actually the URL where the user should be redirected to after successful login. In your case, thisURL point to your current the servlet path and not where you want the user to be redirected to (refer point A)
That is, if your page where you want to redirect user after successful login is www.yourapp.com/home, what you actually need to do is something like this:
UserService userService = UserServiceFactory.getUserService();
HttpServletRequest request = this.getThreadLocalRequest();
String message = "";
String thisURL = "http://www.yourapp.com/home";
Principal principal = request.getUserPrincipal();
if(principal == null){
message = "<p>Please sign in.</p>";
}
else{
message = "Hola " + principal.getName() + ". Puedes <a href=\"" +
userService.createLogoutURL(thisURL)+ "\">sign out</a>.</p>";
}
return message;
^Note the value being set for thisURL.

Related Links

How to solving ImportError: No module named scraping
Securely providing external service credentials to Google App Engine?
Arduino make GET request to Google app engine
Is my GAE Search corrupt?
Jinja2 reuse templates for new and edit
Using QuerySplitter in Google Datastore to load chunks of a known size
Can you explain what the app engine context interface is?
How to ensure that my entity will never be an orphan?
GAE custom Go runtime - internal.flushLog error
Google Datastore - Search Optimization Technique
Can't lease tasks by service account
Why custom domain “myapp.com” which replaces “myapp.appspot.com” took so long to load when comparing to “myapp.appspot.com”?
Does objectify have a get_or_insert equivalent
Custom domain from google not routing to App engine site
Unable to stop or delete datalabs environment on Google Cloud Platform
Is there a way to interactively create a new Datastore entity kind for Go GAE apps?

Categories

HOME
fabricjs
scikit-learn
design-patterns
delphi-7
time-complexity
dns
apache-jena
zend-framework
swt
static
battery
requirements
sublimetext
alarm
access
cakephp-3.4
3d-reconstruction
gembox-spreadsheet
interpolation
computer-science
google-form
automatic-ref-counting
powershell-v5.0
intershop
dimensional-modeling
vuejs
google-data-studio
sse
question2answer
displaytag
roundup
slidetoggle
pylons
inversion-of-control
sinch
openmdao
testcomplete
cognos-bi
kodi
rselenium
hibernate-search
numpy-broadcasting
parse-tree
salesforce-communities
node-mssql
typesafe-config
kill
visa
levenshtein-distance
xmldocument
jide
term
linter
gitlist
reindex
compiler-design
truezip
sundials
monkey
preprocessor
adafruit
neon
xdoclet
phpwebsocket
custom-errors
r-package
vigenere
microsoft-reporting
ons-api
avahi
fail2ban
zxspectrum
gamekit
document-repository
infosphere-spl
ejb-2.x
formview
tweenlite
gii
ss7
cancellation
authlogic
fpdi
koala
openargs
android-usb
mt4j
isqlquery
jeromq
modular
hidapi
composite-component
tree-balancing
dajaxice
cuda-gdb
objectquery
usertype
floating-point-exceptions
jquery-address
xui
http-daemon
spread
wcf-instancing
lobo-cobra
perl5.12
int64
ifilter
great-circle

Resources

Encrypt Message