JAVA 世界中是否有相当于 ASP.NET WEB API 的东西?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23057456/
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
Is there an equivalent to ASP.NET WEB API in JAVA world?
提问by user3531270
I've been a .NET web developer for several years now, working with asp.net web forms and c#, wcf etc.But recently developed touch enabled customer facing application. Its device-agnostic application designed for any platform capable of running HTML5 applications (iOS, Android, Windows8), for Mobile devices (such as tablets), Assisted or unassisted kiosks, Laptop or desktop computers.
几年来,我一直是 .NET web 开发人员,使用 asp.net web 表单和 c#、wcf 等。但最近开发了面向客户的触摸应用程序。其与设备无关的应用程序专为能够运行 HTML5 应用程序(iOS、Android、Windows8)的任何平台、移动设备(如平板电脑)、辅助或非辅助信息亭、笔记本电脑或台式计算机而设计。
we used asp.net webapi, ASP.net MVC 4.0 framework, Jquery mobile libraries, HTML 5, signal R for development.
我们使用了 asp.net webapi、ASP.net MVC 4.0 框架、Jquery 移动库、HTML 5、signal R 进行开发。
Is it possible for us to migrate or convert complete server side code(i.e controllers methods) under Java?
我们是否可以在 Java 下迁移或转换完整的服务器端代码(即控制器方法)?
Does Apache tomcat server or (webspehere) supports verbs like PUT, DELETE inaddition to GET and POST?
除了 GET 和 POST 之外,Apache tomcat 服务器或 (webspehere) 是否支持 PUT、DELETE 等动词?
Any thing available in Java world which is equivalent ASP.NET SignalR functionality?
Java 世界中是否有任何与 ASP.NET SignalR 功能等效的东西?
what are the required softwares or libraries for developing device aganostic touch enabled applications in java?
在 Java 中开发支持设备触控的应用程序需要哪些软件或库?
I think Web API objectively wins out over other APIs in below few key areas.
我认为 Web API 在以下几个关键领域客观上胜过其他 API。
Content negotiation, Flexibility, Separation of concerns
内容协商、灵活性、关注点分离
How much extent Spring MVC API or Jersey API will support the above areas?
Spring MVC API 或 Jersey API 将在多大程度上支持上述领域?
回答by Aneesh Vijendran
Is it possible for us to migrate or convert complete server side code(i.e controllers methods) under Java?
我们是否可以在 Java 下迁移或转换完整的服务器端代码(即控制器方法)?
You could, but it's not very easy as there is not direct mapping apis, but there are similar apis which you could use. There are lots of people who have done it
你可以,但这不是很容易,因为没有直接映射 api,但是你可以使用类似的 api。有很多人做过
Does Apache tomcat server or (webspehere) supports verbs like PUT, DELETE inaddition to GET and POST?
除了 GET 和 POST 之外,Apache tomcat 服务器或 (webspehere) 是否支持 PUT、DELETE 等动词?
Yes all HTTP commands can be enabled/disabled in Tomcat or any JEE compliant App servers
是的,可以在 Tomcat 或任何符合 JEE 的应用程序服务器中启用/禁用所有 HTTP 命令
Any thing available in Java world which is equivalent ASP.NET SignalR functionality?
Java 世界中是否有任何与 ASP.NET SignalR 功能等效的东西?
DWR(Direct Web Remoting), Vaadin, GWT etc. But I am sure there are more.
DWR(直接 Web 远程处理)、Vaadin、GWT 等。但我相信还有更多。
What are the required softwares or libraries for developing device aganostic touch enabled applications in java?
在 Java 中开发支持设备触控的应用程序需要哪些软件或库?
JavaMe, Android, GWT-Touchetc. Also this linkmight help you.
JavaMe、Android、GWT-Touch等。此链接也可能对您有所帮助。
Java rest Apis
Java 休息 API
- Apache CXF, an open source Web service framework.
- Jersey, the reference implementation from Sun (now Oracle).
- RESTeasy, JBoss's implementation.
- Apache Wink, Apache Software Foundation Incubator project, the server module implements JAX-RS.
- Apache Tuscany (http://tuscany.apache.org/documentation-2x/sca-java-bindingrest.html)
- Apache CXF,一种开源 Web 服务框架。
- Jersey,来自 Sun(现在是 Oracle)的参考实现。
- RESTeasy,JBoss 的实现。
- Apache Wink,Apache 软件基金会孵化器项目,服务器模块实现了 JAX-RS。
- Apache 托斯卡纳 ( http://tuscany.apache.org/documentation-2x/sca-java-bindingrest.html)
Hope this helps.
希望这可以帮助。
回答by Julio Rodrigues
Jersey (jax-rs)is a very solid alternative to ASP.NET Web API in the Java World.
Jersey (jax-rs)是 Java 世界中 ASP.NET Web API 的非常可靠的替代品。
Jersey RESTful Web Services framework is open source, production quality, framework for developing RESTful Web Services in Java...
Jersey RESTful Web 服务框架是开源的、生产质量的、用于在 Java 中开发 RESTful Web 服务的框架...
It's an annotation based approach to the problem. I think it's a very well thought and productive environment. You can customize all sorts of stuff and that contains sane defaults.
这是一种基于注释的方法来解决问题。我认为这是一个经过深思熟虑和富有成效的环境。您可以自定义各种包含合理默认值的内容。
回答by Saeed Sharman
The answer is yes you can create restful web service in Java with spring framework. Here is and example of how code looks
答案是肯定的,您可以使用 Spring 框架在 Java 中创建宁静的 Web 服务。这是代码外观的示例
import java.util.concurrent.atomic.AtomicLong;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class GreetingController {
private static final String template = "Hello, %s!";
private final AtomicLong counter = new AtomicLong();
@RequestMapping("/greeting")
public Greeting greeting(@RequestParam(value="name", defaultValue="World") String name) {
return new Greeting(counter.incrementAndGet(),
String.format(template, name));
}
}
}