天道酬勤,学无止境

jetty-9

Is Jetty HttpClient(9.3.8.v20160314) thread-safe and can be used repeatedly?

问题 现在我为每个请求创建一个org.eclipse.jetty.client.HttpClient 。 这些请求是无状态的和 RESTful 的。 在调用start()方法后,我可以对所有并行请求只使用一个HttpClient吗? 一个HttpClient对象有很多字段,这种策略能提高性能并节省内存吗?

2022-05-13 11:25:20    分类:技术分享    multithreading   jetty   jetty-9

Jetty 11 Doesn't Detect Servlets

I have an example project here that uses Jetty to deploy a local server. I use the mvn package exec:java command to run a local server, and it works fine. It loads HTML files, as well as content from servlets. Here are the pertinent files: pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>io.happycoding</groupId> <artifactId>app-engine-hello-world</artifactId> <version>1</version>

2022-05-02 00:11:25    分类:问答    java   maven   servlets   jetty   jetty-9

Jetty and max content size

I use Jetty 9.4.8 and i want limits the amount of data that can post to the server. For that i added to jetty.xml: <Call name="setAttribute"> <Arg>org.eclipse.jetty.server.Request.maxFormContentSize</Arg> <Arg>10000</Arg> </Call> I tested jetty like (request-xxlarge.xml - text file(20mb)): curl -X POST --data @request-xxlarge.xml http://localhost:8080/test -v As a result i got * Trying 127.0.0.1... * Connected to localhost (127.0.0.1) port 8080 (#0) > POST /test HTTP/1.1 > Host: localhost:8080 > User-Agent: curl/7.47.0 > Accept: */* > Content-Length: 21232818 > Content-Type: application/x-www

2022-04-27 08:46:52    分类:问答    jetty   jetty-9

Is Jetty HttpClient(9.3.8.v20160314) thread-safe and can be used repeatedly?

Now I create an org.eclipse.jetty.client.HttpClient per request. These requests are stateless and RESTful. Can I use only one HttpClient for all requests which are in parallel, after I invoke its start() method? An HttpClient object has lots of fields, can this strategy improve performance and save the memory?

2022-04-27 08:17:17    分类:问答    multithreading   jetty   jetty-9

jetty 404 error page on hot deployment

I am currently using Jetty 9.1.4 on Windows. When I deploy the war file without hot deployment config, and then restart the Jetty service. During that 5-10 seconds starting process, all client connections to my Jetty server are waiting for the server to finish loading. Then clients will be able to view the contents. Now with hot deployment config on, the default Jetty 404 error page shows within that 5-10 second loading interval. Is there anyway I can make the hot deployment has the same behavior as the complete restart - clients connections will wait instead seeing the 404 error page ?

2022-03-23 00:38:33    分类:问答    jetty   jetty-9

Unstable behavior with Jackson Json and @JsonAnySetter

I am working on a Java web project using Jackson for Json serialization and deserializtion. I am using Jetty as a web server I am trying to deserialize a generated class at build time: /** *Generated class at compile time **/ @JsonInclude(NON_NULL) public class SamplePayloadContent extends AbstractSamplePayload { @NotNull @JsonProperty(value = "sampleProperty", required = true) private String sampleProperty; ... } I am using AbstractSamplePayload to add propeties to the generated class, AbstractSamplePayload: public abstract class AbstractSamplePayload implements Serializable { protected final

2022-03-15 12:27:38    分类:问答    java   jackson   jetty-9

How to pass user context object to the response callback of async Jetty HTTP client?

When sending notifications to single recipients over Google Firebase Cloud Messaging, sometimes a response comes back (200 + error:MissingRegistration, 200 + error:InvalidRegistration, 200 + error:NotRegistered), which requires deleting the token of that recipient (because she for example reinstalled the Android app and the token has changed). My question is: How to pass that string (the FCM token) back to the response callback of the non-blocking Jetty HTTP client? Currently my workaround is to add a custom HTTP header to my request: X-token: APA91bHun4MxP5egoKMwt2KZFBaFUH-1RYqx... and then I

2022-02-16 11:24:04    分类:问答    callback   google-cloud-messaging   jetty   firebase-cloud-messaging   jetty-9