Get Cookies from a HTTP connection problem?

Hi all!

I'm trying to get the Http cookie header. This is my code to display the header

for (int j = 0; j)< 20;="" j++)="">
Key of type string = httpConn.getHeaderFieldKey (j);
String field = httpConn.getHeaderField (j);
If (key == null & j > 0) {}
break;
}
Add (new RichTextField (key + ":" + field));
}

But I do not see the 'Set-Cookie' value in my put

and here is my out put

connection: close
x LENGTH: 63
Server: WEBrick/1.3.1 (Ruby/1.8.7/2009-12-04)
Date: Friday, April 23, 2010 03:26:30 GMT
content-length: 7985
x-rim-etag: "FF10B6C22FA4460C654348D3E2565567D074FEE".
cache-control: private, max - age = 0, must-revalidate
ETag: "da5b76f5d045b108fe65b0dfb2a123d8".
Content-location: http//192.168.11.14:15002/products
content-type: text/html; charset = utf-8

Thanks in advance!

Server fixed the Cookie Set in the HTTP headers. otherwise you will never see this value in the response headers.

Kind regards

Sudhakar choup

Tags: BlackBerry Developers

Similar Questions

  • HTTP connection problem. What is going on?

    I am trying to write a simple program to test the validity of the URL via a http connection.

    For the good URL, the program works very well.

    Bad URL however found two ways:

    1: no answer at all (program runs as if nothing happened, waiting for user input.) The text in the EditField is the same incorrect url intentionally being tested)

    2: IllegalArgumentException in RIMConnector.open (int, int, String, boolean, FirewallContext) line: 76.

    What is going on?

    Here is the code:

    import java.io.IOException;
    import javax.microedition.io.Connector;
    import javax.microedition.io.HttpConnection;
    import net.rim.device.api.ui.*;
    import net.rim.device.api.ui.component.*;
    import net.rim.device.api.ui.container.*;
    import net.rim.device.api.ui.UiApplication;
    
    final class UrlCheck extends UiApplication {
        private EditField urlField;
        public static void main(String[] args) {
            UrlCheck theApp = new UrlCheck();
            theApp.enterEventDispatcher();
        }
    
        public UrlCheck() {
            MainScreen theScreen = new MainScreen();
            LabelField title = new LabelField("URL Check");
            theScreen.setTitle(title);
    
            urlField = new EditField("URL: ", "", Integer.MAX_VALUE, BasicEditField.FILTER_DEFAULT);
            theScreen.add(urlField);
    
            FieldChangeListener listenerCancel = new FieldChangeListener() {
                public void fieldChanged(Field field, int context) {
                    String URL = urlField.getText();
                    HttpConnection conn = null;
                    int response = 0;
                    try {
                        conn = (HttpConnection)Connector.open(URL);
                        conn.setRequestMethod(HttpConnection.GET);
                        response = conn.getResponseCode();
                        if (response == 200){
                            Dialog.inform("URL OK");
                            return;
                        }
                        if(response == 401){
                            Dialog.inform("URL Requires Authorization");
                        }
                    } catch (IOException e) {
                        e.printStackTrace();
                        Dialog.inform("Bad URL");
                    }
                }
            };
            ButtonField checkUrl = new ButtonField("Check");
            checkUrl.setChangeListener(listenerCancel);
            theScreen.add(checkUrl);
            pushScreen(theScreen);
        }
    }
    

    Okay, that was stupid.

    I caught the IllegalArgumentException as well and it fixed the problem.

  • Http connection problem... Urgent

    I m new to BB development

    I tried a code to connect to the local server to retrieve the news by sending that some Arguments say n username password, using the POST method. But when I m tryg to get the response from the server I m rather retrieve the source CODE, instead of success or failure in our case.

    I m unable to understand, where I m wrong. I want that you guys help, since I have done any hard work in desinging of the user interface and now I m stuck in connection HTTP, without which I can't move any further.

    When I try 2 recovery of response I String m to fill the Source Code of an HTML page... I need 2 get just a String (success r failure) as mentioned above.

    In the hope of a quick answer correct n

    Thanks in advance!

    String answer ="";

    Well, talk about what was your error in the thread and mark it as resolved.

    Thank you!

  • set and get cookies from the server.

    Hi all

    I'm developing an application where in my server games some cookies and I need to bring and do some operations on them.

    is this possible please could tell me a few materail example or reading?

    Thank you and best regards.

    You're talking about their use on a WebView, then this...

    http://developer.BlackBerry.com/native/documentation/Cascades/UI/WebView/cookies.html

    Otherwise, you will have to the handshake with the server to get the data somehow according to where and how the cookie is stored and process.

  • Http connection problem

    Hello

    I have some problems with httpconnection. I have to make 2 connections, first to retrieve data from a web service. The second is used to play audio data stream.

    Here's what I do:

    First of all, I call a web service using a httpconnection (this works well):

    HttpConnection httpConn = (HttpConnection)Connector.open(sLocator, Connector.READ);InputStream is = oHttpConn.openInputStream();byte[] loadedContent = IOUtilities.streamToBytes(is);ByteArrayInputStream bytestream = new ByteArrayInputStream(loadedContent);
    
    // Some work with the bytestream
    
    is.close();httpConn.close();
    

    Later in the code, I do in a separate thread:

    HttpConnection httpConn =(HttpConnection)Connector.open(sLocator);
    InputStream is = httpConn.openInputStream();
    
    player = Manager.createPlayer(is, "audio/mpeg");                                                           player.realize();
    player.prefetch();
    player.start();
    

    My problem is that this second httpconnection only works if I'm not the first one before (the web service call) (actually only when I comment the web service call the player does his job).

    Am I missing something?

    I'm working on a simulator at the moment (with SDM launched), I didn't add the parameter "deviceside" to my URL.

    However if I join '; deviceside = true' for the second connection, it works sometimes, but only if I use it in the first connection.

    Can you help me?

    Thank you

    Franck

    Hello

    Are you running the connection of two in the same thread? If this isn't the case, I make sure that the first thread of the connection was closed successfully without exception.

    Also, you must add the transport protocols to your all URLS.

    I have the same situation when I make two API calls where the 2nd call API is based on the outcome of the first and I do it in the same thread of connection and it works fine.

  • WiFi from HP: Internet connection problem

    I started a hotspot through HP Wireless Hotspot (Version 1.0.19.1) software in my laptop HP Probook s 4540 to share my internet connection with my portable Sony Xperia L high speed. I can connect to the network, but I share my internet connection RCA. When I tried my internet connection in my laptop, it works fine. But through the mobile phone is not connect to internet via wifi hotspot. Here are the screenshots of the n6cessoires settings I configured. I have no idea on "Change adapter settings" in Windows.

    Please help me.

    (1) I have already connected to wired broadband (Hutch).

    (2) I've chosen my broadband connection to share.

    (3) I started the hotspot. But it says that my broadband connection is disconnected. But I can connect to the internet using my laptop.

    (4) network and sharing both Center screenshot:

    (5) adapter screenshot of parameters over time:

    Thank you!

    HI Shehan_Morawaka,

    Welcome to the HP forum!

    Your Probook is a business unit.

    I'm sorry, but to get your question more exposure, I suggest posting in the trade forums, since it is a commercial product. You can do it at Commercial/laptop - HP ProBook, EliteBook, Compaq, slate/Tablet PC, Armada, LTE.

    I hope this helps.

  • HTTP connectivity from a device problem

    Hello

    I'm working on an application that works with our web server via HTTP and HTTPS.

    As it is a consumer application, we want to operate without MDS, out-of-the-box when a smartphone is purchased at retail with a web access data plan.

    I assumed that this means using direct TCP when a Wi - Fi connection is not available.

    The following code snippet prepares the URL according to the configuration, and opens the connection:

    String fullUrl = (isSecure? ("https://": "http://") + appConfig.getServerHost () + "/" + url + (bbAppState.isWiFiOnly ()? « ; (interface = wifi': "") + (bbAppState.isDeviceSide ()? « ; (deviceside = true': ' ");

    c = (HttpConnection) Connector.open (fullUrl, Connector.READ_WRITE, true);

    Details of equipment and network:

    Feature: 8320
    OS 4.5.0.81
    T-Mobile US network
    Have a data plan (unlimited web and 400 messages)
    Connection preference: Wi - Fi preferred
    No apn is not specified
    Browser and third-party applications downloaded from the App World can access internet via Wi - Fi and EDGE/GPRS with the above parameters

    Tried:

    1. Free Wi - Fi and EDGE: deviceside = true - get "Tunnel failed '.
    2. Free Wi - Fi and EDGE: no deviceside, only the url - get "Tunnel failed '.
    3. No deviceside, only = wifi interface - works with a Wi-Fi connection, reports "The Tunnel failed" when out of range of a Wi - Fi connection.
    4. I tried parameter APN to internet2.voicestream.com just to test - got the same error 'Tunnel failed '.  I would not use it as the browser and other applications need and work when the APN is empty.

    My question is if I'm something wrong or missing something.  My hypothesis is that third-party apps and BlackBerry Internet Service browser.  Is there a way to know?  Is there a way to disable it (for example to make sure that the browser and other applications use it)? Our company has recently become a partner of Alliance of BlackBerry, so we can apply to BlackBerry Internet Service, but I do not understand if this is necessary for consumer applications, or if the consumer applications should rely on direct TCP.

    Any help will be greatly appreciated.

    Thank you

    Sergey

    Use '; deviceside = true ', you must also specify the details of the AFN, the options of the device or in the string you provide with "; deviceside = true '.  If you do not, you will get "Tunnel failed '.

    I would like to confirm the settings for T-Mobile APN - the value that you used does not match what I found in a google search.

    Browser and other applications will use WAP 2.0 or BIS - B, requiring no configuration.  You can use WAP 2.0 - standard article for more details:

    What - in different ways to establish an HTTP connection or socket
    DB-00396
    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800563/What_Is...

    Recommendation - use BIS-B (service Alliance Partner) If you can, work in cases more than anything else.

  • Whenever I connect to my hotmail account using Windows Live, I get a warning, "there is a problem with this Web site's secure certificate. »

    original title: security

    Whenever I connect to my hotmail account using Windows Live, I get a warning, "there is a problem with this Web site's secure certificate. »

    Security certificate problems may indicate an attempt to fool you or intercept any data you send to the server.
      We recommend that you close this webpage and do not make this Web site.
      Click here to close this webpage.
      Continue to this website (not recommended).
     
    More information
    • If you arrived at this page by clicking a link, check the Internet address in the address bar to be sure this is the address you've been waiting for.
    • When you go to a Web site with an address as https://example.com, try to add the "www" in the address, https://www.example.com.
    • If you choose to ignore this error and continue, don't get personal information on the Web site.

      For more information, see "Certificate errors" in Internet Explorer Help.

    Some things you can try:

    You can have old certificates root on your computer.  Try to update your root certificates from the link provided in the paragraph "Root Update Package (intended for Windows XP only)" in the following article:

    "Members of the certificate program root Windows.
      <>http://support.Microsoft.com/kb/931125 >

    Depending on which version of Internet Explorer and Service Pack level of your machine, one of the following articles might help you:

    ' "There is a problem with the security certificate from the website" when you try to visit a secure in Internet Explorer Web site.
      <>0 http://support.Microsoft.com/kb/93185>

    "Certificate error Web page is displayed when you try to visit an SSL Web using Internet Explorer 7:"There is a problem with the security certificate from the Web site""
      <>http://support.Microsoft.com/kb/950067 >

    It is also possible that indeed, you will be redirected to a false site.  Check your file C:\Windows\System32\drivers\etc\hosts ensure that there is not a bogus entry for your hotmail login.  Generally, the only line that is required in this file does not begin with a character ' # ' is ' 127.0.0.1 localhost '.

    HTH,
    JW

  • When you try to connect from my vista desktop to my laptop windows 7 through the DRC I get the error "unable to connect to the gateway terminal server."

    problems of the DRC of vista for windows machine 7

    I have 2 computers running on a homegroup. When you try to connect from my vista desktop to my laptop windows 7 through the DRC, I get the error "unable to connect to the gateway terminal server."   Can I remotely from the laptop to the desktop vista end. I the DRC 7 is installed on the desktop and tried to connect using the IP as well as the name of the machine but still no joy.

    can someone shed light on this please?

    Hello

    Temporarily disable the security software on both computers and check if it makes a difference.

    http://Windows.Microsoft.com/en-us/Windows-Vista/disable-antivirus-software

    Note: Antivirus software can help protect your computer against viruses and other security threats.  In most cases, you should not disable your antivirus software. If you need to disable temporarily to install other software, you must reactivate as soon as you are finished. If you are connected to the Internet or a network, while your antivirus software is disabled, your computer is vulnerable to attacks.

  • How to get the gif file hosted by using the Http connection?

    Hello

    I have an application that downloads animation gif from a server by using the http connection. Here is the code I use to download the image.

    try {
    
                httpConnection = (HttpConnection) Connector.open(url, Connector.READ_WRITE);            httpConnection.setRequestMethod(HttpConnection.GET);
    
                if (httpConnection.getResponseCode() == HttpConnection.HTTP_OK) {                DataInputStream dS = httpConnection.openDataInputStream();
    
                    byte[] data = new byte[dS.available()];                dS.read(data);
    
                    gifImage = (GIFEncodedImage) EncodedImage.createEncodedImage(data, 0,data.length);
    
                } else {                throw new Exception("ResponseCode:" + httpConnection.getResponseCode());            }        } catch (Exception e) {                        gifImage = null;            e.printStackTrace();        }
    

    the problem with this code is, when the gif file is 1175 bytes above, it does not load the gif.

    example:-If the gif on the server is 1500 bytes, this code retrieves only 1175 bytes.

    I think that the rest of the bytes are sent in a different package. But how to get them.

    can someone please provide a code for buffering the inputstream?

    any help is appreciated.

    Dieye

    Hmm, nobody seems to know how to do, it seems. Here's how I did it.

                httpConnection = (HttpConnection) Connector.open(url, Connector.READ_WRITE);
                httpConnection.setRequestMethod(HttpConnection.GET);
    
                int responseCode = httpConnection.getResponseCode();
                if (responseCode == HttpConnection.HTTP_OK) {
                    inputStream = httpConnection.openInputStream();
                    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    
                    byte[] buffer = new byte[256];
                    int len = 0, imageSize = 0;
    
                    while (-1 != (len = inputStream.read(buffer))) {
                        byteArrayOutputStream.write(buffer);
                        imageSize += len;
                    }
    
                    byteArrayOutputStream.flush();
                    byte[] imageData = byteArrayOutputStream.toByteArray();
                    byteArrayOutputStream.close();
    
                    gifImage = (GIFEncodedImage) EncodedImage.createEncodedImage(imageData, 0, imageSize);
    
  • Why do I get "Connection problem" on my laptop, when I try to access my e-mail account Yahoo with the new version of Firefox?

    Since I updated firefox to 29.0.1 on my desktop, I can't access my account at Yahoo.com from my ASUS laptop. "Connection problem" appears when he tries to retrieve new messages. I received mail on the ASUS 12/03/13, but from now on I get this message and no new mail arrives at the ASUS.

    Some problems occurs when your Internet security program was set to trust to the
    a previous version of Firefox, but no longer recognizes your updated as version
    level of confidence. Now how do I solve the problem: to allow Firefox to connect to the Internet
    Once again:

    • Make sure your Internet security software is up-to-date (for example, you are using the latest version)
    • Delete Firefox to list your program of trusted or recognized programs, then add it again. For detailed instructions, see Configure the firewall so that Firefox can access the Internet.
  • I discovered two cookies from Yahoo, named B and AO. They cannot be removed by normal means. How can I get rid of them?

    I use Firefox 10.0.2 on an iMac with OS X 10.6.8. I discovered this problem when deleting cookies from Yahoo in response to an announcement on the Yahoo site that was tapping into my position, even if I was not connected to Yahoo. All the other cookies for Yahoo, I was able to remove via Firefox preferences except for the above two. I would appreciate any information available as to what these cookies are for and how Yahoo could prevent me to delete.

    Of course, the cookies.sqlite file has been altered as trying to delete all cookies from the Tools menu doesn't lead to a possible script error asking me if I wanted to leave the script running or not. I then deleted cookies.sqlite with the only other files cookie, that I could see, cookies.sqlite - shm and cookies.sqlite - wa.

    After you exit and restart Firefox, Yahoo's two persistent cookies were gone. Thank you.

  • I can access Windows Live from my Macbook, but when I try to go to my Windows Live Hotmail Inbox, I get a "Sorry, there is a problem with Hotmail right now," error message.

    I can access Windows Live from my macbook, but when I try to go in my hotmail Inbox I get a sorry, there is a problem with hotmail right now.  I CAN access my hotmail to my IMac account. What is happening that I can't access my account hotmail to my Macbook?

    original title: Sorry there is a problem with hotmail right now!

    Hello

    1. what browser you use to access Hotmail account?

    2. what operating system is installed on the computer?

    The question you have posted is related to Hotmail and would be better suited to the Windows Live community. Please visit the link below to find a community that will provide the support you want.

    http://www.windowslivehelp.com/product.aspx?ProductID=1

  • I get an error pop-up that says that Web page contains content that is not delivered using a secure HTTPS connection. What does that mean?

    I get an error pop-up that says that Web page contains content that is not delivered using a secure HTTPS connection, but likely to compromise the security of the entire webpage, whatever that means

    In "BOLD" on the very top of the ther security warning she also ask you want to view only the webpage content that was delivered safely?

    original title: HTTPS connection issues

    You are using Internet Explorer 8?

    This article describes the causes of this message and how you can remove:

    http://blogs.msdn.com/b/ieinternals/archive/2009/06/22/HTTPS-mixed-content-in-IE8.aspx

    Information on the changes in Internet Explorer 9 is available here:

    http://blogs.msdn.com/b/ie/archive/2011/06/23/Internet-Explorer-9-security-part-4-protecting-consumers-from-malicious-mixed-content.aspx

  • Problem with getting messages from Inbox in Blackberry 8800

    I used Blackberry JDE 4.0 for the development of my application. I ran my code on Blackberry 7290 and it works very well.

    The code snippet, I used to get messages from the Inbox is

    Store is Session.getDefaultInstance () .getStore ();.

    Folder inboxFolder = store.getFolder ("Inbox");

    Message [] inboxmessages = inboxFolder.getMessages ();

    System.out.println ("Inbox GSM length:" + inboxmessages.length);

    When I ran the same code on Blackberry JDE 4.2.1; can't find message from the Inbox on the blackberry 8800 Simulator. The code runs successfully. If there are messages in the Inbox it gives inboxmessages.length = 0, but does not raise an error.

    The problem comes when inboxFolder.getMessages () is

    Someone can suggest what might be the problem, is the structure of folders 8800 different from 7290 or is there any other problem. Help, please.

    Please refer to the samples on this page:

    What's – the application is not notified when new messages arrive
    Article number: DB-00153

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800698/What_Is...

    Note that messages that are pre-populated in the BlackBerry Simulator are not real email messages, then you will not be able to access.

Maybe you are looking for