java - Jetty.xml access static content -
i'm trying access static content on server war deployed using jetty.xml configuration. used resourcehandler, worked can't access website content anymore. tried adding defaulthandler still can't access content on "/". have add specific handler other requests?
here's jetty.xml:
<?xml version="1.0"?> <!doctype configure public "-//jetty//configure//en" "http://www.eclipse.org/jetty/configure.dtd"> <configure id="server" class="org.eclipse.jetty.server.server"> <set name="threadpool"> <new class="org.eclipse.jetty.util.thread.queuedthreadpool"> <set name="minthreads">10</set> <set name="maxthreads">200</set> <set name="detaileddump">false</set> </new> </set> <new id="sslcontextfactory" class="org.eclipse.jetty.http.ssl.sslcontextfactory"> <set name="keystore"><property name="jetty.home" default="." />//etc/mykeystore.keystore</set> <set name="keystorepassword">xxxxxxx</set> <set name="keymanagerpassword">xxxxxxxx</set> </new> <call name="addconnector"> <arg> <new class="org.eclipse.jetty.server.ssl.sslselectchannelconnector"> <arg><ref id="sslcontextfactory" /></arg> <set name="port">443</set> <set name="maxidletime">30000</set> <set name="acceptors">2</set> <set name="acceptqueuesize">100</set> </new> </arg> </call> <set name="handler"> <new id="handlers" class="org.eclipse.jetty.server.handler.handlercollection"> <set name="handlers"> <array type="org.eclipse.jetty.server.handler"> <item> <new class="org.eclipse.jetty.server.handler.contexthandler"> <set name="contextpath">/img</set> <set name="handler"> <new class="org.eclipse.jetty.server.handler.resourcehandler"> <set name="directorieslisted">false</set> <set name="resourcebase">/home/img</set> </new> </set> </new> </item> </array> </set> </new> </set> </configure>
with jetty 9, make directory in ${jetty.base}/webapps/
, put content there.
for example, if created
${jetty.base}/webapps/static/css/main.css
then served /static/
context, making following valid access content.
http://localhost:8080/static/css/main.css
this known static resource deployment, , part of default deployment techniques present on jetty's default deployment configuration.
you can use context deployable xml declare arbitrary static content want, in location on disk want.
see: https://www.eclipse.org/jetty/documentation/current/static-content-deployment.html
Comments
Post a Comment