I know that returning a value from a JWSapp to the "calling" page cannot be done.
However, I use this JWSapp to get user ID from its biometric information.
The idea is that when you try to login, a button allows to launch the JWSapp that will deal with the biometric tasks and then return the user's idea.
Still, as I said, from a JWSapp I cannot send back the id to auto-complete the field. I found this post: Returning a value from a java web start application but I really need to keep the JWS (external constraints)...
So there's my question: is there any workaround to get the id back?
Thank you in advance :)
Related
my boss asked me to develop an webservice that should work in this matter:
an external app contact my app and:
if the method used is GET and the url contacted is:
http://localhost:8080/webapp/webservice/?findall
will return all rows find in a table;
If the same external app contact my app in the same method but send a key and a value like:
http://localhost:8080/webapp/webservice/?field1=value1
my app will return a set of rows filtered by field/value.
And soon on with with any method sending request and with other fields.
I know how do the operations using JPA 2.1 but how mapping the actions?
Someone could help me to starting in the right direction with JDK1.8?
i was trying to call the following web service from my android app, it hung then completed without returning the result:
web service:http://androidexample.com/media/webservice/JsonReturn.php
However when I clicked on the link, it worked fine - the json file displayed. yet it would not work in my app..
but now, it works fine now in my android app, perhaps it was temporarily down is what I am guessing. How can I know if a web service is up and running for an android app to consume ?
Typically, web services are designed to have a status page that can return status text or a HTTP return code to indicate service status.
If it doesn't have that, you can design a function to periodically do a very basic request with a known result to determine state. This is much better than doing a simple ping.
If it was down it would most likely show a HTML error page, which your app would try to parse, which would cause an error.
I had a similar issue, because I needed to know if the user was returning HTML or the correct JSON, to do this I created the ArrayList I was about to use outside of the try/catch of the parse area. You should do the same if you are using a string.
What I mean is, use:
ArrayList<Something> arrayList = new ArrayList<Something>();
String testString = ""; instead of String testString = null;
I was using only ArrayList<Something> arrayList; at one point which is incorrect. If the user then returns HTML, you won't get an error, the user will simply return an empty arraylist or empty string.
You can then plan for that and show some sort of error message. This way you only need one network request but you can still plan for getting the data back, and the server being down.
I am working on a Phonegap application that uses an Android service to check for message updates while the app isn't being used. In order to do that, however, I need the session key generated by the user's username and password. The generation of the session key is handled on the Javascript/HTML side of things while the app is active in the foreground.
My question is, how do I access a Javascript variable for use in Java? I need the session key value as a String object in Java. I just need to access it once, and I don't have a clue how Javascript-to-Java communication works.
You can pass a javascript variable to the java while using the plugins as below.
cordova.exec(null, null, "service", "action", ["firstArgument", "secondArgument", 42]);
Here the first and second parameter to the exec method are the sucess and failure calllback.
service and action are the native class and method names respectively.
And the last parameter ["firstArgument", "secondArgument", 42] are the javascript variables which you can pass to the native method.
For more details please go through the following link.
http://docs.phonegap.com/en/2.8.0/guide_plugin-development_index.md.html
I have a very basic Wicket app that I'm trying to deploy to GAE. I have the basics working, after following the steps here and also binding the session object upon creation.
I'm having trouble saving any state in a session. My session class extends AuthenticatedWebSession. The login pages authenticates via AuthenticatedWebSession.authenticate(), which always returns true and sets the username in a member variable. But subsequent pages see a null username in the session and AuthenticatedWebSession.isSignedIn() returns false.
I do seem to be maintaining a session, as every page will see the same value for Session.getId().
Any ideas?
TIA!
Chris
My question was answered on the Wicket mailing list - the answer is that I needed to call Session.dirty() after authenticating (or after any other change to the session members) to ensure it would be saved. Apparently in my development environment, sessions were always saved but GAE is more optimized and thus only saving dirty sessions.
I spent about 2 days devling down the rabbit hole of sessions and cookies and I finally realised my issue was this:
app.secret_key = os.urandom(50)
Every time an instance boots up it generates a new key and now the users session is lost.
You need to make your key static
app.secret_key = "really-complex-key-that-is-static-and-never-changes"
Hopefully this is your issue to
I'm in little trouble with designing GWT application. I am trying to develope RIA app (with just one main widget, lets call it Main). First, user must be logged. Here's my way to do that, but it does have a problem, you'll see.
Show login components on root panel
If login was successfull (checks database), show Main widget
Widget is added to root panel
Everything works, but when you press Refresh it shows again login components ... It all happens in onModuleLoad method.
How should I redesign this logic? I'd like to let user logged (that means RootPanel will hold Main widget) for certain amount of time.
http://code.google.com/p/google-web-toolkit-incubator/wiki/LoginSecurityFAQ
How to remember logins
Our login
system so far misses a useful feature:
For now it requires users to log in
again every time.
We can use Cookies to allow the user's
web browser to 'remember' the login.
In GWT, to set the cookie (which you'd
do right after your GWT code receives
the response as we did in the previous
code fragment):
String sessionID = /*(Get sessionID from server's response to your login request.)*/;
final long DURATION = 1000 * 60 * 60 * 24 * 14; //duration remembering login. 2 weeks in this example.
Date expires = new Date(System.currentTimeMillis() + DURATION);
Cookies.setCookie("sid", sessionID, expires, null, "/", false);
Now you can run the following code
right after your !EntryPoint begins
execution:
String sessionID = Cookies.getCookie("sid");
if ( sessionID != null ) checkWithServerIfSessionIdIsStillLegal();
else displayLoginBox();
Remember - you must never rely on the sessionID
sent to your server in the cookie
header ; look only at the sessionID
that your GWT app sends explicitly in
the payload of messages to your
server.
I'm not sure what how your GWT app implemented communication with the login service, but if you want to see another example, I followed the example here:
http://code.google.com/webtoolkit/doc/latest/tutorial/appengine.html#user
While it uses the Google App Engine as the backend authentication service, I think it's generic enough to be adapted to any server that supports the GWT RPC server side and has authentication services.
You need some kind of server-side support to do it.
For example, when user logs in, mark it in the server-side session. In onModuleLoad(), call the server to check whether user is logged in before showing the login form.
Other problems related to pressing Refresh can be solved with history tokens.