将请求参数传递给ResourceHandler

时间:2018-03-08 16:21:55

标签: servlets jetty

我有一个ServletContextHandler:

public class MyHandler extends ServletContextHandler {

  public MyHandler() throws URISyntaxException, MalformedURLException {
    setContextPath("/path");        

    ResourceHandler resourceHandler = new ResourceHandler();
    resourceHandler.setDirectoriesListed(true);
    resourceHandler.setWelcomeFiles(new String[]{ "index.jsp" });

    URL resource = SwiftSocialMessenger.class.getClassLoader().getResource("resource");

    resourceHandler.setBaseResource(Resource.newResource(resource.toURI().normalize()));

    HandlerList handlers = new HandlerList();

    handlers.setHandlers(new Handler[] { resourceHandler });
    this.setHandler(handlers);
}

}

我需要index.jsp页面中的请求参数,例如:

<html>
  .....
 <body>
   <span title=<%= request.getParameter("param") %> </span>
 </body>
<html>

是否可以使用资源处理程序获取请求参数?

0 个答案:

没有答案