[ https://issues.apache.org/jira/browse/CXF-2666?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12831927#action_12831927 ]
Sergey Beryozkin commented on CXF-2666: --------------------------------------- Please see https://jsr311.dev.java.net/servlets/ReadMsg?listName=users&msgNo=189 Now, what you can do to get the default value in a method if no value is set, is to override a Message.QUERY_STRING in a request filter, ex : @Context UriInfo ui; void Response handleRequest(ClassresourceInfo cri, Message m) { StringBuilder sb = new StringBuilder(); for (Map.Entry<String, List<String>> entry : ui.getQueryParameters().entrySet()) { String queryName = entry.getKey(); List<String> queryValues = entry.getValue(); for (String value : queryValues) { sb.append(queryName + "="); sb.append(value.length() == 0 ? "-1" : value); } } message.put(Message.QUERY_STRING, sb.toString()); } alternatively create a bean class : public class QueryBean { private Strring id = "-1"; public void setId(String idValue) { if (!"".equals(idValue)) { id = idValue; } } and use QueryParam("") QueryBean } > @QueryParam @DefaultValue does not return default value > -------------------------------------------------------- > > Key: CXF-2666 > URL: https://issues.apache.org/jira/browse/CXF-2666 > Project: CXF > Issue Type: Bug > Components: JAX-RS > Affects Versions: 2.2.5, 2.2.6 > Environment: mac OSX, jdk 1.6 > Reporter: michael Cheung > Attachments: InjectionUtils.java > > > When doing a HTTP GET /getFoo?id= to the resource below, the default value > does not override the query parameter. > @GET > @Path("/getFoo") > public Response getFoo(@QueryParam("id") @DefaultValue("-1") String gameId) > -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.