Hi, I'm want to know whether the lack of support for query parameters is still valid and how to address the issue otherwise.
Background: I've inherited a project which uses Tapestry 5.1.0.5. The previous developers have implemented a URLRewriterRule similar to the examples in the guide. On inbound requests particular parameters are being picked up and on outbound requests some queryString is added to the path of a SimpleRequestWrapper like return new SimpleRequestWrapper(request, request.getPath()+"?someparameter=somevalue"); It works, which I find strange given that the Javadoc of Request.getPath() indicates that it shouldn't contain the query parameters. For a change in application I want to chain a couple of rules and make a clean implementation so I made the class ParametersDelegatingRequest which allows for adding parameters(see below). Conceptionally nice, but it doesn't work :( Any pointers on where I'm going wrong? Regards, Erwin public class ParametersDelegatingRequest extends DelegatingRequest { private Map<String, String[]> additionalParameters; /** * Constructs a DelegatingRequest in which parameters are added * * @param request * @param additionalParameters * Map with added parameters (Key= parameter name, value=parameter value (String[]) */ public ParametersDelegatingRequest(Request request, Map<String, String[]> additionalParameters) { super(request); if (additionalParameters == null) { throw new IllegalArgumentException("argument additionalParameters may not be null"); } this.additionalParameters = additionalParameters; } /* * (non-Javadoc) * * @see org.apache.tapestry5.services.DelegatingRequest#getParameter(java.lang.String) */ @Override public String getParameter(String name) { String[] value = additionalParameters.get(name); if (value != null && value.length > 0) { // array of Strings -> return the first value return value[0]; } else { // null -> just let the original request provide the value return super.getParameter(name); } } /* * (non-Javadoc) * * @see org.apache.tapestry5.services.DelegatingRequest#getParameterNames() */ @Override public List<String> getParameterNames() { // we don't want double names, so merge the sets first before returning it as a list Set<String> parameterNames = new TreeSet<String>(); parameterNames.addAll(additionalParameters.keySet()); parameterNames.addAll(super.getParameterNames()); return parameterNames.isEmpty()?null:new ArrayList<String>(parameterNames); } /* * (non-Javadoc) * * @see org.apache.tapestry5.services.DelegatingRequest#getParameters(java.lang.String) */ @Override public String[] getParameters(String name) { List<String> result = new ArrayList<String>(); // this parameters String[] values = additionalParameters.get(name); if (values != null) { result.addAll(Arrays.asList(values)); } // the delegated parameters values = super.getParameters(name); if (values != null) { result.addAll(Arrays.asList(values)); } return result.isEmpty()?null:result.toArray(new String[0]); } } -- View this message in context: http://tapestry.1045711.n5.nabble.com/t5-url-rewriting-and-query-parameter-part-tp2433834p4826472.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org