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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:42:02+00:00 2026-06-04T08:42:02+00:00

(Please see the code Code below) I am able to run it on Tomcat

  • 0

(Please see the code Code below) I am able to run it on Tomcat in the eclipse environment and it works as it should.
I have exported the following to a war file and created a Manifest.MF with:

Manifest-Version: 1.0
Main-Class: com.process.Test

When the code is ran in Eclipse the response from there server side is output to a console.

Now finally my question (Pardon my ignorance, I am fairly new to this):

Once the war is deployed on my Tomcat server, how do I send a REST request or run the war and display the server response?

What is the equivalent to :http://localhost:8080/rest/xml/list on a live server?

Web.xml

   <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>com.process.Test</display-name>
  <servlet>
    <servlet-name>Jersey REST Service</servlet-name>
    <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
    <init-param>
      <param-name>com.sun.jersey.config.property.packages</param-name>
      <param-value>com.process.Test</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Jersey REST Service</servlet-name>
    <url-pattern>/rest/*</url-pattern>
  </servlet-mapping>
</web-app>

Client side code:

import java.net.URI; 
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriBuilder;
import com.sun.jersey.api.client.Client;
//import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.client.config.ClientConfig;
import com.sun.jersey.api.client.config.DefaultClientConfig;

public class Test 
{       
public static void main(String[] args) {

    //Instead on using Apache Client 
    //used default Jersey client 
    //to send requests          
    ClientConfig config = new DefaultClientConfig();
    Client client = Client.create(config);      
    String _package = "api.amebatv.com";
    WebResource service = client.resource(getBaseURI(_package));

    //runRequest(service,"indexpath");
    runRequest(service,"list");
}

/*
 * For testing purposes the base URI is :http://localhost:8080/package name
 * Will change to domain name for production code
 */
private static URI getBaseURI(String _package){
    return UriBuilder.fromUri(
            "http://localhost:8080/api.process.com").build();
}


private static void runRequest(WebResource service,String path){
    String response = service.path("rest/xml/"+path).accept(MediaType.APPLICATION_XML).get(String.class);
    System.out.println("Post Response :"+response);
}

}

Server Side:

@Path("/xml")

public class Service {

// List of video objects
private ArrayList<Video> videolist; 
//Parser object, parses xml  into video objects
private Parser parser = new Parser();


/*
 * Constructor
 * Parse XML and create video list on call
 */
public Service(){
    parser.createXML();
    videolist = parser.getList();       
}

/************************************************
 *GET
 * Path: /indexpath
 * list of all only <video> items
 * @return : ArrayList of Video objects
 ***********************************************/
@GET
@Path("/list")
@Produces(MediaType.APPLICATION_XML)
public List<Video> getCustomerInXML() 
{ 
    return videolist;
}
}
  • 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-04T08:42:03+00:00Added an answer on June 4, 2026 at 8:42 am

    The URL of a web app depends on many factors, the app server, configuration files, web.xml, and app server specific configuration.

    But in some cases this is a “first thing to try if you don’t know” (not an official, but “it works” rule of thumb)

    http://hostnameOrIP:8080/WARFILENAMEWITHOUTEXTENSION
    
    • hostnameOrIP: well, just replace with your host name or IP
    • replace 8080 with the default port of your app server (9001, 9090, 3000 etc…)
    • replace WARFILENAMEWITHOUTEXTENSION with, well, again, just war file name without extension

    This is again an unofficial, try-it-first way if you have no other way to tell…

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

Sidebar

Related Questions

I am using vb.net code. I have grid view, please see the code below:
I have a grid view control in my application. Please see the below code.
Please see below the code i have. I am trying to align the name
Please see the code below: #include <iostream> #include <stdlib.h> #include <time.h> using namespace std;
I've a problem with CakePHP __() function. Please see the code below : $options
I am using jquery datepicker, please see below code $(document).ready(function() { $(.txtDate).datepicker({ showOn: 'button',
Please see the following code: List list = Collections.synchronizedList(new ArrayList()); // ... synchronized (list)
How do we update a textbox on ticking checkboxes? Please see the following code,
Noob question here. Please see code below. Where can I read more on this?
Please see code below: <div style=background:#F00;width:800px;> <div style=float:left> Hello Hello Hello Hello Hello Hello

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.