Skip to content
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

Missing jetty-servlet 12.0.0 dependency & Migrate HttpServlet to Handler #10322

Closed
eitan-rosenberg opened this issue Aug 16, 2023 · 4 comments
Closed
Labels

Comments

@eitan-rosenberg
Copy link

eitan-rosenberg commented Aug 16, 2023

I am migrating to Jetty 12.0.0

I use Jetty as embedded.

In previous release, I use dependency:

<dependency>
	<groupId>org.eclipse.jetty</groupId>
	<artifactId>jetty-servlet</artifactId>
	<version>11.0.15</version>
</dependency>

According to the documentation (https://eclipse.dev/jetty/documentation/jetty-12/programming-guide/index.html#pg-server-http-handler-use-servlet)

There is now:

<dependency>
	<groupId>org.eclipse.jetty</groupId>
	<artifactId>jetty-servlet</artifactId>
	<version>12.0.0</version>
</dependency>

However, there is no such dependency at https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-servlet/

Am I missing something ?

The HttpServlet that I have is used to upload files from a web browser.

I am trying to move from HttpServlet to Handler.Abstract do the upload, but I am not getting any Post data only GET

The HTML looks this:

<form method="post" action="[/myHandlerForUpload](view-source:http://localhost:8080/myHandlerForUpload)">
    <input type="file" name="myUploadFile" required><input type="submit" value="Upload selected file">
   </form></p>

Those are the HttpFields that I get:

GET
Host == localhost:8080
User-Agent == Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/116.0
Accept == text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language == en-US,en;q=0.5
Accept-Encoding == gzip, deflate, br
Referer == http://localhost:8080/
Connection == keep-alive
Upgrade-Insecure-Requests == 1
Sec-Fetch-Dest == document
Sec-Fetch-Mode == navigate
Sec-Fetch-Site == same-origin
Sec-Fetch-User == ?1

Again, am I missing something ?

Thanks for any response.

@eitan-rosenberg eitan-rosenberg added the Bug For general bugs on Jetty side label Aug 16, 2023
@sbordet
Copy link
Contributor

sbordet commented Aug 16, 2023

About Maven artifact changes, see: https://eclipse.dev/jetty/documentation/jetty-12/programming-guide/index.html#pg-migration-11-to-12-maven-artifacts

We will update the documentation to reported as wrong, sorry about that.

About migrating from Servlets to Handlers, see https://eclipse.dev/jetty/documentation/jetty-12/programming-guide/index.html#pg-migration-11-to-12-servlet-to-handler.
(This is currently an empty placeholder because there is a PR in review about that, see #10298, we will update the website today).

About the POST problem, I think you have a problem on the client side, as Jetty won't convert POST request to GET.
Or perhaps you are getting a GET request for some related resource (e.g. favicon)?

@eitan-rosenberg
Copy link
Author

Thanks for response and the info.

The client (Firefox) HTML was working fine with jakarta.servlet.http.HttpServlet version 11.0.15 version and was not changed.

I think that a full working sample of Handler doing file upload will help (and not just me...)

@eitan-rosenberg
Copy link
Author

Update...

After changing dependency to org.eclipse.jetty.ee9:jetty-ee9-servlet:12.0.0 the servlet is working and uploading files happily.
doPost method is called.

The HTML:
image

This is the same HTML that call the handler but with different action parameter value.

@joakime joakime added Question and removed Bug For general bugs on Jetty side labels Aug 16, 2023
@joakime
Copy link
Contributor

joakime commented Aug 16, 2023

Closing as OP reports it is working for them.

@joakime joakime closed this as completed Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants