java 在哪里可以获得 servlet-api.jar 的源代码?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11836039/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 06:34:30  来源:igfitidea点击:

where can i get the source code for the servlet-api.jar?

javaservlets

提问by Elye M.

I have a project uses servlet-api.jar. When debugging, I wanted to step into its classes (such as HttpServlet) but I got "Source not found attach source ".

我有一个项目使用 servlet-api.jar。调试时,我想进入它的类(如 HttpServlet),但我得到“找不到源附加源”。

is there a way to get the source like all the java sources ?

有没有办法像所有java源一样获取源?

it would be good to have so i should be able to debug it and to step into the code.

拥有它会很好,所以我应该能够调试它并进入代码。

there is a way?

有一种方法?

回答by Nick Rippe

You can get apache source code from the apache tomcat website: http://tomcat.apache.org/index.html

您可以从 apache tomcat 网站获取 apache 源代码:http: //tomcat.apache.org/index.html

回答by parsifal

The Servlet API JAR is just interfaces (along with a few minor utility classes); there's nothing to step into.

Servlet API JAR 只是接口(以及一些次要的实用程序类);没有什么可以介入的。

Depending on your app-server, you can download source for implementation classes like HttpRequest(for Tomcat, instructions are here). However, why do you feel there would be value stepping into those classes? They generally work well, and any problems are almost certainly in your own code.

根据您的应用服务器,您可以下载实现类的源代码,例如HttpRequest(对于 Tomcat,说明在此处)。但是,为什么您认为进入这些课程会有价值?它们通常运行良好,几乎可以肯定任何问题都出在您自己的代码中。

回答by prashanth

In addition if you are in eclipse or netbeans, and are using maven based project right click on the dependencies and download sources for your particular dependency.

此外,如果您使用 eclipse 或 netbeans,并且正在使用基于 maven 的项目,请右键单击依赖项并下载特定依赖项的源代码。

回答by Mrinmoy Sen

You can get the source from java2s.com

您可以从 java2s.com 获取源代码

(version 3.0 of the servlet API): http://www.java2s.com/Code/Jar/s/Downloadservletapi3020100224sourcesjar.htm

(servlet API 3.0 版):http: //www.java2s.com/Code/Jar/s/Downloadservletapi3020100224sourcesjar.htm

(or the older version 2) http://www.java2s.com/Code/Jar/s/Downloadservletapi256114sourcesjar.htm

(或旧版本 2) http://www.java2s.com/Code/Jar/s/Downloadservletapi256114sourcesjar.htm

In fact java2s.com is a huge java source, program & jars resource.

事实上,java2s.com 是一个巨大的 Java 源代码、程序和 jars 资源。

回答by lukyer

Intellij IDEA

智能设计

  1. Download source codes from Apache, put somewhere at some stable place in your computer.
  2. Try to go into some .jar function until "decompiled" result shows.
  3. Click "Choose sources".
  4. Select downloaded source codes and IDEA will do the rest :)
  1. 从 Apache 下载源代码,放在计算机中某个稳定的地方。
  2. 尝试进入一些 .jar 函数,直到“反编译”结果显示。
  3. 点击“选择来源”。
  4. 选择下载的源代码,IDEA 将完成剩下的工作:)

Choose Sources in IDEA

在 IDEA 中选择来源

回答by Park JongBum

To checkout the Javadoc on the classes or methods of "servlet-api.jar", visit http://archive.apache.org/dist/tomcat/tomcat-8/v8.0.27/src/

要查看有关“servlet-api.jar”的类或方法的 Javadoc,请访问 http://archive.apache.org/dist/tomcat/tomcat-8/v8.0.27/src/

(for other versions of tomcat visit - http://archive.apache.org/dist/tomcat/tomcat-8/

(对于其他版本的 tomcat 访问 - http://archive.apache.org/dist/tomcat/tomcat-8/

and navigate to their "src" directory,

并导航到他们的“src”目录,

and download zip file for Windows(tar for Linux.) and finally

并下载 Windows 的 zip 文件(Linux 的 tar。),最后

attach it within the IDE(Netbeans, Eclipse, etc.)

将它附加到 IDE(Netbeans、Eclipse 等)中