I am getting search string like this in my application.
@GET
@Path("/{search:.*}")
public SomeResponse getSomeThing(@PathParam("search")
String searchString, @PathParam("search")
List<PathSegment> searchList);
Below is implementation of above method.This method puts all the search
parameters (key-values) in a HashMap and I will use them later for my app. You
have *searchString* also there as first parameter. Hope, this may help you.
public SomeResponse getSomeThing(String searchString,
List<PathSegment> searchList) {
SomeResponse response = null;
response.getSource();
String pathElementName = null;
String pathElementValue = null;
HashMap<String, String> map = new HashMap<String,
String>();
int i = 0;
for (PathSegment segment : searchList) {
if (i % 2 == 0) {
pathElementName = segment.getPath();
} else {
pathElementValue = segment.getPath();
}
if (pathElementName != null && pathElementValue
!= null) {
map.put(pathElementName,
pathElementValue);
}
i++;
}
Iterator<String> keys = map.keySet().iterator();
while (keys.hasNext()) {
String key = keys.next();
log.info(key + "::" + map.get(key));
}
......
......
......
return response;
}
Regards
Karuna Pydipati
StubHub/eBay - Platform & Services
Phone: (415)222-8752
Email: [email protected]
-----Original Message-----
From: James Carr [mailto:[email protected]]
Sent: Tuesday, December 15, 2009 5:15 PM
To: [email protected]
Subject: Re: full query string
Hi All,
What's a good way to use CXF to generate an ObjectMessage? I want to drop
something like this on a topic:
message.setStringProperty("foo", "1234"); message.setStringProperty("bar,
"blahBlah");
Thanks,
James
On Tue, Dec 15, 2009 at 2:29 PM, John Klassa <[email protected]> wrote:
>
> How would I obtain the full query string, via annotations (in a JAX-RS
> setting)?
>
> I have a resource of the form:
>
> /search?CRITERIA-GOES-HERE
>
> (The criteria is in a domain-specific language.)
>
> I don't really want to clutter this up to be:
>
> /search?query=CRITERIA-GOES-HERE
>
> Rather, I'd like to just pick up the whole query string, and use it.
>
> Can this be done? The docs have examples of pulling out query parameters by
> name, but I don't really have a name here -- I just want the whole string.
>
> Thanks!
>
>