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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:59:23+00:00 2026-05-19T15:59:23+00:00

I have a Java WebService setup which consumes an xml file and want to

  • 0

I have a Java WebService setup which consumes an xml file and want to be able to produce either xml or json based on what the client requests. I know that this is possible through reading up on Jersey REST methods but it does not show how to extract this information. I have also looked on google all over but can’t seem to find any examples of this.

http://wikis.sun.com/display/Jersey/Overview+of+JAX-RS+1.0+Features is the site that I was initially referencing which shows that it is possible, I was just wondering if anyone would be able to help me find out how to actually distinguish the client’s request. Is it in the html header? body? And if so what is the proper way to extract it?

This is what my method currently looks like, I do not have any issues with connection, just finding out what the client requests as a return type.

@POST
@Path("getStatisticData")
@Produces ({"application/xml","application/json"})
@Consumes ("application/xml")
public String getStatisticData(@FormParam("xmlCoords") String xmlFile) throws Exception{

Thanks in advance.

  • 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-19T15:59:24+00:00Added an answer on May 19, 2026 at 3:59 pm

    You can extract it using the @HeaderParam annotation:

    ...
    public String getStatisticData(@HeaderParam("Accept") String accept,
        @FormParam("xmlCoords") String xmlFile) throws Exception {
    
        ...
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a webservice in java that receives a list of information to be
I have a Java client that calls a web service at the moment using
I have Java and Flash client applications. What is the best way for the
We have a java web service application that uses log4j to do logging. An
I have a JAX-RPC (Java) web service that needs to return a complex polymorphic
We have a dotnet web service that a java using customer wants to connect
Does anyone have a recommendation about web service security architecture in Java (preferably under
Here is what I have: JAVA_HOME=C:\Software\Java\jdk1.5.0_12 (points to JDK 5.0) In Eclipse Installed Runtimes
Does Java have a built-in way to escape arbitrary text so that it can
Does Java have a data type that represents a period of time eg 34

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.