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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:14:49+00:00 2026-06-03T21:14:49+00:00

While using a Root- and SubResource in Jersey I annotated the RootResource like this

  • 0

While using a Root- and SubResource in Jersey I annotated the RootResource like this to receive the form parameter param1.

@Path("some/path")
public SubResource doSomething(@FormParam("param1") String param1) {
...
}

Everything worked as I expected it to be, but, when the parameter is not given than jersey will return an internal error status code (500). In general I would say that this should be something like a bad request (400) or so.

What I then tried to do is, I added a MultivaluedMap<String, String> form into the parameter list (See: Jersey User Guide Example 2.19)

@Path("some/path")
public SubResource doSomething(MultivaluedMap<String, String> form) {
...
}

In this case I should be able to handle the form parameters for myself, but form did not get populated. Probably because of the missing @POST annotation.

My Question: Do you know a way, besides handling a HttpServletRequest which I find frustrating, so that I get my post parameters?

Thanks for your help…

  • 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-03T21:14:50+00:00Added an answer on June 3, 2026 at 9:14 pm

    I’m not entirely sure what you are trying to accomplish, but none of your examples seem valid to me. Since you are trying to pass processing onto a sub-resource you really should be dealing with the parameters there, instead of in the root resource. Heres an example:

    @Path("/root/path")
    public class RootResource {
        @Path("/sub/path")
        public SubResource doSomething() {
           // return an instance of your sub resource
        }
    }
    
    @Produces(MediaType.TEXT_XML, MediaType.APPLICATION_JSON)
    public class SubResource {
        @GET
        @Path("/")
        public Collection<SomeBean> getAll() {}
    
        @GET
        @Path("/{id}
        public SomeBean getSingle() {}
    
        @POST
        @Path("/")
        @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
        public SomeBean reallyDoSomething(@FormParam("param1") final String param) {
           // do ... something
        }
    }
    

    EDIT

    If you need access to form parameters in order to initialize your sub resource then access them via the HTTP servlet request:

    public class RootResource {
        @Context
        private HttpServletRequest request;
    
        @Path("/sub/path")
        public SubResource doSomething() {
            final Map<String, String> params = request.getParameterMap();
            // process the parameters 
            // return an instance of your sub resource
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While using the vector why do we sometime use the operator[] like homework[mid] but
while using the following constructor $this->pdo = new PDO ($this->source, $this->username, $this->password); if I
While using this code to serialize an object: public object Clone() { var serializer
i would like to have a multiple directory view while using QDirModel and qtreeview
I'm trying to get to this result while serializing XML: <Root Name=blah> <SomeKey>Eldad</SomeKey> <Element>1</Element>
While using regex to help solve a problem in the Python Challenge , I
While using Aptana and Eclipse for the first time in my programming life for
While using fixed width select tag , there is one bug in IE. When
while using g.drawImage(img,0,0,100,100,0,0,0,0,null) it does not produce any result. So how to draw on
while using beautifulsoup to parse a table in html every other row starts with

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.