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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:20:46+00:00 2026-06-15T12:20:46+00:00

Here is what I am trying to do: @POST @Path(/MyPath) @Produces(text/xml) @RolesAllowed({user}) public Output

  • 0

Here is what I am trying to do:

@POST
@Path("/MyPath")
@Produces("text/xml")
@RolesAllowed({"user"})
public Output myMethod (@QueryParam("itemId") long ItemId, 
                                    @QueryParam("plannedstartdate") Calendar plannedStartDate, 
                                    @QueryParam("plannedreturndate") Calendar plannedReturnDate)

I am using JBoss AS7. As far as I understan, resteasy is integrated into JBoss AS7. I am able to run simple rest services.

The only documentation I found about passing dates is at the link :
http://docs.jboss.org/resteasy/2.0.0.GA/userguide/html/StringConverter.html#StringParamUnmarshaller

I am not able to follow this and fix the issue as the instructions are not clear.
When I try to create an annotation DateFormat as given in the example, it does not recognize StringParamUnmarshaller. I don’t know where to get it from. If resteasy is already integrated into JBoss AS7, is this not supposed to be recognized?

My pom.xml has the following dependency:

  <!-- Import the JAX-RS API, we use provided scope as the API is included 
     in JBoss AS 7 -->
  <dependency>
     <groupId>org.jboss.spec.javax.ws.rs</groupId>
     <artifactId>jboss-jaxrs-api_1.1_spec</artifactId>
     <scope>provided</scope>
  </dependency>

The calls to this method fail as the String to Calendar conversion does not happen. I dont want to pass String instead of Calendar as there are other clients that make java call directly. Can anyone help with how I can pass dates to Rest Calls?

Thanks
Veer

  • 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-15T12:20:48+00:00Added an answer on June 15, 2026 at 12:20 pm

    This issue is resolved. See the following code.

    Create an Annotation class CalendarFormat.java:

    @Retention(RUNTIME)
    @StringParameterUnmarshallerBinder(CalendarFormatter.class)
    public @interface CalendarFormat {
        String value();
    }
    

    Add a class CalendarFormatter.java:

    public class CalendarFormatter implements StringParameterUnmarshaller<Calendar> {
        private SimpleDateFormat formatter;
    
        public void setAnnotations(Annotation[] annotations) {
            CalendarFormat format = FindAnnotation.findAnnotation(annotations, CalendarFormat.class);
            formatter = new SimpleDateFormat(format.value());
        }
    
        public Calendar fromString(String str) {
            try {
                Calendar cal = Calendar.getInstance();
                cal.setTime(formatter.parse(str));
                return cal;
            } catch (ParseException e) {
                throw new RuntimeException(e);
            }
        }
    }
    

    Add to POM

    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jaxrs</artifactId>
        <version>2.3.3.Final</version>
        <scope>provided</scope>
    </dependency>
    
    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-multipart-provider</artifactId>
        <version>2.3.4.Final</version>
        <exclusions>
            <exclusion>
                <artifactId>resteasy-jaxrs</artifactId>
                <groupId>org.jboss.resteasy</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    

    Change the method signature to use the annotation

    @POST
    @Path("/MyPath")
    @Produces("text/xml")
    @RolesAllowed({"user"})
    public Output myMethod(@QueryParam("itemId") long ItemId,            
            @QueryParam("plannedstartdate") @CalendarFormat("MM-dd-yyyy") Calendar plannedStartDate, 
            @QueryParam("plannedreturndate") @CalendarFormat("MM-dd-yyyy") Calendar plannedReturnDate)
    

    That’s it.

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

Sidebar

Related Questions

Okay so here is the deal. As the question states, I'm trying to POST
I am trying to get some form data from POST method. Here's the code
I'm trying to do a cross domain ajax post request within ie. Here is
This is my first post here so go easy. I am trying to build
I'm not sure whether to post it here or at ServerFault. Anyway, I'm trying
I am trying to create a singleton User class in my app, here's the
I'm trying to post images to Twitter using the Oauth module. Here is what
Beginner here trying to get a pipeline working in bash. If somebody can see
I am going nuts here trying to resolve a cascading update/delete issue :-) I
I'm pulling my hair out here trying to get CSS to position only a

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.