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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T23:14:41+00:00 2026-06-16T23:14:41+00:00

This is how my Jersey Rest web service’s a few methods looks likes, I

  • 0

This is how my Jersey Rest web service’s a few methods looks likes, I have some methods to update the user settings like:

@PUT
@Path("/langauge")
@Consumes("text/plain")
public void updateLanguage(String lang) {

    ***check validity of the lang by string comparisons**
     and update database with the new language*
}

@PUT
@Path("/threshold")
@Consumes("text/plain")
public void updateThreshold(Long threshold) {

   *//check value and update in server*
}

Now I have a few questions here;

1- Instead of different resource paths for different update options, is it better to create one resource and update with query parameters? This looks more Restish but I’m not sure I really should change it to something like, because in future if there are more parameters to be updated than it will be very cluttered, while having independent paths looks more clear?

@PUT
@Path("/settings/{lang}/{threshold}")
@Consumes("text/plain")
public void updateSettings(@PathParam("threshold") String thre,
        @PathParam("lang") String lang,
        @DefaultValue("") @QueryParam) {


}

2- Another question is while updating the language now I accept a language as a string then check if thats valid or not in server, So when client uses this method they don’t know what exactly should they send as valid parameters. Is there a way to make this more user friendly, putting some comments on WADL file is an option, but is there another more REST way of doing this?

  • 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-16T23:14:42+00:00Added an answer on June 16, 2026 at 11:14 pm

    Without knowing the entire scope of your application, I’d say, you could consider the settings a resource and the particular options as the member of the collection of settings. This would allow to add new settings (downside is, that a client that wants to update multiple would need to know and call all of them):

    /settings/language
    /settings/threshold
    ...
    # later
    /settings/timeout
    /settings/temperature
    

    You could implement the GET method on each of the options to display information to the interested client (either as HTML or text or some other format).

    Another way would be to collect all settings at one endpoint and to accept a request entity in some format (e.g. JSON) as a representation of all available settings. This approach can be observed in the wild in the elasticsearch APIs (e.g. here: http://www.elasticsearch.org/guide/reference/api/admin-indices-update-settings.html).

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

Sidebar

Related Questions

I have some @javax.xml.bind.annotation.Xml... annotated classes here intended for a RESt web service. Jersey
I have a REST Jersey web service. My question is about the answer of
I have a json based REST Web Service implemented using: Jetty, Jersey, Jersey-JSON using
I'm using Jersey to create a REST web service for a server component. The
I have a REST web service class which i call HttpRequest using curl.I wrote
I ve created a sample REST web service which writes some data in a
I'm using jersey API for some REST web services with apache Tomcat. I need
I'm using eclipse and I have a java web service (rest jax-rs) I also
I have to use an interface in my REST web service. Here is the
I have a REST web service which I created previously and deployed in Tomcat7.

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.