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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:38:44+00:00 2026-05-21T07:38:44+00:00

What is the default content returned when accept header is empty? The below code

  • 0

What is the default content returned when accept header is empty?

The below code returns application/xml when accept header is empty which maps to findAll(). Is there a way to force jax-rs to execute findAllAtom() when accept header is empty or unknown.
I am using restEasy version 2 with Jboss Application server and Adbera 1.1.2

@Stateless
@Path("quotes")
public class QuoteFacadeREST extends AbstractFacade<Quote> {
    @PersistenceContext(unitName = "RestFullDayTraderPU")
    private EntityManager em;

    public QuoteFacadeREST() {
        super(Quote.class);
    }

    @GET
    @Override
    @Produces({"application/xml", "application/json"})
    public List<Quote> findAll() {
        return super.findAll();
    }

    @GET
    @Override
    @Produces({"application/atom+xml"})
    @GET
    public Feed findAllAtom() throws Exception {
        Factory factory = abdera.getFactory();
        Feed feed = abdera.getFactory().newFeed();
        feed.setId("tag:example.org,2007:/foo");
        feed.setTitle("Feed Title");
        feed.setSubtitle("Feed subtitle");
        feed.setUpdated(new Date());
        feed.addAuthor("My Name");
        feed.addLink("http://example.com");
        feed.addLink("http://example.com","self");
        Entry entry = feed.addEntry();
        entry.setId("tag:example.org,2007:/foo/entries/2");
        entry.setTitle("Entry title 22 44");
        entry.setUpdated(new Date());
        entry.setPublished(new Date());
        entry.setSummary("Feed Summary");
        entry.setContent("One line content");
        return feed;
    }

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }
}
  • 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-21T07:38:45+00:00Added an answer on May 21, 2026 at 7:38 am

    Request without Accept header means that client expects anything, like if it has specified */*. Basically if you have two methods that differ only by @Produces and Accept header means “any”, there is no way for a JAX-RS framework how to choose the method, so according to spec it chooses the first one (See JSR-311 3.7.2)

    I believe that the best solution will be sending Accept header with an exact type.
    Otherwise you can differ methods by different URLs: add @Path("/xml") and @Path("/atom") to the methods.

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

Sidebar

Related Questions

Say I have default content on the left side of my application, which is
I want to load TinyMCe with default content as below when loaded . <html>
below is my code..I get an error -The remote server returned an error: (403)
In MOSS2007 I need to find and remove for example the default content type
How come http://www.zolomon.com/wptj/wp-content/themes/default/polaroid.swf works perfectly but not when implemented at http://www.zolomon.com/wptj/?page_id=8 ? The code
I want to be able to have default text like Enter content here... appear
There doesn't seem to be a default context menu (with copy, paste, etc.) for
Please consider the following context from Innate : # Default application for Innate def
I'm trying to make a meta-language for writing markup code (such as xml and
I`m trying to query all task lists. I have modified default Task content type

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.