[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[jetty-users] embedded jetty server - problems retrieving static resources
|
Hi,
I have an application that embeds a jetty server inside it (latest
version 8.1.2, though I had the same behaviour in 8.0). The web
application that gets loaded in the server is a spring based web
application.
A problem that appears anytime i wish (and with any browser) is that
some static resources do not get loaded (the browser waits for it,
blocking the loading of the page itself). Which static resource blocks
the loading of the page is random every time.
I tried serving the static resources via spring with <mvc:resources
mapping="/js/**" location="/WEB-INF/resources/js/"/>, still the same
behaviour.
Now, i'm just serving them with jetty alone.
While the page loading block appears more often with Chrome, it can be
easily triggered with Firefox by simply doing a Ctrl+R after the home
page loaded for the first time. Just by clicking on the links from
within the page doesn't trigger the block in Firefox.
I am thinking that I probably am not configuring the jetty server
properly, therefore I would appreciate any help i can get.
The full code of the server setup class is pasted on pastebin:
http://pastebin.com/Pi9q4Dge .
Here are the relevant portions of the code:
AbstractConnector connector = new SelectChannelConnector();
connector.setHost(options.getHost());//localhost
connector.setPort(options.getPort()); //8080
connector.setThreadPool(new
QueuedThreadPool(options.getMaxThreads()));//254 max threads
connector.setMaxIdleTime(options.getMaxIdleTime());//30000
WebAppContext context = new WebAppContext(getClass().getResource(
"/com/zergiu/tvman/web").toExternalForm(), "/"); //the
entire website is under the com.zergiu.tvman.web package.
context.setConfigurationClasses(new String[] {
"org.eclipse.jetty.webapp.WebInfConfiguration",
"org.eclipse.jetty.webapp.WebXmlConfiguration",
"org.eclipse.jetty.plus.webapp.EnvConfiguration" });
context.setExtractWAR(false);
server.setHandler(context);
server.start();
server.join();
If more information is needed, please let me know.
Thank you for the help,
Sergiu.