Does Swagger work with Struts to document REST api's? - java

We have an existing Java 1.7 Struts 1 application. We do have some REST api's that use RX-JS (javax.ws.rs).
Question
Does Swagger work with Struts1?
Is there any documentation on how to configure this?
I have looked here, but I am not sure what version I should use?

Struts 1.x reached it's EOL in December 2008. There are only Swagger (an implementation of OpenAPI Specification) implementation for both JAX-RS as well as Spring REST.
There is NO implementation for Swagger in Struts framework as Struts was/is meant to be an MVC framework to build Java Web application. Yes, you can "hack" it to return behave like a RESTful Web Service but that wasn't it's intended purpose.

Related

Authentication Filters in Jersey 1.x

Is there an alternative to #NameBinding annotation in Jersey 1.x
I have developed a REST based Server API using Jersey 1.x but, need to implement Filters only for certain Requests.
On researching found that, #NameBinding performs the job perfectly. However , my whole project is Jersey 1.x based, and hence I am not able to bring this functionality.
Thanks

Integration HDIV and restful APIs with Jersey

I have a Java Restful application that uses Jersey for the APIs implementation and that uses Spring for DI. I'm now trying to integrate HDIV for security.
However the official documentation has examples for the integration with Spring MVC, but not Restful Jersey applications.
Documentation here:
https://hdivsecurity.com/technical-documentation/doc.html
I read online that it's possible to integrate HDIV with REST, but I cannot exactly figure out how this is done, as I cannot find examples.
Does anyone know how this is done?
As you said Hdiv can be integrated with REST APIs, particularly RESTFul APIs that implements the whole REST specification, including Hypermedia or HATEOAS level (level 3 within Richarson model)
This REST support is included inside Hdiv Enterprise edition and that's why is not included in the link related to the technical documentation provided by you. The security level offered in that integration is exactly the same that we have been offering till now for server side MVC applications. It means that Hdiv can automate the protection against OWASP top 10 web risks in REST based applications .
Regarding JAX-RS support it can be possible if you are using the new hypermedia support included within JAX-RS 2/Java EE 7.
If you need more detail about the Hdiv support for RESTFul APIs you can review the slides presented in the last Spring I/O conference.
If you want to test within your project this support please contact using Hdiv support web form within hdivsecurity.com web site.
Regards,
Roberto Velasco

Spring 4 mvc + security for servlet 2.5 in JBoss5.1.0.GA

I want to use spring 4 with minimal xml configuration for the now new project I am about to develop. I will be using Spring in this project for dependency-injection, mvc, security and jdbc. I will use JOOQ for query generation. (Yes, I need to project to support Postgresql and oracle) (maybe, in future, this app will extended support for REST too). The problem I face now is my production application server is JBoss5.1.0.GA, which obviously does not support servlet 3.0. Now I have a working spring 4 mvc code base with servlet 2.5, but I could not figure out how to configure the security with java config. Because I see most of the examples on spring 4 on servlet 3.0+ versions, and very less not good examples on 2.5. Though I read the spring security from the spring website, it made little difference on implementing it. Have anyone implemented security (db/ldap) on servlet 2.5? Share with me your wisdom and experiences.
Spring security (I suppose version 3.2 as you speak of spring 4) works well on servlet 2.5, at least with xml config. I am not sure that you can use full java config for security, but I am sure annotations can be used for method security.

First Java EE Project using REST

I've been going off of http://www.oracle.com/technetwork/articles/javase/index-137171.html and downloaded the files but I'm a little lost since I've never done this before.
I've installed Tomcat and Eclipse Java EE IDE but I don't know what kind of project to use to create a webservice and how to load and compile the code to the service.
Am I going about this the right way in using eclipse?
That article is old. Since then, the Java standards committee created a new API named JAX-RS (The REST counterpart to JAX-WS). Like JAX-WS, this is meant to standardize REST web service layers.
Its reference implementation is Jersey, which supports JAX-RS 0.8, 1.0, and 1.1.
I understand that Apache CXF has support for JAX-RS 0.8, but it is unclear about 1.0/1.1 support.
JBoss has RESTEasy. However, it is not immediately clear which versions of JAX-RS are supported by RESTEasy.
Another popular JAX-RS framework is Restlet. Unfortunately, I can't open their site from here to say which versions of JAX-RS they support.
Here is an REST (JAX-RS) example I put together. You will probably find part 4 the most helpful:
Part 1 - The Database
Part 2 - Mapping the Database to JPA Entities
Part 3 - Mapping JPA entities to XML (using JAXB)
Part 4 - The RESTful Service
Part 5 - The Client
If all you're creating is a lightweight RESTful service you can also look at GlassFish which provides a simple http server for REST.
You'll create a web project to deploy a web service of any kind. It'll be packaged in a WAR and deployed on Tomcat.

Spring 3.0 JAX-WS and or vs. Apache CXF

Spring 3.0.1 has solid JAX-WS web services support. At the same time, I see that many articles refer to Apache CXF as a great web services framework.
If I work in the Spring/Hibernate world and want to expose the high-performing web services to the front end, should I consider utilizing Apache CXF? Is there any advantage to adding this additional framework to the mix?
The two are not mutually exclusive. Apache CXF is fully JAX-WS compliant.
Remember, JAX-WS is just a specification. Spring talks ato that spec'd API, and doesn't much care which implementation you use. Java6 ships with an internal JAX-WS implementation (Metro, or part of it), and CXF is merely an alternative implementation.
CXF is probably a bit more capable than the JAX-WS that ships with Java6, but unless there's something specific that you need that Java6 doesn't provide, I'm not sure it's worth the bother.
As for Spring and JAX-WS, Spring just makes it a little bit easier to use.

Categories