简体   繁体   中英

Is there an equivalent to ASP.NET WEB API in JAVA world?

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.

we used asp.net webapi, ASP.net MVC 4.0 framework, Jquery mobile libraries, HTML 5, signal R for development.

Is it possible for us to migrate or convert complete server side code(ie controllers methods) under Java?

Does Apache tomcat server or (webspehere) supports verbs like PUT, DELETE inaddition to GET and POST?

Any thing available in Java world which is equivalent ASP.NET SignalR functionality?

what are the required softwares or libraries for developing device aganostic touch enabled applications in java?

I think Web API objectively wins out over other APIs in below few key areas.

Content negotiation, Flexibility, Separation of concerns

How much extent Spring MVC API or Jersey API will support the above areas?

Is it possible for us to migrate or convert complete server side code(ie controllers methods) under 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

Does Apache tomcat server or (webspehere) supports verbs like PUT, DELETE inaddition to GET and POST?

Yes all HTTP commands can be enabled/disabled in Tomcat or any JEE compliant App servers

Any thing available in Java world which is equivalent ASP.NET SignalR functionality?

DWR (Direct Web Remoting), Vaadin, GWT etc. But I am sure there are more.

What are the required softwares or libraries for developing device aganostic touch enabled applications in java?

JavaMe, Android, GWT-Touch etc . Also this link might help you.

Java rest Apis

  1. Apache CXF, an open source Web service framework.
  2. Jersey, the reference implementation from Sun (now Oracle).
  3. RESTeasy, JBoss's implementation.
  4. Apache Wink, Apache Software Foundation Incubator project, the server module implements JAX-RS.
  5. Apache Tuscany ( http://tuscany.apache.org/documentation-2x/sca-java-bindingrest.html )

Hope this helps.

Jersey (jax-rs) is a very solid alternative to ASP.NET Web API in the Java World.

Jersey RESTful Web Services framework is open source, production quality, framework for developing RESTful Web Services in Java...

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.

The answer is yes you can create restful web service in Java with spring framework. Here is and example of how code looks

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));
}

}

Link : http://spring.io/guides/gs/rest-service/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM