request to close

I was close the application using the following method.

System.Exit (0);

Is this correct?  I handed my request someone to test it (on the actual handset "BOLD"), I was not present, they mentioned that the phone has begun to respond slowly after the release of the application.  I can't rteplicate it, but it made me think the fact system.exit (0); free all memory used and the application will close completely?

System.exit() closes your app and frees all the memory and threads.

Tags: BlackBerry Developers

Similar Questions

  • Request to close class (without GUI) app via the Menu - help please!

    Hello everyone, as you can see I took the sample application for the execution of a background application and adds a system-wide menu. The question is how can I properly close the application via the menu.

    I just moved from the C++ so mental conversion to Java is running (learn a lot of new ways to cause exceptions in a whole new language)

    Any help would be appreciated, I've seen the question several times with no response or vague answers and no code to back it up.

    Thank you!

    /**
    * GUILessApplication
    *
    * A sample application that appears on the Ribbon
    * but has no user interface.
    */

    package guiLessApp;

    Net.rim.device.api.system import. *;
    Import net.rim.blackberry.api.menuitem.ApplicationMenuItem;
    Import net.rim.blackberry.api.menuitem.ApplicationMenuItemRepository;

    / public final class GUILessApp extends Application
    {
    public static BackGroundApp backGroundApp;
             
    Public Shared Sub main (String [] args)
    {
    PAP GUILessApp = new GUILessApp();
    theApp.enterEventDispatcher ();
    }

    public GUILessApp()
    {
    Creates and starts a new thread BackGroundApp.
              
    backGroundApp = new BackGroundApp();
    backGroundApp.start ();
                       
    MyMenuItem myMenuitem = new MyMenuItem (17);

    ApplicationMenuItemRepository
    .getInstance (.addMenuItem)
    (ApplicationMenuItemRepository
    . MENUITEM_SYSTEM, myMenuitem);
    }
        
    The thread that is running in the background.
    SerializableAttribute public class BackGroundApp extends Thread
    {
    Boolean stopThread = false;
    public synchronized void stop()
    {
    stopThread = true;
    }

    public void run()
    {
    While (! stopThread)
    {
    You must run your treatment here.
    This example prints just one line
    in the output window BlackBerry JDE
    System.out.println ("Application is running");

    Sleep for 5 seconds to avoid the
    application to run out of control
    Try
    {
    Sleep (5000);
    }
    catch (System.Exception e)
    {
    Exception handling would be here.
    }
    }
    }
    }
    Stop the thread to exit.
    protected void onExit()
    {
    backGroundApp.stop ();
    }
    }

    class MyMenuItem extends ApplicationMenuItem {}

    using default constructors here.
    MyMenuItem (order int) {}
    Super (Order);
    }

    We must implement methods
    Run is called when the menuItem is called
    public Object execute (object context) {}

    do something here

    return the context;
    }

    toString must return the string that we want to
    use as a marker of the menuItem
    public String toString() {}
    return "Close App";
    }
    }

    Perfect!, just it sorted and it works like a charm.

  • Installation request to close Safari. But safari is closed and the installation is not complete

    Try to install 5.5 Production Premium. Reached 99% complete and the following shows - close Safaricloudhisto / SafariNoticifCati. But Safari isn't open.

    Check your activity monitor.

  • I can't download Photoshop CC to my PC. It fails to download 43% with request to close Adobe Bridge. However, the bridge is not open. I downloaded LightRoom CC.

    I can't uninstall my CS4 bridge without install Photoshop as well. I don't want lose CS4 until I know I successfully installed CC still Photoshop CC will not download because that there apears to be a conflict with Bridge CS4. Advice would be appreciated.

    Jeff, thanks for the reply. I just received message "Please close Adobe Bridge, wait a few minutes (43) and try again."

    As far as I was aware bridge was not open.

    But I was thinking more on this subject and realized it can work as a background utility. I've disabled the startup routine bridge and downloaded Photoshop CC so problem solved.

  • Help requested - form closes when you click Save...

    Hello

    We are facing a unique problem. In a transaction window, when the number of records is high, and when the user records the transactions, the form window is closed.

    Pointers, what could be causing the form to close save. This happens from time to time and is NOT reproduciable. Also, there is a personilization of the basic form of the form that calls a .pll.

    Thanks in advance.
    -bs

    Hello

    Get the FRD file and see if more details about the error are reported in the newspapers.

    Note: 150168.1 - getting forms Runtime Diagnostics (FRD) in the Oracle 11i Applications
    Note: 438652.1 - R12: forms Runtime Diagnostics (FRD), monitoring and recording of forms in the Oracle Applications

    Also, please check that you have no invalid items in the database.

    Kind regards
    Hussein

  • I received an e-mail I asked to close my Hotmail account. I do not have

    Team Hotmail (* address email is removed from the privacy *)

    12:57 AM

    Dear user,


    We hope you enjoyed our service and we have been a great help for your business. We have received your request to close your account. If this request has been sent by you then there is no need to take additional steps and your account will be closed within 24 hours. But if this request was not sent by you, kindly click on the cancel link below to cancel the request and sign into your account to stop your account to be closed.

    Cancel

    Thank you
    The Hotmail team

    This is the email I received. Although I had not asked to close my account. It makes me always nervous. What is SPAM? I didn't click on the Cancel button.

    Any advice would help on that.

    I

    It's spam.  If you hover over the button "Cancel" you will see that it does not point to MS

  • Close application when the application switch menu item to invoke

    Hello, I made application for blackberry (os 5,6,7), but it has a strange behavior.

    When I press the switch application menu item, my request is close, so I can't get back to my application once I switched to another application.

    I have replace my onClose to be like this

    public boolean onClose()
    {
    This.Close ();
    Returns true;
    UiApplication.getUiApplication () .requestBackground ();
    getApplication () .requestBackground ();
    Returns true;
    }

    but the problem remains.

    Please help me solve this problem

    When you change your application, the close method is not pushed directly so I think that you look elsewhere this

    Try to use the Application Switch with an application example - say the sample HelloWorld application.  I think he won't, which suggests that the problem is in your application.

    There are three places to look:

    (a) the Application disable method is pressed when the request is sent to the background.  Maybe you have coded it and it closes the application

    (b) you have a certain type of background processing controls (isForeground()) and reacts according to what it finds.

    (c) in the method onObscured() to one of theFields/screen on the display at once.  .

    Other than that, I think you're looking for a general bug in your application.  The starting point is to look at the debugging log when you do this - look for anything from your application you consider odd.

  • [JDev12.1.2, ADF] "Query with table Panel": how to auto - close the query Panel when the search ends?

    Hallo,

    I would like the Panel request auto - closes when the search is complete.

    This is to give all the space for the result in the talbe.

    How can I achieve this?

    Thank you

    Federico

    Federico,

    to do this, replace the queryListener one leave this point of a bean method. In this method, you run the processQuery by default and after that set the attribute to disclose the af:query component to false and ppr.

    {} public void processQuery (QueryEvent queryEvent)

    The generated QueryListener replaced by this method

    #{bindings. MyAllCriteriaQuery.processQuery}

    QueryDescriptor qdes = queryEvent.getDescriptor ();

    print or save the view criteria

    System.out.println ("NAME" + qdes.getName ());

    appeal by default query event

    {invokeQueryEventMethodExpression ("#{bindings.", QueryEvent "}") MyAllCriteriaQuery.processQuery};

    Object UIComponent = queryEvent.getSource () (UIComponent);

    Riq RichQuery = object (RichQuery);

    riq.setDisclosed (false);

    AdfFacesContext.getCurrentInstance () .addPartialTarget (riq);

    }

    Private Sub (string expression, QueryEvent queryEvent) invokeQueryEventMethodExpression {}

    FacesContext fctx = FacesContext.getCurrentInstance ();

    ELContext elctx = fctx.getELContext ();

    ExpressionFactory efactory = fctx.getApplication () .getExpressionFactory ();

    MethodExpression = me efactory.createMethodExpression (elctx, expression, Object.class, new class [] {QueryEvent.class});

    me. Invoke (elctx, new Object() {queryEvent});

    }

    and on the page

    model = ' #{bindings. " MyAllCriteriaQuery.queryModel}"queryListener =" #{QueryTestBean.processQuery} ' "

    queryOperationListener = ' #{bindings. " "MyAllCriteriaQuery.processQueryOperation}" resultComponentId =": resId1" / >

    Timo

  • How to restore a previous session after firefox closed and deforested browsing history, is still any chance to get it there?

    Accidentally closed down the pc and firefox did not return with option restore previous session in the first screen even in history-Restory previous session is gray. My settings are own history after closing firefox.
    Y at - it no change to return on my tabs from previous session even browsing history has been cleaned? I'd appreciate your help!

    In general, FireFox will behave in 1 of 3 ways when restarting after a stoppage.

    1 kill Shutdown
    This occurs when the FireFox process ends with a TerminateProcess() appeal or if the process of FireFox crashes. It's a dirty, no cleaning is done. When restarting after this FireFox will show a dialog "well, this is embarrassing' with options to restore the items selected from the previous session.

    2 force Shutdown
    This occurs when another process ask FireFox to shut down cleanly (for example, a reboot of the PC) by a call to ExitProcessEx() and does not ask confirmation of the user. Normally, when this type of shutdown happens, Firefox will just restore all tabs and sessions without asking. However if Firefox is set automatically delete the history on shutdown, it may not. I suspect that this is your case. I would suggest to the FF team remove that history should be ignored in this case, only a stop of the user must delete the history.

    3 judgment of the user.
    That's when said user Firefox close (by selecting exit or by closing all the tabs etc...). Confirmation is requested to close all tabs (if enabled and more than 1 tab is open). When the computer reboots, nothing is restored.

    Unfortunately, if you have enabled clear auto history, there is no way to recover the previous session. I'm sorry.

  • Error 1638 during the 'updating' Skype for Windows 8

    OK, so I go through the installation instructions as when you open Skype it says updated.

    When you run through it then that you request to close Skype. After doing that I get these messages coming up on top of the screen:

    The first screen that appears is the language of the Skype (in English for me) when I then click on "I agree - then" another page just ask questions about bing and MSN being the hompage and search engine, I have unchecked those and continue to hit...

    These two are perfectly fine, but when I get to step 3. It will completely messed...

    "Install Skype has failed; Code 1638

    Another version of this product is already installed. The installation of this version cannot continue. "To configure or remove the existing version of this product, use Add/Remove programs in" (Yes it does not end the sentence or the other lol)

    I asked around a friend had just recently updated to Skype and it suggested uninstalling Skype completely, so I fact... and im still getting the same thing, but this time I literally can not install Skype what so ever...

    Everyone you have any suggestions as to what it could be?

    Try to clear any version currently installed by using this MS Fix It:

    http://support.Microsoft.com/mats/Program_Install_and_Uninstall/en

    If that still does not help, then try this:

    http://community.Skype.com/T5/Windows-desktop-client/impossible-to-install-v6-13-0-104-error-1603/m-...

    Be aware that if you want to install the 6.18.0.106 currently the latest version, then you must use this msi installer link in order to extract the Skype.exe and Login.cab files:

    http://download.Skype.com/MSI/SkypeSetup_6.18.0.106.msi

  • Switch default behavior - PXI2503

    Good afternoon

    I have a few questions about the behavior of my 2503 PXI switch module.   When I close a relay on my switch I hear the click predicted.   Therefore, it leads me to think that something in the breast could wear out over time... I want to mitigate if possible.   Can someone please help with the following questions regarding the attached VI?

    1. If I send a request relay close and this relay is already closed, the switch performs the action anyway?   If so, add the logic to determine the current state of the switch only switch possibly prolong the life of the switch module?

    2 can. How confident I be that this construction is switching properly?   It seems wicked fast.   I have to build in some sort of time to settle?

    Thank you

    Zach

    Hey Zach,.

    If this acts as "before doing a jump."
    depends on whether you use a relay or a channel API.  My
    suggestion would be to use NISwitch connection strings with the
    Disconnect all VI to ensure that all relays are open before
    a fence.  When you use connection strings, you will have the first
    channel is the name of relay and your second channel com0, your
    you want to keep your topology as 1-Wire 48 x 1.  Please see attachment
    photo for a better idea of what I am referring.  Take care!

    aNIta B

    Technical sales engineer

    National Instruments

  • [FATAL] [ConvertSecsElapsedToMilliSecs]

    Hello

    LabWindows cvi 2009 on Windows XP.

    I have a lot of error in the application event log, error is in CVI and tell event log:

    [FATAL] [ConvertSecsElapsedToMilliSecs] [.. \jeff\stdlib\lwutil.c:3518 assertion failure]: convert<>

    error occur with a rate of 100 to 150 times per second.

    request to close and restart it does not stop the logging of errors.

    I have to rebbot the pc so that the fill event log error.

    I think that ICB start shooting error after a long-runnig the application.

    This application is running 27/7.

    Any idea on this issue?

    Note: I checked the code and there is no call to the delay function, only sleep api winows.

    Thank you for your support.

    Thank you

  • Receive a "prepairing standby" while performing Windows updates.

    Windows Update

    Windows install an automatic upgrade on my lap top yesterday (Friday). Said they would restart automatically when the upgrade completed. Screen froze on the message 'Preparing to standby' since then. Turning off and on a few returns to the screen message. No response to any typed or requests to close etc. of mouse.

    Help please...

    Press and hold the power button on the computer for 8 or so seconds to turn it off. Wait a minute or two and turn it back on. If you can, start safe mode. Leave completely load mode without failure. Then, restart in normal mode.

    Come back if you have problems (or even if you have not - to report that.) 'ha')

    Courtesy of Stanley Zhang

    UTC/GMT is 01:21 Sunday, September 18, 2011

  • Redirect 302 get only when connected via BES loop

    Hello

    I have a problem when I am connected via BES, I get a server redirection loop (it returns a 302 with the originial URL response in the "location" header field). When it is connected via the BIS-B, WiFi or carrier, the server returns redirects as expected and the app works. However I require a BES connection and him give a priority when they are available.

    Note that I checked the connection returned by Networking.java string is correct (we add ";) (deviceside = false' when BES is to be using).

    Here's the network code I use:

    package [redacted]
    
    /*
     * Networking.java
     *
     * This code is based on the connection code developed by Mike Nelson of AccelGolf.
     * http://blog.accelgolf.com/2009/05/22/blackberry-cross-carrier-and-cross-network-http-connection
     *
     */
    
    import net.rim.device.api.system.CoverageInfo;
    import net.rim.device.api.system.DeviceInfo;
    import net.rim.device.api.system.WLANInfo;
    
    public class Networking
    {
        Networking()
        {
        }
    
    // Whether or not to the simulator should use MDS to connect.
    // By default this should be false, however if you are testing
    // in an environment where MDS will be the expected connection method,
    // set this to true to have the simulator attempt to use MDS.  This variable
    // has no effect on what happens on a real device.
        private static final boolean isMDS = false;
    
        // the timeout
        public static final int TIMEOUT = 30000;
    
        /**
         * Determines what connection type to use and returns the necessary string
         * to use it.
         *
         * @return A string with the connection info
         */
        public static String getConnectionString()
        {
    
            String connectionString = null;
    
            // Simulator behavior is controlled by the USE_MDS_IN_SIMULATOR variable.
            if (DeviceInfo.isSimulator())
            {
                if (isMDS)
                {
                    connectionString = ";ConnectionTimeout=" + TIMEOUT + ";deviceside=false";
                }
                else
                {
                    connectionString = ";ConnectionTimeout=" + TIMEOUT + ";deviceside=true";
                }
            }
    
            // Check for an MDS connection instead (BlackBerry Enterprise Server)
            else if ((CoverageInfo.getCoverageStatus() & CoverageInfo.COVERAGE_MDS) == CoverageInfo.COVERAGE_MDS)
            {
                System.out.println("MDS coverage found");
                connectionString = ";ConnectionTimeout=" + TIMEOUT + ";deviceside=false";
            }
    
            else if ((CoverageInfo.getCoverageStatus() & CoverageInfo.COVERAGE_BIS_B) == CoverageInfo.COVERAGE_BIS_B)
            {
                // otherwise, use the Uid to construct a valid carrier BIS-B request
                System.out.println("Using BIS");
                connectionString = ";ConnectionTimeout=" + TIMEOUT + ";deviceside=false;ConnectionType=[redacted]";
            }
    
            // Wifi is the preferred transmission method
            else if (WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED)
            {
                System.out.println("Using WIFI");
                connectionString = ";interface=wifi";
            }
    
            // Is the carrier network the only way to connect?
            else if ((CoverageInfo.getCoverageStatus() & CoverageInfo.COVERAGE_DIRECT) == CoverageInfo.COVERAGE_DIRECT)
            {
    
                // Has carrier coverage, but not BIBS.  So use the carrier's TCP network
                System.out.println("Device is connected Direct");
                connectionString = ";ConnectionTimeout=" + TIMEOUT + ";deviceside=true";
    
            }
    
            // If there is no connection available abort to avoid bugging the user unnecssarily.
            else if (CoverageInfo.getCoverageStatus() == CoverageInfo.COVERAGE_NONE)
            {
                System.out.println("There is no available connection.");
            }
    
            // In theory, all bases are covered so this shouldn't be reachable.
            else
            {
                System.out.println("no other options found, assuming device.");
                connectionString = ";ConnectionTimeout=" + TIMEOUT + ";deviceside=true";
            }
    
            return connectionString;
        }
    }
    

    Here is sendRequest managed the connection method and the redirection:

    public HttpResponse sendRequest(HttpRequest request)
        {
            String url = request.getUrl();
            if (url == null)
            {
                HttpResponse result = new HttpResponse();
                result.responseCode = 404;
                result.responseMessage = "Not Found";
                return result;
            }
    
            ConnectionWrapper cw = connectionWrapperForRequest(request);
            if (cw == null)
            {
                return null;
            }
    
            boolean compressionEnabled = !request.disableCompression() && COMPRESSION_ENABLED;
    
            HttpResponse result = new HttpResponse();
            try
            {
                String finalURL = url.trim() + Networking.getConnectionString();
                cw.connection = (HttpConnection) Connector.open(finalURL, Connector.READ_WRITE, false);
                System.out.println("Connection string: " + Networking.getConnectionString());
                System.out.println("Full connec.  URL: " + finalURL);
    
                if (cw.connection == null)
                {
                    result.errorMessage = "Could not open a network connection.";
                    result.completedWithError = true;
                    return result;
                }
    
                cw.connection.setRequestMethod(request.getHttpMethod());
    
                if (compressionEnabled)
                {
                    cw.connection.setRequestProperty("Accept-Encoding", "gzip");
                }
    
                cw.connection.setRequestProperty("User-Agent",
                        "" + DeviceInfo.getManufacturerName() + "/" + DeviceInfo.getDeviceName() + "/" + Config.getVersionNumber());
                if (request.username() != null)
                {
                    cw.connection.setRequestProperty("Authorization", "Basic " + Utils.base64Encode(request.username() + ":" + request.password()));
                }
    
                // set this header so BES servers will not change the content of the headers
                cw.connection.setRequestProperty("x-rim-transcode-content", "none");
    
                //add cookies
                if (HttpCookieJar.getInstance().cookieCount() > 0)
                {
                    cw.connection.setRequestProperty("Cookie", HttpCookieJar.getInstance().getCookiesAsString());
                }
    
                //pull request headers from HttpRequest
    
                Hashtable headers = request.getHeaders();
                for (Enumeration e = headers.keys(); e.hasMoreElements();)
                {
                    String key = (String) e.nextElement();
                    cw.connection.setRequestProperty(key, (String) headers.get(key));
                }
    
                byte[] upstreamBytes = request.requestBytes();
                if (upstreamBytes != null && upstreamBytes.length > 0)
                {
                    Logger.getLogger().log(new String(upstreamBytes));
                    cw.connection.setRequestProperty(HttpProtocolConstants.HEADER_CONTENT_TYPE,
                            HttpProtocolConstants.CONTENT_TYPE_APPLICATION_X_WWW_FORM_URLENCODED);
                    cw.connection.setRequestProperty(HttpProtocolConstants.HEADER_CONTENT_LENGTH, String.valueOf(upstreamBytes.length));
                    cw.outputStream = cw.connection.openOutputStream();
                    cw.outputStream.write(upstreamBytes);
                }
    
                Logger.getLogger().log("Get response");
    
                result.responseCode = cw.connection.getResponseCode();
                result.responseMessage = cw.connection.getResponseMessage();
    
                Logger.getLogger().log("Status Code: " + result.responseCode);
                Logger.getLogger().log("Status Message: " + result.responseMessage);
    
                //suck out the cookies here
                int fieldNo = 0;
                String headerField;
                while ((headerField = cw.connection.getHeaderField(fieldNo)) != null)
                {
                    if (cw.connection.getHeaderFieldKey(fieldNo).equals("Set-Cookie"))
                    {
                        HttpCookieJar.getInstance().setCookie(headerField);
                    }
                    fieldNo++;
                }
    
                System.out.println("get redirect");
    
                //get redirect location
                String location;
                if ((location = cw.connection.getHeaderField("Location")) != null)
                {
                    if (location == url.trim())
                    {
                        Logger.getLogger().log("Redirect loop");
                    }
                    Logger.getLogger().log("Redirect: " + location);
                    result.redirectLocation = location.trim();
                }
                else
                    result.redirectLocation = null;
    
                byte[] buffer = new byte[HTTP_BUFFER_SIZE];
                int count;
    
                System.out.println("compression");
    
                cw.inputStream = cw.connection.openInputStream();
                if (compressionEnabled)
                {
                    String encoding = cw.connection.getEncoding();
                    if ("gzip".equalsIgnoreCase(encoding))
                    {
                        cw.inputStream = new GZIPInputStream(cw.inputStream);
                    }
                }
    
                cw.inputStream = new DataInputStream(cw.inputStream);
    
                System.out.println("output stream");
    
                ByteArrayOutputStream out = new ByteArrayOutputStream();
                try
                {
                    while ((count = cw.inputStream.read(buffer)) >= 0)
                    {
                        out.write(buffer, 0, count);
                    }
                    result.bytes = out.toByteArray();
                }
                finally
                {
                    out.close();
                }
                cw.close();
                Logger.getLogger().log("Response complete");
            }
            catch (IOException e)
            {
                result.errorMessage = e.getMessage();
                result.completedWithError = true;
                Logger.getLogger().log("ERROR!:" + e.getMessage());
            }
            finally
            {
                removeConnectionWrapper(cw);
            }
            return result;
        }
    

    Here's the whole HttpService.java for the context of the SendRequest method above:

    //#preprocess
    
    //package
    //imports
    
    public class HttpService
    {
        private static HttpService _instance;
    
        private static final boolean COMPRESSION_ENABLED = false;
        private static final int HTTP_BUFFER_SIZE = 1024;
    
        public static synchronized HttpService instance()
        {
            if (_instance == null)
            {
                _instance = new HttpService();
            }
            return _instance;
        }
    
        private WorkQueue _requestQueue = new WorkQueue(1024, 4);
        private Hashtable _connections = new Hashtable(10);
    
        private HttpService()
        {
            // singleton
        }
    
        private ConnectionWrapper connectionWrapperForRequest(HttpRequest request)
        {
            ConnectionWrapper cw = null;
            synchronized (request)
            {
                if (!request.cancelled())
                {
                    cw = new ConnectionWrapper(request);
                    synchronized (_connections)
                    {
                        _connections.put(request, cw);
                    }
                }
            }
            return cw;
        }
    
        private void removeConnectionWrapper(ConnectionWrapper cw)
        {
            synchronized (_connections)
            {
                _connections.remove(cw.request);
            }
            cw.close();
        }
    
        public void cancelRequest(HttpRequest request)
        {
            ConnectionWrapper cw = null;
            synchronized (request)
            {
                synchronized (_connections)
                {
                    cw = (ConnectionWrapper) _connections.remove(request);
                }
                request.setCancelled();
            }
            if (cw != null)
            {
                cw.close();
            }
        }
    
        public void executeRequest(final HttpRequest request)
        {
            _requestQueue.addWorkItem(new Runnable()
            {
                public void run()
                {
                    HttpResponse response = sendRequest(request);
                    if (!request.cancelled() && response != null)
                    {
                        request.completeRequest(response);
                    }
                };
            });
        }
    
        public HttpResponse sendRequest(HttpRequest request)
        {
            String url = request.getUrl();
            if (url == null)
            {
                HttpResponse result = new HttpResponse();
                result.responseCode = 404;
                result.responseMessage = "Not Found";
                return result;
            }
    
            ConnectionWrapper cw = connectionWrapperForRequest(request);
            if (cw == null)
            {
                return null;
            }
    
            boolean compressionEnabled = !request.disableCompression() && COMPRESSION_ENABLED;
    
            HttpResponse result = new HttpResponse();
            try
            {
                String finalURL = url.trim() + Networking.getConnectionString();
                cw.connection = (HttpConnection) Connector.open(finalURL, Connector.READ_WRITE, false);
                System.out.println("Connection string: " + Networking.getConnectionString());
                System.out.println("Full connec.  URL: " + finalURL);
    
                if (cw.connection == null)
                {
                    result.errorMessage = "Could not open a network connection.";
                    result.completedWithError = true;
                    return result;
                }
    
                cw.connection.setRequestMethod(request.getHttpMethod());
    
                if (compressionEnabled)
                {
                    cw.connection.setRequestProperty("Accept-Encoding", "gzip");
                }
    
                cw.connection.setRequestProperty("User-Agent",
                        "" + DeviceInfo.getManufacturerName() + "/" + DeviceInfo.getDeviceName() + "/" + Config.getVersionNumber());
                if (request.username() != null)
                {
                    cw.connection.setRequestProperty("Authorization", "Basic " + Utils.base64Encode(request.username() + ":" + request.password()));
                }
    
                // set this header so BES servers will not change the content of the headers
                cw.connection.setRequestProperty("x-rim-transcode-content", "none");
    
                //add cookies
                if (HttpCookieJar.getInstance().cookieCount() > 0)
                {
                    cw.connection.setRequestProperty("Cookie", HttpCookieJar.getInstance().getCookiesAsString());
                }
    
                //pull request headers from HttpRequest
    
                Hashtable headers = request.getHeaders();
                for (Enumeration e = headers.keys(); e.hasMoreElements();)
                {
                    String key = (String) e.nextElement();
                    cw.connection.setRequestProperty(key, (String) headers.get(key));
                }
    
                byte[] upstreamBytes = request.requestBytes();
                if (upstreamBytes != null && upstreamBytes.length > 0)
                {
                    Logger.getLogger().log(new String(upstreamBytes));
                    cw.connection.setRequestProperty(HttpProtocolConstants.HEADER_CONTENT_TYPE,
                            HttpProtocolConstants.CONTENT_TYPE_APPLICATION_X_WWW_FORM_URLENCODED);
                    cw.connection.setRequestProperty(HttpProtocolConstants.HEADER_CONTENT_LENGTH, String.valueOf(upstreamBytes.length));
                    cw.outputStream = cw.connection.openOutputStream();
                    cw.outputStream.write(upstreamBytes);
                }
    
                Logger.getLogger().log("Get response");
    
                result.responseCode = cw.connection.getResponseCode();
                result.responseMessage = cw.connection.getResponseMessage();
    
                Logger.getLogger().log("Status Code: " + result.responseCode);
                Logger.getLogger().log("Status Message: " + result.responseMessage);
    
                //suck out the cookies here
                int fieldNo = 0;
                String headerField;
                while ((headerField = cw.connection.getHeaderField(fieldNo)) != null)
                {
                    if (cw.connection.getHeaderFieldKey(fieldNo).equals("Set-Cookie"))
                    {
                        HttpCookieJar.getInstance().setCookie(headerField);
                    }
                    fieldNo++;
                }
    
                System.out.println("get redirect");
    
                //get redirect location
                String location;
                if ((location = cw.connection.getHeaderField("Location")) != null)
                {
                    if (location == url.trim())
                    {
                        Logger.getLogger().log("Redirect loop");
                    }
                    Logger.getLogger().log("Redirect: " + location);
                    result.redirectLocation = location.trim();
                }
    
                byte[] buffer = new byte[HTTP_BUFFER_SIZE];
                int count;
    
                System.out.println("compression");
    
                cw.inputStream = cw.connection.openInputStream();
                if (compressionEnabled)
                {
                    String encoding = cw.connection.getEncoding();
                    if ("gzip".equalsIgnoreCase(encoding))
                    {
                        cw.inputStream = new GZIPInputStream(cw.inputStream);
                    }
                }
    
                cw.inputStream = new DataInputStream(cw.inputStream);
    
                System.out.println("output stream");
    
                ByteArrayOutputStream out = new ByteArrayOutputStream();
                try
                {
                    while ((count = cw.inputStream.read(buffer)) >= 0)
                    {
                        out.write(buffer, 0, count);
                    }
                    result.bytes = out.toByteArray();
                }
                finally
                {
                    out.close();
                }
                cw.close();
                Logger.getLogger().log("Response complete");
            }
            catch (IOException e)
            {
                result.errorMessage = e.getMessage();
                result.completedWithError = true;
                Logger.getLogger().log("ERROR!:" + e.getMessage());
            }
            finally
            {
                removeConnectionWrapper(cw);
            }
            return result;
        }
    
        private static class ConnectionWrapper
        {
            final HttpRequest request;
            InputStream inputStream = null;
            OutputStream outputStream = null;
            HttpConnection connection = null;
    
            public ConnectionWrapper(HttpRequest request)
            {
                this.request = request;
            }
    
            public void close()
            {
                try
                {
                    if (outputStream != null)
                        outputStream.close();
                }
                catch (Exception e)
                {
                }
                try
                {
                    if (inputStream != null)
                        inputStream.close();
                }
                catch (Exception e)
                {
                }
                try
                {
                    if (connection != null)
                        connection.close();
                }
                catch (Exception e)
                {
                }
            }
        }
    }
    

    Sorry for the amount of code.

    I had our BES admin visit problematic page via a browser on the Server BES itself.

    Running, the Web server was an update of AJAX-style page that informs the user that they had no access to that particular content. Programmatically, see us all is "the page has been moved here" - but in a browser, it's a different story.

    Thanks again Peter for your insight!

  • Essential Analytics for account credentials missing App

    Hello

    I asked a while there is an essential analytical account through DPS2015 dashboard.

    A few days later I received an email from support (in German!) telling me my request was close, but no company/name username/password was in it.

    The button for the same application is now disabled in DPS2015 dashboard.

    Could you please tell me how to access my analytical credentials?

    analytics.png

    Florent,
    Check your personal messages in this forum for more information on the access that I have given.

    Sincerely,
    Matthew

Maybe you are looking for