Android :: Java.net.HttpURLConnection Throws - Received Authentication Challenge Is Null
Aug 31, 2009
I am using HttpURLConnection to send a GET request to a server. Upon reading the response code, the Android implementation of HttpURLConnection.doRequestInternal() throws an exception:
"java.io.IOException: Received authentication challenge is null"
I don't even get what the error is trying to tell me. I write an OAuth param string to the Authorization header, but this works fine on other occasions. There is nothing peculiar about my request apart from that.
Any idea what this means, what is causing this and how to get around it? This works fine with Sun's Java implementation, so I guess it's a problem with Apache Harmony?
View 4 Replies
Aug 31, 2009
I am trying to send a GET via Android's HttpURLConnection (which is an org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection), and upon receiving the response, an IOException is thrown:
in doRequestInternal(): "Received authentication challenge is null"
What does this error mean, and what is causing this? I am writing OAuth parameters to the Authorization header, but I do this on other occasions, too, without problems.
CODE:.............................
View 2 Replies
View Related
Mar 24, 2009
I am beating my head against a wall trying to figure out why I cannot get Authenticated on my server whilst using HttpUrlConnection. I need to post a file in a post method and it seems I cannot do so with the DefaultHttpClient and a regular HttpPost (unless I am completely missing something?). I can get DefaultHttpClient to authenticate just fine using setCredentials() but the same doesn't exist for HttpUrlConnection so I try to set through setRequestProperty: conn.setRequestProperty("Authorization", "Basic " + Base64EncodedUserNamePassword); to no avail.
View 6 Replies
View Related
Nov 3, 2010
I'm developing an Android app which needs to perform an HTTPPost to get a token back. Then use that token for subsequent calls. When I perform the initial call to get the token, it throws an exception: org.apache.http.auth.MalformedChallengeException: Authentication challenge is empty
Here is my code:...............
I googled "Authentication challenge is empty", and one this website: http://fmpwizard-scala.posterous.com/using-apache-httpclient-authenti... he had a similar problem. He determined that his web server requires preemptive authentication. Which I believe ours does too. I tried implementing what he did, and still, no dice.
I've hard coded the token in other requests, and I am able to perform HTTPGet calls.
What is the Authentication Challenge that I'm missing?
View 2 Replies
View Related
Sep 20, 2010
I have a Thread that downloads data from internet
CODE:..........................
There is an activity that needs to be updated according to downloaded data.
CODE:............................
Whenever I run above code I get NullPointer Exception .Please help me to update the view.
View 1 Replies
View Related
Oct 15, 2010
"Basic YWRtaW46YW RtaW4=" is right code for my address.I check on j2me project.
And on android my getbase64 method returns "Basic YWRtaW46YW
RtaW4=" its true.
And ı use it on:
httpConnection.setRequestProperty("Authorization",getBase64Encode());
Finally responce code is 401
code:..............
View 1 Replies
View Related
Sep 4, 2010
I have class A in which I have a method openfileConnec().
It was written like the below:
CODE:...............
Now I come to class B where I will call this method like the below:
CODE:.............
I was asked a question in an interview as follows:
Why does the method have a throws Exception in its declaration? Is it that on of the methods called in the implementation throws the base class exception? Also If we get a exception during calling the method (fileConnect( )) control goes to catch block. After executing catch where should the control go, what should be sent to base case?
View 2 Replies
View Related
Sep 23, 2010
When my app loads, I fill my android.app.Application with some data. The app runs fine as I use it and all the data is available. However, when I leave the app over night and look at it again the next day, I receive NullPointerExceptions when attempting to use that same data. I do not believe Application objects get garbage collected, so I have no idea what is going on? I also lose static objects in classes used by my Activity classes. I am on Froyo 2.2 on a Google Nexus One. Looks like someone else had a similiar issue: http://groups.google.com/group/android-developers/browse_thread/threa...
View 6 Replies
View Related
Nov 1, 2010
i want to implement a client for https, all in my localhost (in my apache, it is configured to ask authentication), with a resource " https://localhost:443/resources/resource1.xml" the server works fine.
I have a client for desktop, and it works fine, the resources are consumed using httpcomponents-client-4.0.3), i have readed that Android uses that version.
This is the code of my client in Android (practically is the same of desktop mapped to android) ,
in the line of SSLContext sc = SSLContext.getInstance("TSL"); the next exception is thrown :
java.security.NosuchAlgorithmException: SSLContext SSL implementation not found
I have tried with TSL and the exception continue.
Import java.io.IOException;
CODE:..................
View 9 Replies
View Related
Jan 9, 2010
I am creating an application which retrieves images from the web. In case the image cannot be retrieved another local image should be used.
While trying to execute the following lines:
CODE:................
The line if(drawable.equals(null)) throws an exception if drawable is null.
Does anyone know how should the value of drawable be checked in order not to throw an exception in case it is null and retrieve the local image (execute drawable = getRandomDrawable())?
View 5 Replies
View Related
Nov 6, 2010
In my main activity, I have the following code that calls my FileBrowser activity: What's wrong? Can I not use putExtra with startActivityForResult? Can putExtra only be used with startActivity? Code...
View 1 Replies
View Related
Jun 15, 2010
I've got an application which is making a web request every 10s using HttpURLConnection. When the application starts in 3G, it works great. Then I activate Wifi and after that, all my requests fail during exactly 10 minutes with the fallowing exception : Socket is not connected. The behavior is the same if I start in Wifi and then I switch to 3G. What's the problem here ? Do we need to setup something at socket level ? a timeout (10 minutes is the default one) ?
View 3 Replies
View Related
Oct 6, 2010
New version 1.2 of ScaliCommander is available:
- Search: browse results while searching, sort while searching, search inside ZIP, filter by file type
- long-click for context menu, long-click / double-click for drag-select
- color gradients and glow
- drag-and-drop with multiple items, clipboard, trash
- Contribution Challenge, first round: 5 *1000
- Discover the features find out why ScaliCommander is the most advanced file manager for a mobile device and consider how it can get even better
- Contribute your way
--> find bugs
--> make videos/screenshots/tutorials/ to show the features
--> compile the best color themes
--> suggest features
--> whatever YOU think helps most to improve ScaliCommander!
send your contributions to gslngr@googlemail.com
- Get rewarded
--> make ScaliCommander known - rate it on the market, post a comment, report about it in forums,--> When the full version of ScaliCommander hits 10,000 downloads, gslngr Soft will reward the 5 best contributions with 1000 each!
View 7 Replies
View Related
Nov 19, 2010
Why we have to setup a boundary string?What is the purpose for? any rules on it?
View 1 Replies
View Related
Jan 15, 2010
The method disconnect from HttpURLConnection seems not to work properly. If I execute the following code...
View 2 Replies
View Related
Feb 17, 2009
This is an issue that has kept me from doing real work for *a while* now:
The Task: Read an image from the net (PNG approx. 10kb) and writeit to the user dir as is.
I'm using a byte array to temporarely store the data, basically like this:
CODE:..............
The Problem: it works - sometimes. Actually it always works in the emulator, and it usually works when attaching the debugger to the phone and stepping through the code. Interestingly it almost always produces corrupt images when running in 'normal mode' - read on the Dev1 via UMTS.
Corrupt images are good at the start of the image, and somewhere in the middle or to the end, they produce pixel trash. They can't be decoded to a Bitmap or alike as well.
I'm almost sure it's a HttpURLConnection issue, or at least related to it.
BTW. the download happens in it's own object instance, but about 10 are triggered in a loop after each other.
View 4 Replies
View Related
Sep 15, 2009
I have a server that uses User Agent header to identify the device that is connecting to it. But when i connect to the server using HttpURLConnection i get no User Agent header, but when i connect with the browser it sends the correct User Agent.
For testing i am using an echo server that replies with the headers it found on the request.
When i connect with browser i get: eg: User-Agent: Mozilla/5.0 (Linux; U; Android 1.5; en-fr; HTC Hero Build/CUPCAKE) AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1 Up.Link/6.3.1.20.06.3.1.20.0.
But when i connect by code with UrlConnection i get: User-Agent: UNAVAILABLE.
Does anyone know we i get different behaviors? How i can i connect in the same way the browser does?
What i really need is not only the User-Agent header, i also need some special headers (x-up-subno actually). This header is added by the APN of the operator, but for some reason when i connect by code that headers are not added to the request.
From browser:
From code:
View 2 Replies
View Related
Feb 1, 2010
Looking for a way to root droid and block all adult media. So far the only conclusion that I can arrive is to root then delete market and browser.
View 5 Replies
View Related
Oct 17, 2010
CODE:......................
I get the following exception when trying to use the isUserAMonkey API on a keydown. mAM = (android.app.ActivityManager)getSystemService(Context.ACTIVITY_SERVICE); if (mAM.isUserAMonkey()) {return true;} Any reason why this may be happening?
View 9 Replies
View Related
Nov 18, 2009
In the following code, these lines:
CODE:.........
The app keep throws the Rescources.NotFoundException. I checked the xml file, all the ids are defined and they are all in the R.java. So I really don't know why the app throw this exception.
CODE:.......................
View 2 Replies
View Related
Apr 30, 2009
I would like to do some tests on SlidingDrawer however i always found RuntimeException when SlidingDrawer.onMeasure is called i check the code and think the exception is caused by unspecified MeasureSpec
so i would like to ask how to setup the MeasureSpec in SlidingDrawer?
View 2 Replies
View Related
Jun 25, 2010
I'm trying to make a simple ProgressDialog appear while my AsyncTask is fetching data. In my onPreExecute() method I have this: pd = ProgressDialog.show(c, "Loading...", "Please wait");
c is the context passed into the constructor of my AsyncTask from this.getApplicationContext(). Unfortunately, I keep getting an exception with this message: Unable to add window -- Token null is not for an application
What am I doing wrong?
Using this instead of this.getApplicationContext() has revealed another problem. When I call ProgressDialog.show(..., a ProgressDialog is displayed, but not until after the AsyncTask has completed. In other words, the data loads and then the dialog is displayed. If I include pd.dismiss() in my onPostExecute() then I never even see the dialog (presumable because it is closed before it ever gets opened).
It turns out that fetch.get() was hogging the UI thread and not letting the ProgressDialog display.
View 2 Replies
View Related
Oct 7, 2010
I have a ListView that I'm binding to an adapter. The adapter is a protected member of my main class. I have a listener thread that receives data and updates the source list for my adapter. When I call the adapter's notifyDataSetChanged() method, an exception is thrown:
Runtime Exception: PhoneLayoutInflater(LayoutInflater).inflate(int, ViewGroup, boolean) line: 322
I've read that the notifyDataSetChanged() method has to be called on the UI thread, and I'm doing that. In fact, just to be sure, I even update the ListView's data source on the UI thread. All I do in my listener thread is update a protected member that houses the data. Here's an example of what I'm doing (note that I don't have the part of the code that calls the AsyncTask, but it's fired from a listener):
CODE:............
Does anyone have any pointers or ideas as to why I'm getting this exception? Any help is much appreciated.
Here are the layout files, as requested:
main.xml:
CODE:....................
row.xml:
CODE:...............................
View 1 Replies
View Related
Aug 26, 2010
I have recently noticed that when Running the function geoCoder.getFromLocationName() on android 2.2 (Froyo) then i Receive a IOExeption (Which does not occur on other SDK versions).
After some reserch i have found suggentions to add the following Permisions:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
However this does not solve the problem, and this appears to be a Android SDK Bug.
Is there a knows solution to this problem?
Here is the stack trace though it is not particularly helpful the inner stack trace is null so not great.
CODE:.......................
View 3 Replies
View Related
Jul 1, 2010
My XML layout in res/layout/edit.xml: Code...
When I try to switch from "edit.xml" to "Layout", I see this error: java.lang.UnsupportedOperationException: addView(View, LayoutParams) is notsupported in AdapterView I checked the documentation for AdapterView, and this is expected behavior. Why, then, does ADT expect it to work?
View 1 Replies
View Related
Sep 17, 2010
I've got a probleme with an exception, but I don't know why I get this exception.
The project is about implementing an AbstractAccountAuthenticator with an AbstractThreadedSyncAdapter to sync certain data on a server with a content provider.
I made everything and both adding accounts and syncing is running without any problems.
Now I've tried to add a Preference-Screen just like suggested in the android reference (search for AbstractAccountAuthenticator, it is explained there) via xml like this:
autenticator.xml:
CODE:..........
The Preference-Screen-xml looks like this:
CODE:.....................
The screen is promted how it should be, but and that is the problem: When I click on the PreferenceScreen with the intent it leads to a crash of the system (both in the emulator and my HTC-Desire).
Logcat says:
CODE:..............
Here the part of the manifest, where the activity is defined:
CODE:.......
The whole test-code (it is my project on the essentials to find the problem) is to find at googlecode (http://code.google.com/p/ cleanproject/source/browse/) (Eclipse-Project)
View 2 Replies
View Related
Jul 11, 2010
I have developed simple application of progress bar in that when I hit the button then it will do some work in background and one progress bar is visible on foreground. afte completing back ground work it display the same screen. It works fine if I don't rotate mobile but when I rotate mobile then it throws java.lang.IllegalArgumentException: View not attached to window manager
I know when we rotate the device or open keypad it starts activity restarted. But How to avoid this error. My code is.
CODE:..........................
View 3 Replies
View Related
Jul 31, 2010
I have two projects in Eclipse: service and UI client.
In onCreate in UI client I have:startService(new Intent(this, ExampleService.class));
But this fragment: ExampleService.class throws NoClassDefFoundError exception at runtime. I have installed ExampleService.apk, and ExampleUiClient.apk. Project compiles, and everything looks fine. What I am doing wrong?
Is it possible to start service from other apk?
View 2 Replies
View Related
Mar 30, 2010
I am having this problem with the android database. I adopted the DBAdapter file the NotepadAdv3 example from the google android page.
CODE:...........
The error that i am receiving is from Log.e(TAG, e.toString()) in the methods retrieveKey() and storeKey() "no such table: myuserkey: , while compiling: SELECT userkey FROM myuserkey"
View 2 Replies
View Related
Dec 10, 2009
Is there someone troubled the same issue.
The code in run.
CODE:.............
View 8 Replies
View Related