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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:25:42+00:00 2026-06-17T04:25:42+00:00

Ok so this is the code on the server side i just have question

  • 0

Ok so this is the code on the server side i just have question on how is the path gonna be defined on the client’s side.
This is the method on the server

@Path("{index}/{product}/{amount}")
@PUT
@Produces("text/plain")
public String editTable (@PathParam("index") Integer index, @PathParam("product")     String product, @PathParam("amount") Integer amount)
{...}

Now on the client side

{url = new URL( "http://localhost:8080/OrderService/service/tableservice/"+num+"/"+product+"/"+amount);
.....}

/”+num+”/”+product+”/”+amount);

Is this the correct syntax??

Also can the num and amount be integers while the product a string or am i gonna have a problem with it?

  • 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-17T04:25:43+00:00Added an answer on June 17, 2026 at 4:25 am

    You will have problems if the product name has ‘unsafe’ URL characters in it. Which will probably be the case. To get around that you could URL encode the name before appending it to the URL.

    But I think you should rethink your PATH definition in the first place. A good resource endpoint should uniquely identify it. But in your case you are including an amount field in the URL! Which means depending on who is ordering the product the resource URL is changing:

    Customer A orders 2 Furbies:

    /OrderService/service/tableservice/9/Furbies/2
    

    Customer B orders 1 Furbie

    /OrderService/service/tableservice/9/Furbies/1
    

    But in both cases the customers are trying to order the same thing – a Furbie! This is not RESTful. Instead you should define a unique resource endpoint, then send the additional order information as appended data. So for example:

    public class Order {
        private Integer productId;
        private Integer amount;
    }
    
    @PUT
    @Path("/{productId}/orders")
    @Produces("text/plain")
    public String updateOrder(@PathParam("productId"), Order order) { ... }
    

    You will notice I removed the index field as well, you can add that back in if absolutely required. You will notice I also added tacked an orders suffix to the end of the URL. To indicate that you are PUT’ing an updated representation for an order made for a product.

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

Sidebar

Related Questions

i have a question about sockets/clients.... I just finished writing a client server program
I have this code for server code in c, under unix: /* A simple
I have some client side code that uploads an Outlook email to a document
Consider this code in a php file on my VPS server: <?php $url =
The code below is creating a server to communicate with clients.This code works fine
I use this code to connect to SQL Server 2012, but it does not
This code compiles, and runs successfully locally, but not on another server. Both machines
I am using this code to search data in SQL Server. But the result
I use this code to select password field from the sql server 2012 db,
So I run this Windows Server 2008 security update and this code block is

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.