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

  • Home
  • SEARCH
  • 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 1096423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:16:58+00:00 2026-05-17T00:16:58+00:00

I’m trying to integrate some Google maps bits into my Java web app using

  • 0

I’m trying to integrate some Google maps bits into my Java web app using the Google Maps static API. For the moment I’m just trying to get a map, any map. Their example:

http://maps.google.com/maps/api/staticmap?center=40.714728,-73.998672&zoom=12&size=400x400&sensor=false

works fine from my browser. However the Java HTTP client software I am using (the one from Apache’s http components, version 4.0.2) insists that I encode my URIs, so I end up with this:

http://maps.google.com/maps/api/staticmap?center%3D40.714728%2C-73.998672%26zoom%3D12%26size%3D400x400%26sensor%3Dfalse

which doesn’t work. I would happily not encode my URIs but the Apache client fails if I don’t. So my question is how can I either:

  • persuade Apache’s client to use the plain URI or
  • get the encoded URI into a form Google will accept

?

  • 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-17T00:16:59+00:00Added an answer on May 17, 2026 at 12:16 am

    As Pekka suggested you need to leave to & and = unencoded.

    Your encoded url

    http://maps.google.com/maps/api/staticmap?center%3D40.714728%2C-73.998672%26zoom%3D12%26size%3D400x400%26sensor%3Dfalse
    

    vs unencoded & (%26) and = (%3D) (working)

    http://maps.google.com/maps/api/staticmap?center=40.714728%2C-73.998672&zoom=12&size=400x400&sensor=false
    

    Apache’s HTTPComponents HTTP Client has a lot of interfaces with which you can build your request URL. To make sure that the proper parts of the URL are encoded I would suggest using this method:

    List<NameValuePair> qparams = new ArrayList<NameValuePair>();
    qparams.add(new BasicNameValuePair("center", "40.714728,-73.998672"));
    qparams.add(new BasicNameValuePair("zoom", "12"));
    qparams.add(new BasicNameValuePair("size", "400x400"));
    qparams.add(new BasicNameValuePair("sensor", "false"));
    URI uri = URIUtils.createURI("http", "maps.google.com", -1, "/maps/api/staticmap", 
        URLEncodedUtils.format(qparams, "UTF-8"), null);
    HttpGet httpget = new HttpGet(uri);
    System.out.println(httpget.getURI());
    
    1. More example http://hc.apache.org/httpcomponents-client-ga/tutorial/html/fundamentals.html
    2. API Docs http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/index.html
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Seemingly simple, but I cannot find anything relevant on the web. What is the
this is what i have right now Drawing an RSS feed into the php,
I have just tried to save a simple *.rtf file with some websites and
Does anyone know how can I replace this 2 symbol below from the string

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.