Hi, thanks for that information - If you're going to see about adding an
"official" way to do it I'll wait until then - For the time being my
solution is this (in CFScript which is extremely similar to Java):
<cfscript>
// Get the Page Context
var pageContext = getPageContext();
// Get ServletRequest and ServletResponse Objects.
var req = pageContext.getRequest();
var res = pageContext.getResponse();
// Get the RequestDispatcher for the provided path.
var dis = req.getRequestDispatcher(arguments.path);
dis.forward(req, res);
</cfscript>
This works - However as mentioned before the file will be served through
whatever servlet is mapped to the file extension.
In my system, the data files have no extension at all, they are just
identifiers so therefore they will always go through DefaultServlet, however
I'm sure a servlet mapping could be created to serve all files below a
specific directory.
From: [email protected]
[mailto:[email protected]] On Behalf Of Greg Wilkins
Sent: June-17-13 7:07 PM
To: JETTY user mailing list
Subject: Re: [jetty-users] Jetty 9 as a Front-end Server
Shane,
hmmm there used to be a way... without wrapping the request, to do this, but
the only way I can see now is to do fake the headers for an include.... but
that will result in inefficient sending.
This use-case has come up from time to time, so I'll think about this and
add a way for it to be done. Can you open a bugzilla requesting this to
remind me.
However, the otherway to proceed is to use the jetty API's. In Jetty 9 the
fast asynchronous sending of content can be achieved by something like:
final AsyncContext async = request.startAsync();
((HttpOutput)response.getOutputStream()).sendContent(content,new Callback()
{
@Override
public void succeeded()
{
async.complete();
}
@Override
public void failed(Throwable x)
{
LOG.debug(x);
async.complete();
}
});
Content can be a ByteBuffer (in which case it can be file mapped) or it can
be an instanceof HttpContent, in which case it sets headers for you as well.
cheers
--
Greg Wilkins <[email protected]>
http://www.webtide.com
Developer advice and support from the Jetty & CometD experts.
Intalio, the modern way to build business applications.
_______________________________________________
jetty-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/jetty-users