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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:47:07+00:00 2026-06-14T11:47:07+00:00

I have written a resteasy-spring service : @Controller @RequestMapping(/abr/asd) @Path(/ab/ac) public class JobSchedulerService {

  • 0

I have written a resteasy-spring service :

    @Controller
    @RequestMapping("/abr/asd")
    @Path("/ab/ac")
    public class JobSchedulerService {

        private static final Logger LOGGER = Logger.getLogger(JobSchedulerService.class);

        @GET
        @Path("/abc/{param}")
        public String scheduleJobs(@PathParam("param") String name) {
            return "Success";
        }
    }

When i try calling this service from Browser, the response is proper :

http://localhost:8080/ControlAppWeb/rest/ab/ac/abc/name
  • Success

But when i try calling it from a Rest Client API, it returns a web page which is actually the welcome page for the web application where i have incoroporated the rest service :

         try {
         URL url = new URL("http://localhost:8080/WebApp/rest/ab/ac/abc/name");
         HttpURLConnection conn = (HttpURLConnection) url.openConnection();

         conn.setRequestMethod("GET");
         conn.setRequestProperty("Accept", "application/json");

         if (conn.getResponseCode() != HttpURLConnection.HTTP_OK) {
         throw new RuntimeException("Failed! " + conn.getResponseCode());
         }
         BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
         String output;

         System.out.println("Output from Server is: ");
         while ((output = br.readLine()) != null) {
         System.out.println(output);
         }
         conn.disconnect();     
         } catch (MalformedURLException e) {        
         e.printStackTrace();
         } catch (IOException e) {      
         e.printStackTrace();       
         }

Kindly help, as to where am i going wrong in invoking from Java API

Further: i tries removing the controller and request mapping annotation from the Service, still the browser call worked and java rest client didn’t. Weird thing is that even if my modify the url to anything random (in the java client) excluding the intial part (http://localhost:8080/ControlAppWeb), the output remains the same and never is an error thrown…

  • 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-14T11:47:08+00:00Added an answer on June 14, 2026 at 11:47 am

    The problem in this case seemed to be arising due to a ‘filter‘ configured in the web.xml of the control application. Due to which all the requests to /* were getting redirected to the welcome page. Removing the filter configuration from the web.xml file resolved the problem and the response for the Java Rest API was ‘Success’ same as for the call from the Browser. Though i am still unclear on why the filter did not affect the request from browser but did so for the request from Java Client.
    Anyways hope this helps others who might be struggling with a similar problem.

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

Sidebar

Related Questions

have written this little class, which generates a UUID every time an object of
I have written a web-service (in Java) which produces as a result a (rather
I have written a simple WCF web service in C# which returns records from
I have written a WCF service with the REST template that has the defaultOutgoingResponseFormat
Have written all the code in a silverlight class library (dll) and linked this
I have written a generic class class MyClass : MyClass<string> { } //this line
I have written a REST server based on RESTEasy . In some of the
I have written a Scala class Sheltie to understand how scopes work in Scala.
I have written this protobuf message in c# C# client: public AddressBook InitializeAdressBook() {
I have written servlet.I want to test the functionality of my servlet class ,so

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.