[英]Creating server side methods for a Java servlet
I just went through the tutorial on writing a Java servlet using the example at: http://www.vogella.com/tutorials/EclipseWTP/article.html 我只是通过使用以下示例通过Java servlet编写了教程: http : //www.vogella.com/tutorials/EclipseWTP/article.html
What isn't clear to me is how developers implement methods inside this servlet that can be called by a client. 对我而言尚不清楚的是,开发人员如何在此Servlet中实现可由客户端调用的方法。 The doGet method is where the http request lands.
doGet方法是http请求到达的地方。 One way is to pass in a querystring, post body or header that contains information indicating a method to execute and then just create a class with methods to carry out based upon which method was indicated.
一种方法是传入包含指示要执行的方法的信息的查询字符串,帖子正文或标头,然后仅创建带有要根据指示的方法执行的方法的类。
Or is there a more "built-in" way that a Java servlet can wrap methods and method parameters in the client call? 还是Java servlet可以在客户端调用中包装方法和方法参数的“内置”方式?
implement methods inside this servlet that can be called by a client
: the client does not call the servlet method at all. implement methods inside this servlet that can be called by a client
端调用的方法:客户端根本不调用Servlet方法。 It is the server that routes
a HTTP request to a certain piece of code, the servlet's GET, POST, etc method. 是服务器将HTTP请求
routes
到特定代码段,即Servlet的GET,POST等方法。
The servlet container is hit with an GET
method on a URL like /my/servlet/info
. 该servlet容器在
/my/servlet/info
类的URL上使用GET
方法命中。 The URL ist translated into a servlet (by the servlet's path) and then the servlet's get method is called. URL ist转换为servlet(通过servlet的路径),然后调用servlet的get方法。 Based on the URl the servlet container decides what servlet to use.
基于UR1,servlet容器决定使用哪个servlet。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.