I am making an application of javafx, in which I need to call the fxbrowser with some post parameter, so that on server side we can verify the user and generate the response according to that.
We can send data by just url?p1=v1&p2=v2....
But Is it possible to call webengine.load(url) with some post parameter?
You need web automation library to fill form and submit. You could use ui4j which is wrapper to JavaFX WebView component.
Check this BingSearch example which submits form and extracts the search result.
Related
I have some questions about routing using Node.js and Express.
I have a running application where you can add items in different ways (e.g. via 'URL'). Let´s describe that further:
I have to different routes:
/create: Choose adding option in a form with dropdown list (e.g. via 'url')
/create/validate: Form which shows the retrieved data
/create:
When pressing the "Add" button on my main page an GET request on this route will render a form where you can choose the inserting option.
In this form you can choose in a dropdown list one option (e.g. 'URL') and press the "Submit" button. The POST request collect the entered information which are available inside the req.body.
Before sending the entered data to my database I want to perform a validation. That means, the entered data is rendered in a validation form (which is shown to the user) on route /create/validate.
The problem here is, that I can´t send the entered data from /create POST request to the /create/validate GET request for the form.
Right now my /create POST request is redirecting to the /create/validate route and saving the url content in a local variable, which can be then accessed in my /create/validate GET request for further processing.
So summing up:
I want the entered data of the /create POST request available in the /create/validate GET request.
Is there any other way instead of saving the content to a local variable?
The best way is just keep a global variable somewhere outside your http handlers. That data will stick around, between request, on the server side, as long as the node process is running.
Otherwise an other solution is using localstorage for node.js
https://www.npmjs.com/package/node-localstorage
I have data in the NetSuite. We have provided button in NetSuite. I want to perform HTML Form Post operation on this button click, so that web end point accepts that data and presents on UI.
On button click, we want to simulate HTML Form submission.
How this can be achieved?
You have jQuery 11.1 loaded by NetSuite on every page. You can create an inline HTML field with your Javascript/jQuery code.
Just bind a function to the click event of the button. In that function you can use .ajax to perform an HTTP POST or .post to make a form submission to the server.
Don't forget to set e.preventDefault at the beginning of your function.
I'm building my user authentication and the tutorials don't really get into details in 100%.
The examples always show how you get logged in if you submit data, assuming it's in the database already.
But on many HTML pages, you see sign in and log in button next to each other. How can I make body parser recognize the required function depending on which button is pressed? Both cases involve submitted data after all.
Thanks a lot!
PS. I'm using EJS view engine.
Body parser has nothing to do with log in or sign in.
It's purpose is to parse request's body by checking request header Content-type and using appropriate method to parse it. For example if content is json it will use JSON.parse and assign the result to req.body.
The buttons could be anchors with href set to /login or /signin so on your server you need login and signin routes to handle each of the actions
I'm creating a script that grabs all the shipped items from Amazon and notifies me.
Authentication is needed to see the products though.
I've already tried sending a post request through "request" which returns an error because of the cookies and extra parameters needed.
It would be easy using cheerio afterwards to get the data if the authentication works.
Does anyone have any idea on how we can authenticate successfully?
The link from the email is: https://www.amazon.com/ap/signin/185-3199906-8918341?_encoding=UTF8&accountStatusPolicy=P1&openid.assoc_handle=usflex&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&openid.pape.max_auth_age=0&openid.return_to=https%3A%2F%2Fwww.amazon.com%2Fgp%2Fyour-account%2Forder-details%2F185-3199906-8918341%3Fie%3DUTF8%26eoid%3D1%253A1%253Arv%252FYwjiYmnOZY9MYltVnDyf2l6p5pMkMx9deoUeiiw%252FKpPrtZrWqs5l1GGQPVb%2520qaJqHXyCkPEpLZnmDZamKkVDWhtu3dKlW5Gx7Uvxtzs0xlPJ25vduijJrPpHt79P%2520RRZHopOtAyOP4s82VLoeeiDQgq%2520FCP540H%2520UYAV7goZQxB29WObWAVh8VveTwEeWenY3sTx8ZI9%252FBLM2BSqS3IUIURW8mzMnAB9t7wglUiAcoR%252FcUhSIx%25201eNV4MspVAp7fLkeANag72BxgmsjFfRhnsxfji1VhZXLawqFeK9SBnvbUfkNWUC%2520IXWh6VcuoStBG3x%2520ZUkzGHw1ORi4J%2520Hg%253D%253D%26orderID%3D105-6914722-5422613%26ref_%3DTE_simp_on_T1&pageId=webcs-yourorder&showRmrMe=1
You cannot guarantee any of the form input values of the sign in page. So you must also scrape the login form.
Here is the process:
In your server, make Request to the URL in your question
Using Cheerio parse the DOM and grab all of the form fields from "#ap_signin_form".
Add in your data (Username/Pass) then make a POST request to the form action "https://www.amazon.com/ap/signin" (This should also be scraped)
Hopefully that will get you past the login screen. You will need to ensure all future requests pass the cookies set from login.
Now this kind of thing is clearly against most TOS's so I would urge caution in doing this kind of thing often.
Hi i have this application that needs a user to login.
Once the user is logged in, he is redirected to a page displaying documents for that user.
To display that information, I call the correct action on the controller and i pass my user-object. This object contains username and password.
When i look at my url it looks like :
http://localhost:53703/Documents?UserName=bart&UserId=10&Password=AllPhi%242015
Is there a way that I can hide those querystring-values (UserName=bart&UserId=10&Password=AllPhi%242015)
I can not object strongly enough to sidestepping the built in auth-mechanisms, but to answer the question: You cannot hide the query-string.
If you want to hide data when you are sending from a client you need to do a post request instead of a get, but the post-data is still visible in the request (in plain text)
But in this case it seems you want to pass data between actions, and then you want to use tempdata. Look here for reference: http://rachelappel.com/when-to-use-viewbag-viewdata-or-tempdata-in-asp.net-mvc-3-applications