Hello,
After cloning spray template and adding a directive, I tried the
following:
--------------------
telnet ipaddress port
GET /getSomething HTTP/1.0
(on purpose I am going for an error here) in reply I get:
HTTP/1.1 404 Not Found
Content-Type: text/plain
Content-Length: 57
Server: Jetty(8.0.3.v20111011)
Request is missing required query parameter 'userId'Connection closed
by foreign host.
--------------------
Some say this is not good: much too much information is replied and
returning server version is potentially dangerous. So I got along to
try and change things.
Long story is below, short story is how to make this reply as concise
as possible and not reveal all the information like server name...?
Thanks a lot,
Joe
Long story:
For configurying Jetty it seems (
https://github.com/siasia/xsbt-web-
plugin/wiki) one should add to the spray-template a build.sbt file
(Build.scala and build.sbt add up according to (
https://github.com/
harrah/xsbt/wiki/Getting-Started-Full-Def) with the following content:
customConfiguration in container.Configuration := true
configurationFiles in container.Configuration := Seq(file("./src/main/
webapp/WEB-INF/jetty.xml"))
So now in my WEB-INF folder I have jetty.xml file and a web.xml file.
Then according to (
http://attenuated-perspicacity.blogspot.com/2009/09/
jetty-61x-hardening.html) one can edit the jetty.xml by adding:
<Set name="sendServerVersion">false</Set>
Then saddly it says:
----------
telnet ipaddress port
GET /getSomething HTTP/1.0
HTTP ERROR: 404
Problem accessing /. Reason: Servlet Not Initialized
---------
So it seems it reads the jetty.xml file but it doesn't understand how
to get the servlet started. My handler in jetty looks like.
<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 id="SprayHandler"
class="org.eclipse.jetty.servlet.ServletContextHandler">
<Set name="contextPath">/</Set>
<Call name="addServlet">
<Arg>cc.spray.connectors.Jetty7ConnectorServlet</Arg>
<Arg>/*</Arg>
</Call>
</New>
</Item>
<Item>
<New id="DefaultHandler"
class="org.eclipse.jetty.server.handler.DefaultHandler"/>
</Item>
</Array>
</Set>
</New>
</Set>
Although this must seem fairly obvious I am very new to this jetty
mumbo jumbo.
Any hint/help very much appreciated,
Thanks,
Joe