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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:14:09+00:00 2026-05-27T02:14:09+00:00

We use Resteasy and have problems figuring how to call some @GET methods. If

  • 0

We use Resteasy and have problems figuring how to call some @GET methods.

If the interface for the method only has simple parameters, there is no problem. Ex:

@GET
@Path("/test/{myparam}")
public FacetQueryResultImpl testMethod(@PathParam("myparam")String myparam);

But if we try to use a POJO as the parameter, it seems RestEasy is not able to serialize it as querystring parameters. Ex:

@GET
@Path("/testGet")
public FacetQueryResultImpl testMethod(ParamPojo myparam);

or

@GET
@Path("/testGet")
public FacetQueryResultImpl testMethod(@QueryParam("myparam")ParamPojo myparam);

(with, ParamPojo.java:)

public class ParamPojo
{
    private String name;
    private String description;
    (...)
}

When we try this, sometimes the services are not found and sometimes we get a “A GET request cannot have a body.” exception.

Using @POST we are able to use a POJO has the parameter, but some of our methods don’t modify anything on the server, and therefore should use @GET.

A workaround is to “explode” the ParamPojo, and use all of its properties as separated parameters for the method. But this removes the “Easy” part of “RestEasy”, doesn’t it?

  • 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-27T02:14:10+00:00Added an answer on May 27, 2026 at 2:14 am

    You must use the @org.jboss.resteasy.annotations.Form annotation on your method parameter.
    http://docs.jboss.org/resteasy/docs/2.2.1.GA/userguide/html_single/#_Form

    Example:

    import javax.ws.rs.GET;
    import javax.ws.rs.Path;
    import javax.ws.rs.QueryParam;
    
    import junit.framework.Assert;
    
    import org.jboss.resteasy.annotations.Form;
    import org.jboss.resteasy.core.Dispatcher;
    import org.jboss.resteasy.mock.MockDispatcherFactory;
    import org.jboss.resteasy.mock.MockHttpRequest;
    import org.jboss.resteasy.mock.MockHttpResponse;
    import org.junit.Test;
    
    public class TestCase {
        @Path("/")
        public static class Service {
    
            @Path("")
            @GET
            public String get(@Form ValueObject vo){
                return vo.getParam();
            }
        }
    
        public static class ValueObject {
            @QueryParam("myparam")
            private String param;
    
            public String getParam() {
                return param;
            }
        }
    
        @Test
        public void test() throws Exception {
            Dispatcher dispatcher = MockDispatcherFactory.createDispatcher();
            dispatcher.getRegistry().addSingletonResource(new Service());
    
            MockHttpRequest request = MockHttpRequest.get("/?myparam=somevalue");
            MockHttpResponse response = new MockHttpResponse();
    
            dispatcher.invoke(request, response);
    
            Assert.assertEquals("somevalue", response.getContentAsString());
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the following simple RESTEasy (JAX-RS) service: @Path(/example-service) public interface ExampleService { @Path(/ping) @GET
I'm trying to use resteasy to serve out some entities fetched by spring-hibernate. I've
use javascript or other method ? have any recommendation?
I have been trying to figure out how to use JAX-RS for quite some
I'm trying to use RestEasy inside Equinox. The only document that I've seen on
I have a problem with development resteay+ejb+json. Using Jboss-5.1.0.GA. I get example from resteasy-jaxrs
use case is simple: I want to run some boiler plate code before each
Yesterday I tried to use the client side of the RestEasy framework. The interface
use LWP::Simple; use Parallel::ForkManager; @links=( [http://prdownloads.sourceforge.net/sweethome3d/SweetHome3D-2.1-windows.exe,SweetHome3D-2.1-windows.exe], [http://prdownloads.sourceforge.net/sweethome3d/SweetHome3D-2.1-macosx.dmg,SweetHome3D-2.1-macosx.dmg], [http://prdownloads.sourceforge.net/sweethome3d/SweetHome3DViewer-2.1.zip,SweetHome3DViewer-2.1.zip], ); # Max 30 processes for
Use case: I've just entered insert mode, and typed some text. Now I want

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.