Here is the code:
SslContextFactory ssl = new SslContextFactory();
ssl.setKeyStorePath(getKeyStorePath());
ssl.setKeyStoreType("JKS");
ssl.setKeyStorePassword("password");
ssl.setKeyManagerPassword("password");
HttpConfiguration https = new HttpConfiguration();
https.addCustomizer(new SecureRequestCustomizer());
server = new Server();
ServerConnector connector = new ServerConnector(server, new
SslConnectionFactory(ssl, HttpVersion.HTTP_1_1.toString()), new
HttpConnectionFactory(https));
connector.setPort(8180);
connector.setIdleTimeout(500000);
server.setConnectors(new Connector[]{connector});
HashSessionManager session_manager = new HashSessionManager();
session_manager.setMaxInactiveInterval(3600);
SessionHandler session_handler = new
SessionHandler(session_manager);
ServletContextHandler context = new
ServletContextHandler(ServletContextHandler.SESSIONS);
context.setHandler(session_handler);
context.addFilter(new FilterHolder(SessionFilter.class), "/*",
EnumSet.of(DispatcherType.INCLUDE, DispatcherType.REQUEST));
context.addServlet(AppServlet.class, "/Echo");
ServletContextHandler context_static = new ServletContextHandler();
context_static.setContextPath("/static");
context_static.setResourceBase(System.getProperty("user.dir") +
File.separator + "static" + File.separator);
context_static.addServlet(DefaultServlet.class, "/");
ContextHandlerCollection contexts = new ContextHandlerCollection();
contexts.setHandlers(new Handler[]{context, context_static});
server.setHandler(contexts);
From: [email protected] [mailto:[email protected]]
On Behalf Of Joakim Erdfelt
Sent: Friday, August 14, 2015 9:12 AM
To: JETTY user mailing list
Subject: Re: [jetty-users] Migrating from jetty-9.2.11.v20150529-all.jar to
jetty-9.3.2.v20150730-uber.jar results in a HTTP Error 404
You configuration ...
[main] INFO org.eclipse.jetty.server.handler.ContextHandler - Started
o.e.j.s.ServletContextHandler@7e7d6175{/,null,AVAILABLE}
[main] INFO org.eclipse.jetty.server.handler.ContextHandler - Started
o.e.j.s.ServletContextHandler@6da5cb1{/static,file:///static/,AVAILABLE}
smells of over-engineering and lack of understanding of how
ServletContextHandler + DefaultServlet works.
lets see your code.
if your ServletContextHandler on context Path "/" has servlets, they can ALSO
have any number of arbitrary static resource configurations serving content
from multiple directories on multiple url patterns, all using DefaultServlet.
However, in your setup, any content that enters "/" will terminate on its own
if you don't have it configured properly (all ServletContext's terminate, they
don't fall through).
Joakim Erdfelt / [email protected]<mailto:[email protected]>
On Fri, Aug 14, 2015 at 6:08 AM, Joakim Erdfelt
<[email protected]<mailto:[email protected]>> wrote:
Lets see your embedded-jetty Server / handler / ServletContextHandler setup
code.
Joakim Erdfelt / [email protected]<mailto:[email protected]>
On Fri, Aug 14, 2015 at 5:41 AM, Bryan Coleman
<[email protected]<mailto:[email protected]>> wrote:
I did see it and got the impression the uber jar fixed some of the issues with
the all jar.
That said, I have changed course and am now using individual jars. The
following jars appear to provide me what is needed: servlet, server, util,
http, io and security.
The problem is I am still seeing the same results with exception to the log
message that shows the jetty version as 3.2.v20150730 instead of the SNAPSHOT.
Any ideas?
From: [email protected]<mailto:[email protected]>
[mailto:[email protected]<mailto:[email protected]>]
On Behalf Of Jan Bartel
Sent: Thursday, August 13, 2015 7:49 PM
To: JETTY user mailing list
Subject: Re: [jetty-users] Migrating from jetty-9.2.11.v20150529-all.jar to
jetty-9.3.2.v20150730-uber.jar results in a HTTP Error 404
Bryan,
Did you see this recent thread on this list?
https://dev.eclipse.org/mhonarc/lists/jetty-users/msg06029.html
Jan
On 14 August 2015 at 06:13, Bryan Coleman
<[email protected]<mailto:[email protected]>> wrote:
I am working to migrate our system to use the latest uber jar and am now
receiving a 404 when trying to access a custom Servlet. The static content
remains usable.
Currently, we are using the jetty-9.2.11.v20150529-all.jar and things are
working properly.
I am not seeing any errors in the log.
Log for 9.2.11:
[main] INFO org.eclipse.jetty.server.Server - jetty-9.2.11.v20150529
[main] INFO org.eclipse.jetty.server.handler.ContextHandler - Started
o.e.j.s.ServletContextHandler@7a461744{/,null,AVAILABLE}<mailto:o.e.j.s.ServletContextHandler@7a461744%7b/,null,AVAILABLE%7d>
[main] INFO org.eclipse.jetty.server.handler.ContextHandler - Started
o.e.j.s.ServletContextHandler@6b1cc2fb{/static,file:///static/,AVAILABLE}<mailto:o.e.j.s.ServletContextHandler@6b1cc2fb%7b/static,file:///static/,AVAILABLE%7d>
[main] INFO org.eclipse.jetty.server.ServerConnector - Started
ServerConnector@15ffb1ba{SSL-HTTP/1.1}{0.0.0.0:8180<http://0.0.0.0:8180>}
[main] INFO org.eclipse.jetty.server.Server - Started @74224ms
Log for 9.3.2:
[main] INFO org.eclipse.jetty.server.Server - jetty-9.3.z-SNAPSHOT
[main] INFO org.eclipse.jetty.server.handler.ContextHandler - Started
o.e.j.s.ServletContextHandler@7e7d6175{/,null,AVAILABLE}<mailto:o.e.j.s.ServletContextHandler@7e7d6175%7b/,null,AVAILABLE%7d>
[main] INFO org.eclipse.jetty.server.handler.ContextHandler - Started
o.e.j.s.ServletContextHandler@6da5cb1{/static,file:///static/,AVAILABLE}<mailto:o.e.j.s.ServletContextHandler@6da5cb1%7b/static,file:///static/,AVAILABLE%7d>
[main] INFO org.eclipse.jetty.util.ssl.SslContextFactory -
x509={hostname.domain.com<http://hostname.domain.com>=1, hostname=1} wild={}
alias=null for
SslContextFactory@5713e261(file:///simple.keystore,null)<mailto:SslContextFactory@5713e261(file:///simple.keystore,null)>
[main] INFO org.eclipse.jetty.server.ServerConnector - Started
ServerConnector@1c71d704{SSL,[ssl, http/1.1]}{0.0.0.0:8180<http://0.0.0.0:8180>}
[main] INFO org.eclipse.jetty.server.Server - Started @79112ms
Other facts:
Using jdk-1.8.0_51
Client is IE 10
Also, curious why the uber jar is logging the version as 9.3.z-SNAPSHOT?
Any ideas would be greatly appreciated.
Thank You,
Bryan
_______________________________________________
jetty-users mailing list
[email protected]<mailto:[email protected]>
To change your delivery options, retrieve your password, or unsubscribe from
this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users
_______________________________________________
jetty-users mailing list
[email protected]<mailto:[email protected]>
To change your delivery options, retrieve your password, or unsubscribe from
this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users
_______________________________________________
jetty-users mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from
this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users