Hi
On 20/10/11 15:20, Woonsan Ko wrote:
Hi,
Is it possible to change (configure) the "_type" parameter [1] name to
something else?
I want to use (or allow) a different name such as "fmt" instead.
We've been following the convention that so called system queries should
start from '_' for them not to interfere with application queries such
'type', 'format', etc
Or is there any way to customize this?
Probably the simplest way at the moment is to register custom CXF in
interceptor which will replace 'fmt' with '_type', for example:
public class UpdateQueryInterceptor extends
AbstractPhaseInterceptor<Message> {
public UpdateQueryInterceptor() {
super(Phase.UNMARSHAL);
}
public void handleMessage(Message message) {
String query = (String)message.get(Message.QUERY_STRING);
int index = query.indexOf("fmt=");
if (index != -1) {
String newQuery;
if (index > 0) {
newQuery = query.substring(0, index);
}
newQuery += "_type";
newQuery += query.substring(index + 3);
message.put(Message.QUERY_STRING, newQuery);
}
}
}
etc...
and register it within jaxrs:inInterceptors
HTH, Sergey
Thanks!
Woonsan
[1] http://cxf.apache.org/docs/jax-rs.html