m0rv4i
m0rv4i

Reputation: 435

Add/Edit request parameter to Jetty request

I am interfacing some legacy code with a new system and I have to edit a HTTP request.

I am using Jetty to launch an embedded webserver from our application and have wrapped our webapp with the a org.eclipse.jetty.rewrite.handler.RewriteHandler class.

I can successfully manipulate the URI but I cannot find a way to edit the request parameters. I tried wrapping the request in javax.servlet.http.HttpServletRequestWrapper and overriding the getParameters() method as per this thread:

Modify request parameter with servlet filter

However this did not work as Jetty casts the request object at some point and it fails.

Does anyone know of a solution?

Thanks in advance.

Rob

Upvotes: 1

Views: 1187

Answers (1)

m0rv4i
m0rv4i

Reputation: 435

I ended up retrieving the necessary data from the javax.servlet.http.HttpServletRequest object and then building the required URL with the edited parameters etc, then calling

response.sendRedirect(newUrl);

on the javax.servlet.http.HttpServletResponse which worked perfectly.

Upvotes: 1

Related Questions