-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jetty12 migration help #12158
Comments
@johmn123-wq thanks, we are updating the documentation. I'll point you to the PR with the updated documentation, rather than duplicating the answers here. |
Updated documentation with section about migration of Handler code from Jetty 11 to Jetty 12. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@johmn123-wq please see #12160. Let us know if there is something missing, and we will expand. |
Specific to your example, you can replace:
with
Also consider using You do not need to call At the end of the The last missing piece is that you must complete the IIUC, your code also seems wrong as it calls In any case, your code looks like a proxy, so consider using Jetty's If you really want to do it on your own, when you receive the response from the external server you contacted with the client, you now have:
change it to be:
where the last parameter |
@sbordet public class ApacheServerHandler extends Handler.Abstract{ private ApacheServerHandler(){ @OverRide String newHost = request.getHeaders().get('sb_host'); HttpUriRequest = null; String newUrl = String.format("http://%s%s", newHost, path, queryString); if(HttpMethod.GET.matches(method)){ if(uriRequest instanceof HttpEntityEncloseingRequest){ while(headers.hasMoreElements()){
} Can you please provide the alternative of this block of code 'response.add(header.getName(), header.getValue())' adding each of these headers to a new HTTP response. HttpEntityEnclosingRequest entityRequest = (HttpEntityEnclosingRequest) uriRequest; Need you assistance here. |
I already pointed you to use |
Jetty version(s)
migration from Jetty 11.0.x to Jetty 12.0.x
Jetty Environment
Applicable for jetty-12 ee10
Java version/vendor
(use: java -version)
Java17
OS type/version
Description
Here is the code for 11.0.x
Here is the migrated code to jetty12 where getOutStream, setHandled, response.add() etc functions are not supported.
The text was updated successfully, but these errors were encountered: