Archive for the ‘Java’ Category

JEE Webservice basic auth security check with Glassfish

Thursday, July 8th, 2010

No @RolesAllowed available for Webservices

The JEE specification is growing into a nice and easy to use specification. But some features, like Webservices and RolesAllowed, are not good enough yet. To be more precise. @RolesAllowed is not supported for plain Webservices (not doubling as EJB’s) until version 3.0 in the Servlet Specification.

After much reading on this subject, I have come to the conclusion that a pragmatic solution is required. My solution is just to inspect the principals based upon the logged in user and check myself if the user is allowed to continue. But you can also define the webservice as EJB.
(more…)

How To: Load a spring application from a jar file

Monday, August 24th, 2009

Consider the following situation:

Loading 3 application context files in a Swing application. 2 of the context files are in jar-files.
All context files depend on the component-scan option. The Application context gets loaded from my Swing app.
The method I use, is the import resource option in the context file. Read on how to configure this in your application context.
(more…)

Webservices with Spring and Castor

Monday, August 17th, 2009

Today, webservices are used primarily to expose some services of an application to the outside world. There are a lot of tools available to consume webservices. Tools like Mule, Axis and Spring.
This article describes a method of exposing Java services as webservices. The technique’s / tools used to accomplice this are; Java, Spring and Castor.
There are many other tools available, like Axis, to expose java services as webservices. The reason I used Spring and Castor is the simplicity in creating webservices. Spring takes care of all boilerplate coding and Castor’s mapping capability takes care of the Object <-> XML mapping without the need to generate any java objects the way Axis does. This way you have clean java code, supported with configuration in Spring and a clean Castor mapping to expose your service as a webservice.
(more…)