Mikhail
Mikhail

Reputation: 769

Jetty. How to set defaultUseCaches to false without xml file

I'm getting the exception:

java.lang.IllegalStateException: zip file closed

The solution is found - set in jetty.xml:

<Set class="org.eclipse.jetty.util.resource.Resource"
     name="defaultUseCaches">false</Set>

Can I set this option without any xml file, in embedded way? Maybe like I'm setting init parameters: context.setInitParameter(...)

Upvotes: 0

Views: 524

Answers (1)

Andrew
Andrew

Reputation: 1618

Looking at Jetty 9.2, __defaultUseCaches is a public static field of Resource and it has accessor methods, so you can simply do:

Resource.setDefaultUseCaches(true)

Upvotes: 1

Related Questions