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 9072643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T18:13:11+00:00 2026-06-16T18:13:11+00:00

I have a code to send request to php page and it worked fine,

  • 0

I have a code to send request to php page and it worked fine, but suddenly(I don’t remember changing anything) it stopped working both on emulator and on real device

    URL url = new URL(this.site); 
            URLConnection conn = url.openConnection();

            if (!(conn instanceof HttpURLConnection))    { 
                Log.e(TAG, "connection is not HttpURLConnection");  
                throw new IOException("Not an HTTP connection");

            }

            try{
                Log.e(TAG, "Trying");
                HttpURLConnection httpConn = (HttpURLConnection) conn;
                Log.e(TAG, "Created connection");
                httpConn.setAllowUserInteraction(false);
                httpConn.setInstanceFollowRedirects(true);
                httpConn.setRequestMethod("POST");
                Log.e(TAG, "connecting");
                httpConn.connect(); 
                Log.e(TAG, "connected");

                OutputStreamWriter wr = new OutputStreamWriter(httpConn.getOutputStream());
                Log.e(TAG, "created outputstream");

Here is the stacktrace:

     12-25 00:32:14.024: W/System.err(885): java.net.ProtocolException: Does not support output
     12-25 00:32:14.090: W/System.err(885):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:575)
     12-25 00:32:14.090: W/System.err(885):     at com.*****.StringAsyncRetriever.OpenHttpConnection(StringAsyncRetriever.java:122)
     12-25 00:32:14.090: W/System.err(885):     at com.******.StringAsyncRetriever.getData(StringAsyncRetriever.java:66)
     12-25 00:32:14.094: W/System.err(885):     at com.******.StringAsyncRetriever.doInBackground(StringAsyncRetriever.java:38)
     12-25 00:32:14.094: W/System.err(885):     at com.******.StringAsyncRetriever.doInBackground(StringAsyncRetriever.java:1)
     12-25 00:32:14.094: W/System.err(885):     at android.os.AsyncTask$2.call(AsyncTask.java:185)
     12-25 00:32:14.094: W/System.err(885):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
     12-25 00:32:14.094: W/System.err(885):     at java.util.concurrent.FutureTask.run(FutureTask.java:138)
     12-25 00:32:14.094: W/System.err(885):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
     12-25 00:32:14.094: W/System.err(885):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
     12-25 00:32:14.094: W/System.err(885):     at java.lang.Thread.run(Thread.java:1019)
  • 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-06-16T18:13:13+00:00Added an answer on June 16, 2026 at 6:13 pm

    Looking at the source code, that exception is thrown when doOutput is not set to true:

    (From: http://www.java2s.com/Open-Source/Android/android-core/platform-libcore/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnectionImpl.java.htm)

    public OutputStream getOutputStream() throws IOException {
        if (!doOutput) {
            throw new ProtocolException("Does not support output");
        }
    

    The HttpURLConnectionImpl class is extended from Java’s HttpUrlConnection class which extends URLConnection. Looking at the javadocs for that you find:

    protected boolean doOutput

    This variable is set by the setDoOutput
    method. Its value is returned by the getDoOutput method. A URL
    connection can be used for input and/or output. Setting the doOutput
    flag to true indicates that the application intends to write data to
    the URL connection.

    The default value of this field is false.

    So, you need to do:

    httpConn.setDoOutput(true);
    

    in your code.

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

Sidebar

Related Questions

I have a some code to ajax upload . its send request to my
I have to written the following code to send a mail using PHP in
I have this code that can't send a Facebook request until now. NSDictionary *firstDict
I have this code for send simple data using jquery , but no works
I have 2 questions : If i send the ajax request to self page
I'm using ajax() to send POST request to a php page. This is the
I have this in my PHP code, and it currently does the login request
I have an html page that would send json request to get the data
i have a code to send a Form Post with login credentials to a
I have this code written in .NET 4.0 using VS2010 Ultimate Beta 2: smtpClient.Send(mailMsg);

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.