Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6072929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:12:51+00:00 2026-05-23T10:12:51+00:00

I am making an application to perform an POST action in it . Which

  • 0

I am making an application to perform an POST action in it . Which is shown below

//private boolean x = false;
url = "http://domain.com/login";
InputStream inputStream = null;
ConnectionFactory connFact = new ConnectionFactory();
ConnectionDescriptor connDesc;
connDesc = connFact.getConnection(url);
if (connDesc != null)
{
    HttpConnection httpConn;
    httpConn = (HttpConnection)connDesc.getConnection();
    httpConn.setRequestMethod(HttpConnection.POST);
    httpConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");

    URLEncodedPostData encPostData = new URLEncodedPostData("UTF-8", false);

    encPostData.append("username",username);
    encPostData.append("password",password);

    byte[] postData = encPostData.toString().getBytes("UTF-8");
    httpConn.setRequestProperty("Content-Length", String.valueOf(postData.length));

    httpConn.openOutputStream().write(encPostData.getBytes()); 

    try
    {
        int Response = httpConn.getResponseCode();
        System.out.println("Response Code = "+Response+httpConn.getResponseCode());
        if (Response == 200)
        {
            System.out.println("Response Code = "+Response+httpConn.getResponseCode());
            inputStream = httpConn.openInputStream();
            byte[] responseData = new byte[10000];
            int length = 0;
            StringBuffer rawResponse = new StringBuffer(10000);
            while (-1 != (length = inputStream.read(responseData)))
            {
                rawResponse.append(new String(responseData, 0, length));
            }
            replyMessage = rawResponse.toString();
            key = replyMessage.substring(12, replyMessage.length()-2);
        }
        else if(Response == 500)
        {
            Dialog.alert("User Details Incorrect");
        }
        else
        {
            System.out.println(Response);
        }
    }
    catch (IOException e)
    {
        Dialog.alert("Connection not established");
    }
}
else
{
    Dialog.alert("Connection not established");
}
return key;

i am now wondering under which type of service would this work.
I want to make my application work if there be no gprs/ 3g but have a wifi connection ..
Or the other way around too ..

Is there anyways to identify first the networks available n later pick a network for communication.

I appreciate any help in this regard..

Thank You,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:12:52+00:00Added an answer on May 23, 2026 at 10:12 am

    Take some time to read TransportInfo javadoc

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a very simple application which has to perform an action when the
I am making an application (iPhone app) which gets information (jokes) from an RSS
I am making an application which has j2me in client side and dotnet on
I am making an application in C# which uses a winform as the GUI
Hello everyone first of all. I am making an application for android, which I
Im making an application in cocoa and wanted to see if some strings in
I am making an application with Java Swing and i have a problem. I
I am making an application that does some custom image processing. The program will
I am making an application that involves controlling Safari from Applescript. Is there a
I am making an application for a windows mobile smartphone, and I would like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.