WebVIew POST to a URL?

Hey ladies and gentlemen,

I'm looking to send a post request to a URL in a WebView and were unable to determine any reasonable way to do it. I'm looking for something similar to the method of requestContent of BrowserField in BBOS (http://www.blackberry.com/developers/docs/5.0.0api/net/rim/device/api/browser/field2/BrowserField.ht....

Any ideas?

Advertisement

I solved this by calling a WebService as usual of in c ++, and then convert the chain reaction. From that moment I just use the function loadHtml Web layout to define the content.

Tags: BlackBerry Developers

Similar Questions

  • WebView: Content is not being updated after changing the URL

    I wrote a code that updates the Blackberry main.qml WebView URL after that some process is running. QT/C++ code that updates WebView URL is given below

    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
    qml->setContextProperty("app",this);
    AbstractPane *root = qml->createRootObject();
    responseWebPage = root->findChild("responseWebPage");
    responseWebPage->setUrl(QUrl(homePath + "/Appname/updatedhtml.html"));
    

    I even tried to signals and SLOTs and yet it did not work

    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
    qml->setContextProperty("app",this);
    AbstractPane *root = qml->createRootObject();
    responseWebPage = root->findChild("responseWebPage");
    responseWebPage->setUrl(QUrl(homePath + "/Appname/updatedhtml.html"));
    bool response = QObject::connect(responseWebPage, SIGNAL(urlChanged(QUrl)), responseWebPage, SLOT(reload()));
    Q_UNUSED(response);
    Q_ASSERT(response);
    

    WebView main.qml article is

    WebView {
       id: responseWebPage
       objectName: "responseWebPage"
       accessibility.name: "responseWebPage"
       url: "local:///assets/initialcontent.html"
       onUrlChanged: {
          console.debug("URL is changed. New URL is " + responseWebPage.url);
       }
    }
    

    I am able to see the URL name updated in the newspapers printed by WebView debug console. I also checked that the file updatedhtml.html exists. (Checked through the system target file browser). Yet once the URL is set, I see no updatedhtml.html content displayed in device or Simulator. Is there any step I'm missing? Any help is greatly appreciated

    Ahh, I see what you're missing today.  You have created a new Page, it adds the WebView and set its URL, but you have actually posted this page.  What kind of navigation you are trying to use here?  If you want to display a new page and allow the user to return to the previous, look here: https://developer.blackberry.com/native/documentation/ui/navigation/multiple_screens_stack.html

    If you want to replace the current page with a new one, you must call setScene.  Alternatively, you can access the page currently displayed when it exists and update the WebView on it.

    Whatever approach you take, I recommend this reading for an overview on how the user of Cascades interface fit: https://developer.blackberry.com/native/documentation/dev/fundamentals/index.html

  • Encode the part of the URL (search)

    I want to be able to do a search on Google in a webview, by setting the URL "'https://www.google.com/search?&q= ' + 'Search'."

    The problem is that if the query contains a sign, + it get interpreted as a space (which is happening in a few popular applications, including the browser of evolution).

    I read that encodeURIComponent should solve this problem, so I changed the code for "'https://www.google.com/search?&q= ' + encodeURIComponent("+"), but research that results is actually % 2B."  Strangely, when I type the resulting URL in my computer, I get the correct result (a search of +).

    import bb.cascades 1.2
    
    Page {
        property string search: "https://www.google.com/search?&q=" + encodeURIComponent("+")
        Container {
            TextField {
                text: web.url
            }
        WebView {
            id: web
            url: search
        }
        }
    }
    

    This is the minimum project, I used to test my code.

  • WebView - a few questions

    I use WebView and even the stunts for the first time (I learned qt already) and I have a few questions.

    How can I listen to the signal of onURLChanged() - I tried to connect to its signal in the PRC, but do not shoot my slot. I call a function in my CPP code indicating its name in qml?

    I ask on qml because I think that there is connection of signals / slots in qml examples I've seen (by omitting the need to connect (mWebView, onUrlChanged(), myFunction()) but I don't see how I could connect say webview onUrlChanged (const QUrl & url) to myFunc (QUrl & myurl) located in a .cpp file using code rather than c qml ++.) Is this possible?

    Also, when I open a Web using Webview page and then reload the application, I get an error momentics can prepare and download of executables which means I have to restart dev unit alpha - what should I do with webview in deconstructor to stop this requirement to reboot?

    Thanks for any help you can offer.

    I'm sorry, meant that the parameter names must be qualified full.

    This one should work:

       QObject::connect(mView, SIGNAL(urlChanged(QUrl)),
                         this, SLOT(urlChanged(QUrl)));
    
    void ClassName::urlChanged(const QUrl& url)
    {
      ...
    }
    
  • IlleagalstateException by more than 1 url in net.rim.device.api.browser.field2.BrowserFeild (5.0)

    Hi all

    What I'm trying to add a BrowserField (JDE v5.0) to the form and request a url through it. Now, if I want to go to some second url to check if browserfield exist if it exists, then I ask the url with the same variable browserfield sencond. If I quickly access the second URL that is to say, it is still in progress poster the first url can I get exception Illeagal.

    This exception only in the Simulator run mode if debug I don't get this exception. What could be the problem someone?

    Thanks in advance

    I had the same problem but I solved it. To my knowledge we can't add the same object, once more if you then add the GUI object is already existed on the screen (or Manager). Better add no more same instance of the field in the UI.

    Say for example:

    Setting RichTextField = new RichTextField ("Test");

    Add (Setting);

    to do something

    definition = new RichTextField ("Test");

    Add (Setting)

    Now, you will get the exception.

    Other wise, you can use the setter method to change the content or redirect the page.

    anotherwise you can use the replace (oldField, newField).

  • A unique identifier for the post blog items?

    When I came across this problem, it surprised me that I could not find any documentation about it. Since we now have a tag to give a point of web application a unique identifier, {tag_itemid}, I was surprised not to find this same feature for a blog post item. When I open my file postlist blog, wouldn't be helpful to have a tag like {tag_blogpostid}? I can see the ID of the blog post in the URL (see below), when I create/edit, I have no way to access!

    blog-url.png

    Someone at - there a work around? Am I missing something?

    Thanks, Curtiss

    Hey Curtis,.

    There is a tag called exactly {tag_blogpostid} you can use in your postlist blog layout.  It comes as an option with BC in Dreamweaver or in the editor to the Admin, but I see that they use this tag in the comment form on my default postlist layout.  Here's a gist of the presentation of the list of default blog post.  7 and 16 drum lines:

    https://gist.github.com/thetrickster/0febde7316e8f66ff013

    It IS a tag.  I wonder if it only allows once however if this tag does not work for you.  Try it.

  • Captivate post back

    Hello

    I'm working on a new site for my business where we are able to offer tests online for our customers.

    We use Captivate since it was the best option, but when a user has completed the test, we need to have the results by email and processed on our site.

    I found the options to send an email, but it's stupid because it opens a new window of e-mail client and the user is able to change their results before sending

    The other option was custom javascript... I've seen a few sites that show you how to get the data and who post to a url or something, but I can't get this to work for the life of me (I'm not a man of java)

    Basically, what I'm looking for is a method or option for Captivate to POST to a url with the results, preferably in the url as parameters, after that my code runs.

    Any suggestions on the javascript methods or is it possible in fact an option post in captivate that I missed?

    Andrew

    Ahhh okay, gotcha.

    For some reason, I never considered that make part of the handling of forms. I just always considered that it is the same as creating a link that opens another file or web page.

    You are able to supply parameters to the URL strings, but you will find that Captivate does not like spaces. So if you can use a space, you must encode using %20 representing space.

    See you soon... Rick

    Useful and practical links

    Captivate wish form/Bug report form

    Certified Adobe Captivate training

    SorcerStone blog

    Captivate eBooks

  • URL of discoverer is added at the end of the name of EUL Language Code

    Dear all,

    I configured a new discoverer report.
    I'm as in menu self-service.
    It gives EUL Unreachable error.
    When I checked the URL, it is adding "_US" on behalf of the GUE.
    For example,.
    http://oratest.Emaar.AE:9999/discoverer Viewer? Connect = APPS_SECUREoratestdb_dd & SessionCookieName = oratestdb_dd & eul = EUL_PROD_US...
    When I removed "_US" and updated, it worked.
    In fact I EUL as 'EUL_PROD' and not 'EUL_PROD_US '.
    How we prevent oracle adding to this?

    For the profile "ICX: discoverer end-user layer language substitute" and "ICX: language ', I changed value of previous value of the 'American English' site, responsibility and user level.

    Kind regards
    Gwendal Shah

    PL see your double post here - discoverer URL is added at the end of the name of EUL Language Code

    Srini

  • AJAX request fail with "no transport.

    Hello

    I have the following call:

    $.ajax
    ({
        type: "POST",
        crossDomain: true,
        url: "http://domain.net:2000/login_check.php",
        dataType: "text",
        data: {user: username, pass: password},
        success: function(data)
        {
            if (data.trim() == "S")
            {
                window.location="profile.html";
            }
            else
            {
                window.location="index.html";
            }
        },
        error:function (xhr, ajaxOptions, thrownError)
        {
            alert(xhr.status);
            alert(thrownError);
        }
    });
    

    It works in a normal browser, and even in the emulator of ripple (isn't that the emulator ripple supposed to imitate and not just be a wrapper of chrome?), but on the device, the call fails. thrownError returns "no transport.

    Did I miss something in my file config.xml?

    
    
    
    
    http://www.w3.org/ns/widgets"
            xmlns:rim="http://www.blackberry.com/ns/widgets"
        version="1.0.0.0">
    
      Launch Lawyer
    
      
          Launch Lawyer
      
    
      http://opensource.org/licenses/alphabetical">
      
    
      
      
      
      
      
      
      
      
      
      
      
      
      
    
      
      
      
    
      
      
    
      
      
    
      
        
      
    
      
    
    
    

    in your config.xml file, try to add this element:

    
    TCP_WIFI
    BIS-B
    TCP_CELLULAR
    MDS
    WAP2
    WAP
    
    

    or configure this depends on you internet connection transport you use in the camera.

  • Add to address book - add images

    Hello

    I am add contact to the address book. Info is well added, but adding a Photo to a Contact does not work. I am trying to add a static image to Contact. There are a few messages to fail in the console...

    Debug: extractNewPhotos: the main photo file: "file://asset: / / / images/avatar.png" id: 0
    Debug: [DEBUG] received a notification for unified, notification contact person: "contact_new."
    Debug: [DEBUG] received contact ID: (QVariant (int, 14))
    Debug: [DEBUG] sent contactNew signal to contact id: (14)
    Debug: Successful Open:
    Debug: Details of the Session "https://discoveryservice.blackberry.com/discoveryPoxmlServlet/", "3fb64670-0400-4485-8494-fdb44fb5d1c7" '1.0"'127.0.0.1' 8888
    Debug: POST
    Debug: Buffer URL: http://127.0.0.1:8888/contacts/4? company = 0

    Debug: Make easy Curl - dab
    Debug: [DEBUG] received a notification for unified, notification contact person: "contact_new."
    Debug: [DEBUG] received contact ID: (QVariant (int, 15))
    Debug: [DEBUG] sent contactNew signal to contact id: (15)
    Debug: GetInfo Easy Curl response Code
    Debug: Curl getInfo easy content_length_download
    Debug: Curl error Code 0
    Debug: Response Code 200
    Debug: Form Data json=%7B%22filepath%22%3A%22asset%3A%2F%2F%2Fimages%2Favatar.png%22%7D
    Debug: POST
    Debug: URL buffer: http://127.0.0.1:8888 / contact/4/15/photos

    Debug: Make easy Curl - dab
    Debug: GetInfo Easy Curl response Code
    Debug: Curl getInfo easy content_length_download
    Debug: Curl error Code 0
    Debug: Response Code 500
    Debug: Status Code 500
    Debugging: Exception string "an unexpected problem occurred with %s (account). Some features may not work properly. "% {"status": 500}"
    Debug: called getContactDtails 15
    Debug: GET
    Debug: URL buffer: http://127.0.0.1:8888 / contact/4/15

    Debug: Make easy Curl - dab
    Debug: GetInfo Easy Curl response Code
    Debug: Curl getInfo easy content_length_download
    Debug: Curl error Code 0
    Debug: Response Code 200

    Code is:

    ContactService* service = new ContactService(this);
        ContactBuilder builder;
    
       QVariantMap photoMap  = directoryMap.value("photos").toList()[0].toMap();
        if( photoMap.count()>0 ) {
                ContactPhoto photo = ContactPhotoBuilder()
                                    .setOriginalPhoto("/images/avatar.png");
            builder.addPhoto(photo);
        }
        bb::pim::contacts::Contact createdContact = service->createContact(builder, false);
        if (createdContact.id()){
                       qDebug() << "--------addToNAB------"<<"DONE..!!";
    }
    

    EDIT: Same questions I'll have while adding the postal address. I guess that these features do not work immediately...

    OK, I got a response from PBernhardt, to add the address.

    "It's actually a documentation problem. You must define the genre of sup on the mailing address. It should be like .setSubKind (AttributeSubKind::Work) or home or other

     

    Correction is: ContactPostalAddressBuilder (address) .setSubKind (AttributeSubKind::Work);

  • Not getting variable not initialized

    Hi all

    I am facing a problem very very irritating. I'm doing an HTTP connection to a URL of web on a separate thread. The connection class is given below

    import java.io.IOException;import java.io.OutputStream;import java.io.InputStream;import javax.microedition.io.Connector;import javax.microedition.io.HttpConnection;
    
    /** * This class creates a HTTP connection object and communicates with * server on a separate thread from the Event thread. */
    
    final public class ConnectionThread extends Thread {
    
        /**     * Flag to start the HTTP connection.     */    private boolean m_bStart = false;
    
        /**     * Flag to stop the HTTP connection.     */    private boolean m_bStop = false;
    
        /**     * URL of the server to connect to.     */    private String m_sURL;
    
        /**     * Data to be written to the connection oyput stream.     */    private String m_sData;
    
        /**     * Flag to send back the result from the HTTP connection to the caller.     * If HTTP connection status is ok then this will be set to true, else false.     */    public boolean m_bSendResult = false;
    
        /**     * This flag tells the caller that the HTTP connection is not complete yet.     */    public boolean m_bSending = false;
    
        /**     * The request mode of the HTTP connection. Default is POST.     */    private String m_sRequestMode = HttpConnection.POST;
    
        /**     * The content returned by the HTTP connection as a response.     */    public String m_sResponseContent;
    
        /**     * This two-dimensional array stores the header key and value pair     * to be sent with the HTTP request.     */    private String[][] m_sHttpHeaders;
    
        /**     * Overridden method     */    public void run() {        while (true) {            if (m_bStart == false && m_bStop == false) {                try {                    sleep(200);                } catch (InterruptedException e) {                    e.printStackTrace();                }            } else if (m_bStop) {                return;            } else if (m_bStart && m_sURL != null) {                http();            }        }    }
    
        /**     * Reads and creates the response content from the HTTP connection Input Stream.     * @param conn HttpConnection     */    private void getResponseContent( HttpConnection conn ) throws IOException {        InputStream is = null;        is = conn.openInputStream();
    
            int len = is.available();        if ( len > 0 ) {            /*int actual = 0;            int bytesread = 0;            byte[] data = new byte[len];            while ( ( bytesread != len ) && ( actual != -1 ) ) {                actual = is.read( data, bytesread, len - bytesread );                bytesread += actual;            }            m_sResponseContent = new String (m_sData);            */            int ch;            int i = 0;            StringBuffer buffer = new StringBuffer();            while((ch = is.read()) != -1) {                buffer.append((char)ch);                i++;            }            System.out.println("Total bytes read:: " + i);            m_sResponseContent = buffer.toString();            //System.out.println("======================Response xml====================");            //System.out.println(m_sResponseContent);            //System.out.println("======================================================");        } else {            int ch;            while ( ( ch = is.read() ) != -1 ) {
    
                }        }    }
    
        /**     * Creates the HTTP connection object and handles the communication.     */    private void http() {        HttpConnection conn = null;        OutputStream out = null;        int responseCode;
    
            try {            conn = (HttpConnection) Connector.open(m_sURL);            conn.setRequestMethod(m_sRequestMode);            if(m_sHttpHeaders != null && m_sHttpHeaders.length > 0) {                int rows = m_sHttpHeaders.length;                for (int i = 0; i < rows; i ++) {                    conn.setRequestProperty(m_sHttpHeaders[i][0], m_sHttpHeaders[i][1]);                }            }            out = conn.openOutputStream();            out.write(m_sData.getBytes());            out.flush();            responseCode = conn.getResponseCode();
    
                //System.out.println("Response code:: " + responseCode);            if (responseCode == HttpConnection.HTTP_OK ||                responseCode == HttpConnection.HTTP_CREATED) {                    getResponseContent( conn );                    m_bSendResult = true;            } else {                m_bSendResult = false;                m_sResponseContent = responseCode + "";            }            m_bStart = false;            m_bSending = false;        } catch (IOException e) {            m_bStart = false;            m_bSendResult = false;            m_bSending = false;        }    }
    
        /**    * Set the request method as GET.    * @param url URL to connect to.    * @param headers Header informations.    */    public void get(String url, String[][] headers) {        //this.m_sURL = url;        m_sURL = url + ";interface=wifi";        //this.m_sURL = url + ";deviceside=true";        m_sData = "";        m_sHttpHeaders = headers;        m_sRequestMode = HttpConnection.GET;        m_bSendResult = false;        m_bSending = true;        m_bStart = true;    }
    
        /**     * Set the request method as POST.     * @param url URL to connect to.     * @param data Data to be written to the connection oyput stream.     * @param headers Header informations.     */    public void post(String url, String data, String[][] headers) {        //this.m_sURL = url;        this.m_sURL = url + ";interface=wifi";        //this.m_sURL = url + ";deviceside=true";        this.m_sData = data;        this.m_sHttpHeaders = headers;        m_sRequestMode = HttpConnection.POST;        m_bSendResult = false;        m_bSending = true;        m_bStart = true;    }
    
        public void put(String url, String data, String[][] headers) {        //this.m_sURL = url;        this.m_sURL = url + ";interface=wifi";        //this.m_sURL = url + ";deviceside=true";        this.m_sData = data;        this.m_sHttpHeaders = headers;        m_sRequestMode = "PUT";        m_bSendResult = false;        m_bSending = true;        m_bStart = true;    }
    
        /**     * Stop the thread running the connection.     */    public void stop() {        m_bStop = true;    }}
    

    I make a call to that class, as shown below

    ConnectionThread connThread = new ConnectionThread();
    connThread.start();
    
                String encodedString = com.ingboo.client.utils.Util.getBasicAuthString("[email protected]", "rebaca");
    
                String[][] headers = new String[][] {{"Authorization",
                    "Basic " + encodedString}};
                connThread.get(sServerAddr + "api/catalog/" + sCategory.getID(), headers);
    

    When this code is run on the Simulator, it works perfectly fine.

    But, when it is running on the device to the m_sURL variable in the get() method remains null even after

    this.m_sURL = url + ";interface=wifi";
    

    I don't know if ant one has faced something like this.

    Any kind of help will be welcome.

    Thank you
    Etienne

    Sorry guys,

    I was away, on vacation, so not able to check your answers.

    anyway thanks for your help. I solved this problem by keeping a default constructor.

    Thank you

    Etienne

  • Orcle ADF: Background Image of panel group put on the page is not getting displayed in stubborn browser task-flow

    Hello I'm developing a web application using ADF (jdeveloper 11.1.2.4). I have a template that I have panelGroupLayout. I put a background image for the grouplayout. And I created a test.jsf page from this template. When I run this page directly background image is displayed in the browser. I put this page in a stubborn taskflow. My problem is when I execute this page of the stubborn taskflow background image is not displayed.

    Image is displayed for this URL: http://127.0.0.1:7101/EasyRUN-ViewController-context-root/faces/login?_adf.ctrl-state=1px1s1o6o_26

    Image is not posting to this URL: :7101/EasyRUN-ViewController-context-root/faces/admin-flow-definition/homePage?_adf.ctrl-state=1px1s1o6o_29 http://127.0.0.1

    Please help me. Thanks in advance.

    The part of the url of the background image is the problem, probably

    As first of all, try to assign relative to your location of workflow, for example:

    background-image: url("..) ("/ ERUnBPart2.png")

    just to see what happens

  • How do I automatically the reord student's progress

    I have a series of lessons (served from WebApps) and I want to automatically record the connected for example student's progress. If given a lesson for more than 30 sec record as read. Using javascript to detect if they have been more than 30 seconds on the page is easy, but how to store this information, then it can be recalled and displayed to the user?

    What I'm looking for is a way to create and automatically update a connected to the users profile. I could store in a cookie, but a lot of people clear their cookies frequently.

    Can I automatically it keep to their user profile (in a custom in the customer database or in a Web application field) or is there an easy way to store/retrieve in a base of part 3.

    Even easier than that.

    Simple steps for jquery:

    1. Enter the action on the form (where it will save)... IE $('form').attr ('action');

    2. all the elements in the form (or serialize) to generate a data element to record via AJAX.
    3. If you have any game of ladies of validation, you will need to run them not (you may need to remove the link of things).

    4 AJAX post to the URL of the form data to the URL that you got in the first element.

    It * must * silently record every 30 seconds or as long, you set the time.

  • wwv_flow_custom_auth_std.logout does not not in 4.2.3

    Hello

    My recently updated provider to upgrade to version 4.2.3 of APEX. I have been using wwv_flow_custom_auth_std.logout. Now it does not work. I read in the Patch Set note as it is obsolete and that apex_authentication.logout should be used. However, they have not the same functionality. wwv_flow_custom_auth_std.logout allows me to go to another app after disconnection, apex_authentication.logout does not work.

    I'm missing something. At the moment I can't think of a way I can get around this. Someone at - it ideas.

    Regards Garry Lawton

    Hi Garry,

    If you move APEX_APPLICATION. STOP_APEX_ENGINE, it throws an exception and the disconnection of the session can't, then I will not. Instead, can you please try again with the post-logout null URL in the authentication scheme? In my test case, I used & G_LOGOUT_URL, but since the replacement value is empty in 4.2.3 the effective value is zero. BTW, I have filed bug #17555033 for this issue and fixed it already 5.0.

    Kind regards

    Christian

  • How can I check status of SRO?

    I've seen several posts on this URL we receive in our email https://web.palm.com/sro/status.jhtml and he we dumping just to the main page of palm. Someone at - it a way of work to check on our SRO?

    Hello..  Welcome to the forums of Palm.  Try this link, https://support.palm.com/eservice_enu/start.swe?SWECmd=GotoView&SWEView=PALM+Check+SRO+Load , you may need to copy into your browser to access it.  If you go to the support page of Palm trees, in this case, select phones, centro, sprint, support services.  Then scroll down to repair and services when you open at the bottom, you will see the link to the State of repair of palm.  I just tested and it works.

Maybe you are looking for