Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does WebSphere 8.5 have built in JAX-RS handling?

Multiple pages on IBM support seem to differ on whether JAX-RS is built in to WebSphere 8.5.

http://www.ibm.com/developerworks/websphere/techjournal/1305_gunderson/1305_gunderson.html

The most recent versions of IBM WebSphere Application Server provide support for JAX-RS. WebSphere Application Server V8.5 has support for JAX-RS built in; no extra installation is required.

http://www-01.ibm.com/support/knowledgecenter/SSAW57_8.5.5/com.ibm.websphere.nd.iseries.doc/ae/twbs_jaxrs_devenv.html?cp=SSAW57_8.5.5%2F2-13-2-38-1-1&lang=en

To develop JAX-RS applications, the JAX-RS libraries must be added to the class path definition. See the information for your assembly tools to understand how to include libraries on the class path for the JAX-RS application.

What needs to be done to run JAX-RS on WebSphere 8.5. Is the web.xml mapping required? Are additional library files required?

like image 349
Pool Avatar asked Feb 09 '15 16:02

Pool


People also ask

What version of Java does WebSphere 8.5 use?

Java SE 8 offers support for WebSphere applications to use the latest available Java features and standards. Attention: Starting in version 8.5. 5.11, the default versions of Java are Java SE 6 or Java SE 8.

What are the components of WebSphere?

Web applications are comprised of one or more related servlets, JavaServer Pages technology (JSP files), and Hyper Text Markup Language (HTML) files that you can manage as a unit. Combined, they perform a business logic function. The web container processes servlets, JSP files, and other types of server-side includes.

Can we deploy microservices in WebSphere Application Server?

WebSphere Application Server features and benefitsCreate and deploy cloud-native and web-based apps and microservices quickly with a lightweight and composable production runtime that features a single administrative console for Java and Node. js apps and APIs.


1 Answers

WebSphere 8.5.5 implements JAX-RS 1.1 provider, so you dont need any additional libraries. You may create mapping or not, depending on your needs. The best description of your options is here Configuring JAX-RS applications using JAX-RS 1.1 methods.

You can either:

  • Configure the JAX-RS application with only one JAX-RS default application in the web.xml file, like this:
<servlet>
    <servlet-name>javax.ws.rs.core.Application</servlet-name>
</servlet>
<servlet-mapping>
  <servlet-name>javax.ws.rs.core.Application</servlet-name>
  <url-pattern>/rest/*</url-pattern>
</servlet-mapping>
  • Configure the JAX-RS application using the javax.ws.rs.core.Application subclass and the web.xml file:
<servlet>         
    <servlet-name>com.example.MyApplication</servlet-name> 
</servlet>
<servlet-mapping>
    <servlet-name>com.example.MyApplication</servlet-name>
    <url-pattern>/rest/*</url-pattern>
</servlet-mapping>
  • Configure the JAX-RS application without a web.xml file. You only use annotations like @ApplicationPath, @Path, etc
@ApplicationPath("rest")
public class MyApplication extends javax.ws.rs.core.Application {
}

@Path("/helloworld")
public class HelloWorldResource {

    @GET
    public String sayHelloWorld() {
        return "Hello World!";
    }
}
like image 150
Gas Avatar answered Sep 23 '22 23:09

Gas