user3531270
user3531270

Reputation: 179

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(i.e 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?

Upvotes: 17

Views: 25151

Answers (3)

Saeed Sharman
Saeed Sharman

Reputation: 785

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/

Upvotes: 1

Julio Rodrigues
Julio Rodrigues

Reputation: 3413

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.

Upvotes: 5

avijendr
avijendr

Reputation: 4153

Is it possible for us to migrate or convert complete server side code(i.e 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.

Upvotes: 5

Related Questions