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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:11:49+00:00 2026-05-31T23:11:49+00:00

I am new to RESTful services and their implementation on Spring 3. I would

  • 0

I am new to RESTful services and their implementation on Spring 3. I would like your opinion on the best practices for returning type when a client creates a new resource in my server.

@RequestMapping(method = RequestMethod.POST, 
value = "/organisation", 
headers = "content-type=application/xml")
@ResponseStatus(HttpStatus.CREATED)
public ??? createOrganisation(@RequestBody String xml) 
{
    StreamSource source = new StreamSource(new StringReader(xml));
    Organisation organisation = (Organisation) castorMarshaller.unmarshal(source);
    // save 
    return ???;
}
  • 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-31T23:11:50+00:00Added an answer on May 31, 2026 at 11:11 pm

    A simple choice would be javax.ws.rs.core.Response, found in the Java EE’s own restful services package. It – simply – tells what the web server should answer to the HTTP request.
    For instance:

    if (organisation != null)
      return Response.ok().build();
    else
      return Response.serverError().build();
    

    Custom response headers and other exotic things like that are possible with that return type too, but I don’t think that would match with “best practices”.


    uh, I missed that @ResponseStatus(HttpStatus.CREATED)… I guess my answer was not much of help.

    Maybe this will help instead: How to return generated ID in RESTful POST?

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

Sidebar

Related Questions

I am entirely new to streaming implementation. I have developed some RESTful web services
I am new to RESTful web services. We are taking the REST route for
I am pretty new to RESTful WCF services so bear with me. I am
I'm fairly new to RESTful web services and even more new to the Recess
I'm writing a client for a group of RESTful services. The body of the
I am working on a Spring 3 project and trying to write RESTful services.
I am new to the arena of RESTful services. I have been going through
I have a site where members login to their account (FormsAuth). I would like
I am new to Restful concept and have to design a simple API for
Why is there a need to define a new method in RESTful controller, follow

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.