为Servlet添加支持REST式URL ServletREST

码农软件 · 软件分类 · REST/RESTful项目 · 2019-03-11 13:12:11

软件介绍

为Servlet添加支持REST式URL: 不改变习惯,仅仅在servlet内部完成doGet, doPost,doDelete,doPut等方法即可映射到较为复杂的REST URL

eg:

/book/head first java/
对应的URL表达式为:
/book/*/

/book/head first java/chapter/1
对应的URL表达式为:
/book/*/
chapter/*

您所要做的: 仅仅需要在web.xml中配置一个filter 仅仅需要在集成HttpServlet添加一个注解(eg:@RestSupport("/book/*/chapter/*"))

下面附加一个使用示范:

@RestSupport("/book/*/chapter/*")
public class ChapterServlet extends HttpServlet {
       
private static final long serialVersionUID = -1534235656L;

       
protected void doGet(HttpServletRequest request,
                       
HttpServletResponse response) throws ServletException, IOException {
               
// code here ...
       
}

       
protected void doPost(HttpServletRequest request,
                       
HttpServletResponse response) throws ServletException, IOException {
               
// code here ...
       
}

       
protected void doPut(HttpServletRequest request,
                       
HttpServletResponse response) throws ServletException, IOException {
               
// code here ...
       
}

       
protected void doDelete(HttpServletRequest request,
                       
HttpServletResponse response) throws ServletException, IOException {
               
// code here ...
       
}
}

本文地址:https://codercto.com/soft/d/1110.html

机器学习系统设计

机器学习系统设计

[德] Willi Richert、Luis Pedro Coelho / 刘峰 / 人民邮电出版社 / 2014-7-1 / CNY 49.00

如今,机器学习正在互联网上下掀起热潮,而Python则是非常适合开发机器学习系统的一门优秀语言。作为动态语言,它支持快速探索和实验,并且针对Python的机器学习算法库的数量也与日俱增。本书最大的特色,就是结合实例分析教会读者如何通过机器学习解决实际问题。 本书将向读者展示如何从原始数据中发现模式,首先从Python与机器学习的关系讲起,再介绍一些库,然后就开始基于数据集进行比较正式的项目开......一起来看看 《机器学习系统设计》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

URL 编码/解码
URL 编码/解码

URL 编码/解码

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具