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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:20:51+00:00 2026-05-30T06:20:51+00:00

My application should send a https GET request. Every time I get an exception

  • 0

My application should send a https GET request.

Every time I get an exception from it. If I uncomment url = "http://www.example.com" it works perfect. Otherwise it throws an exception “Illegal character in scheme at index 3“.

How to fix it?

   public class TestHttpManager {

   private final static String mask= "httрs://%s/action/?key=%s&param1=%s&param2=%s&param3=%s";

   public static void Send() throws IOException, URISyntaxException {
           if (....)
              url = String.format(UrlMask, "anyHostName.com", "keyTest", "param1", "param2", "param3");

             //url = "http://www.example.com";
             HttpClient client = new DefaultHttpClient();
             HttpGet request = new HttpGet();
             request.setURI(new URI(url));
             client.execute(request);
        }

     }

UPDATE: I have an error Tagret host must not be null, or set in parameters too.

  • 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-30T06:20:52+00:00Added an answer on May 30, 2026 at 6:20 am

    You have done url = "http://www.example.com"+stringOfParameter;

    now use this function to well format the above url,

    url = new String(url.trim().replace(" ", "%20").replace("&", "%26")
    .replace(",", "%2c").replace("(", "%28").replace(")", "%29")
    .replace("!", "%21").replace("=", "%3D").replace("<", "%3C")
    .replace(">", "%3E").replace("#", "%23").replace("$", "%24")
    .replace("'", "%27").replace("*", "%2A").replace("-", "%2D")
    .replace(".", "%2E").replace("/", "%2F").replace(":", "%3A")
    .replace(";", "%3B").replace("?", "%3F").replace("@", "%40")
    .replace("[", "%5B").replace("\\", "%5C").replace("]", "%5D")
    .replace("_", "%5F").replace("`", "%60").replace("{", "%7B")
    .replace("|", "%7C").replace("}", "%7D"));
    

    and now use the formatted url.

    EDIT :
    In your case you got httрs://serverName.com/action/key=myKey&param1=param1&param2=param2&param3=param‌​3

    with mask, I dont know much about that, but you can do

    String urlLink = "httрs://serverName.com/action/";
    String paramLink = "key=myKey&param1=param1&param2=param2&param3=param‌​3";
    

    and then use the above answer.

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

Sidebar

Related Questions

I want to send notification from PHP application and same time it should be
I am trying to send a request to an url like this http://mysite.dk/tværs?test=æ from
I'm making a Java console application that needs to send an HTTP request to
My application should load some data when it start at first time, but it
I'm trying to start unit testing on my application (should have done so from
Usually when I get POST data it's send from a HTML form and the
How can one pass http get or post methods to a windows application? I
I use this code to send an image from desktop application to a php
Android application should show Events happening in city as per day/month/year anywhere in the
My application should be syncronized with a ServerDB to collect some Data all users

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.