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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:26:26+00:00 2026-05-27T18:26:26+00:00

my HttpGet request is calling my indexAction, instead of getAction. What’s going on? Here

  • 0

my HttpGet request is calling my indexAction, instead of getAction. What’s going on?

Here are my codes:

    public function getAction() {

    $id = $this->_getParam('id');

    if(!$id)
    {
        $this->getResponse()
             ->setHttpResponseCode(400)
             ->setBody("no id");
        return;
    }

    try
    {
        $q = Doctrine_Query::create()
             ->from('Milotin_Model_Locations l')
             ->where ('l.id=?', $id);

        $result = $q->fetchArray();

        if(count($result) == 1)
        {
            $this->getResponse()
                 ->setHttpResponseCode(200)
                 ->setBody(json_encode($result));
        }
    }
    catch(Exception $e)
    {
        $this->getResponse()
             ->setHttpResponseCode(500)
             ->setBody($e->getMessage());
    }
}



    public function indexAction() {
}

And here is my code in Android:

    private static void getLoc()
{
    final HttpResponse response;

    final HttpGet getRequest = new HttpGet(LOCATION_URI + "?geolat=" + geoLat + "&geolong=" + geoLong);

    try {
        response = mHttpClient.execute(getRequest);

        if(response.getStatusLine().getStatusCode() == 200)
        {
            //do something
        }

    } catch (ClientProtocolException e) {
        Log.e(TAG, e.getMessage());
        e.printStackTrace();
    } catch (IOException e) {
        Log.e(TAG, e.getMessage());
        e.printStackTrace();
    } catch (JSONException e) {
        Log.e(TAG, e.getMessage());
        e.printStackTrace();
    }

}

My HttpPost is working correctly (it calls postAction), Any explanation?

Thanks.

  • 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-27T18:26:27+00:00Added an answer on May 27, 2026 at 6:26 pm

    I found the answer. It’s actually the behavior of Zend Framework. If the ‘id’ element is not found in the GET request, it will redirect to indexAction, instead of getAction.

    Example:

    ‘GET localhost/student’ will redirected to indexAction, while
    ‘GET localhost/student/23’ will redirected to getAction. (23 is the id)

    Found it in Zend Framework: A beginner’s guide, by Vikram Vaswani.

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

Sidebar

Related Questions

I'm using something like this: HttpClient client = new DefaultHttpClient(); HttpGet request = new
Here is my code: DefaultHttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet(url);
All I want to do is use AsyncTask to do a http request. This
Can someone please tell me where I'm going wrong with this piece of code?
in my project, I am calling webservice with http get request. API key is
I am writing a httpget request for android that queries the foursquare api for
I keep getting a Bad Request error from the URL I'm calling in my
HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet(); request.setURI(new URI(address)); HttpResponse response
HttpGet request = new HttpGet(https://192.168.1.140:8732/...); I wonder why I can only send successfully for
I am trying to send a cookie along with my HttpGet request, but everytime

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.