当前位置: 首页>>代码示例>>Java>>正文


Java GenericServlet.service方法代码示例

本文整理汇总了Java中javax.servlet.GenericServlet.service方法的典型用法代码示例。如果您正苦于以下问题:Java GenericServlet.service方法的具体用法?Java GenericServlet.service怎么用?Java GenericServlet.service使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.servlet.GenericServlet的用法示例。


在下文中一共展示了GenericServlet.service方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleJSP

import javax.servlet.GenericServlet; //导入方法依赖的package包/类
/**
 * Handles a request for a JSP page. It checks to see if a servlet is mapped
 * for the JSP URL. If one is found, request handling is passed to it. If no
 * servlet is found, a 404 error is returned.
 *
 * @param pathInfo the extra path info.
 * @param request  the request object.
 * @param response the response object.
 * @throws ServletException if a servlet exception occurs while handling the request.
 * @throws IOException      if an IOException occurs while handling the request.
 */
private void handleJSP(String pathInfo, HttpServletRequest request,
                       HttpServletResponse response) throws ServletException, IOException {
    // Strip the starting "/" from the path to find the JSP URL.
    String jspURL = pathInfo.substring(1);

    GenericServlet servlet = servlets.get(jspURL);
    if (servlet != null) {
        servlet.service(request, response);
    }
    else {
        response.setStatus(HttpServletResponse.SC_NOT_FOUND);
    }
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:25,代码来源:PluginServlet.java

示例2: handleServlet

import javax.servlet.GenericServlet; //导入方法依赖的package包/类
/**
 * Handles a request for a Servlet. If one is found, request handling is passed to it.
 * If no servlet is found, a 404 error is returned.
 *
 * @param pathInfo the extra path info.
 * @param request  the request object.
 * @param response the response object.
 * @throws ServletException if a servlet exception occurs while handling the request.
 * @throws IOException      if an IOException occurs while handling the request.
 */
private void handleServlet(String pathInfo, HttpServletRequest request,
                           HttpServletResponse response) throws ServletException, IOException {
    // Strip the starting "/" from the path to find the JSP URL.
    GenericServlet servlet = getServlet(pathInfo);
    if (servlet != null) {
        servlet.service(request, response);
    }
    else {
        response.setStatus(HttpServletResponse.SC_NOT_FOUND);
    }
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:22,代码来源:PluginServlet.java


注:本文中的javax.servlet.GenericServlet.service方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。