Saturday, 27 February 2010

Nakon dugo vremena, opet sam tu...

E zaista nisam odavno pisao na svom blogu. Vjerovatno su najveći razlog za to prevelike obaveze na poslu. Radilo se i dan i noć, pa umor uradi svoje.
Drugi razlog je i nedostatak inspiracije. Pretpostavljam da je to direktna posljedica prvog razloga. Ustvari kada razmislim, više je to nedostatak snage a ne inspiracije ( hm, što je opet posljedica prvog razloga? ) jer sam inspiracije za interesantne teme proteklih mjeseci imao na pretek:
od best practice -a prikupljenih prilikom posljednjeg projekta koristeći Struts2 u sklopu e-governement-a,  preko  kreiranja JAVA framework-a za rapidni ( uz to i deklarativni ) razvoj web aplikacija ,  do know-how tema prilikom učešća na razvoju web servisa različitih vrsta i namjena  ( koje bi mnogima uštedjele mnoooogo vremena i živaca ) i još mnogih drugih interesantnih stvari...
Zaista sve interesantne teme za pisanje, ALI kao što rekoh – umor učini svoje i tu se vraćamo na početnu rečenicu ovog teksta.
I tako ja pomislih da nisam odavno pisao za blog, i taman da po ko zna koji put po redu uhvatim maglu od pisanja, sjetih se da je danas 27. Februar…
E to je dan koji zaslužuje da se pomene, te  ja na ovaj nacin dajem svoj doprinos popularizaciji IT-a u CG: Danas se završava još jedan festival IT-a , ovaj put onaj na Žabljaku: IT 2010!
Doduše, mnogo bi , vjerovatno, smisla imalo da sam se javio 24. Februara, kada je festival pocinjao, ali ni na ovaj nacin ne gubi na “težini” moj doprinos popularizaciji domacih IT festivala :-)
Volio bih kada bi vidjeo i ostale kolege kako na svom blogu pišu o istom.
Ili slicnom, bio bih zadovoljan.
O blogu nekog izlagača i da ne pričam.
Nego, udaljismo se od teme...
Na žalost, ni ove godine nisam posjetio pomenuti festival, i iskreno mi je žao. Jedino što sam mogao ispratiti i procitati u vezi njega je ono što je objavljeno na zvanicnom sajtu ( www.it.ac.me.)
Ove godine je imalo tema koje su me iskreno zainteresovale.

Prva je
-    MOGUCNOSTI PRIMJENE SERVIS-ORIJENTISANE ARHITEKTURE (SOA) U PRAKSI jer imam srece da na poslu aktivno koristim ovakvu arhitekturu pri kreiranju informacionih sistema, i jer je tema koja me poprilicno interesuje a tako se malo zna o njoj kod nas.
Kao što procitah negdje: web servisi su kao srednjoškolski sex: svako prica o njemu, a niko ili rijetko ko ga zaista konzumira. A i onaj ko ga konzumira – ne zna ga pravilno konzumirati.
Nevjerovatno je kako je malo dobrih tekstova i  literature na internetu ( napominjem dobrih ) na ovu temu a ima toliko toga da se kaže i demonstrira. Upravo zbog toga me svaka prica na ovu temu interesuje.

Druga je
-    PRIMJENA MPI ZA ODREÐIVANJE BIASA I VARIJANSE KUBICNE FAZNE FUNKCIJE. Ova tema mi je posebno interesantna. Prvi razlog su koautori na ovom radu koji su mi odredeni garant kvaliteta samog rada, a drugi je jer se radi o aplikaciji radenoj za klaster, upotrebom MPI funkcija. Tokom 2006-e godine sam ucestvovao na izradi prve crnogorske aplikacije za klaster ( koliko sam informisan ) , u sklopu CIS-a UCG (http://www.mren.ac.me/eilenberger/ ) i zaista bi mi bilo interesantno vidjeti kako je neko drugi implementirao nešto slicno...

I treca je
- PRIMJER VALIDACIJE XML-A POMOCU DTD-A. Opet kao prvo radi koautora a onda i zbog moje redovne i vrlo ceste upotrebe ovog formata. XML je cesta tema i na ovom blogu...


Ovo, naravno, nisu jedine teme vrijedne slušanja, ali MENI su najinteresantnije. Ne bi bilo loše da su na zvanicnom sajtu obezbjedeni i video snimci predavanja. Eto dobra predlog za organizatore za sljedecu godinu...

Thursday, 4 February 2010

Oblikujte novi Oracle Forms builder

Prenosim svoj novi tekst sa bloga baze-podataka.net
( http://www.baze-podataka.net/2010/02/04/oblikujte-novi-oracle-forms-builder/ )


Nedavno je na Oracle-ovom forumu  pokrenuta tema na kojoj možete predložiti šta bi bilo dobro da se doda u Oracle Forms.

http://forums.oracle.com/forums/thread.jspa?threadID=1021732&start=0&tstart=0

Na ovaj način je ljudima koji koriste ovaj alat je data sjajna prilika da oblikuju  narednu verziji Forms-a.
Naravno, neće se svaki predlog prihvatiti, ali vrijedi pokušati...

Lično, prve stvari koje su mi pale na pamet su

- dodavanje kalendarčića ( ovo trenutno radim preko Java binova, ali bi bilo puno bolje imati neki gotovi formsov objekat )
- poboljšanje editora PL/SQL-a ( trenutni editor je više nego smiješan. Čak kada razmislim - ne znam za gori )
- ugrađena podrška za webutil ( nepotrebno zakomplikovano )

- bolje odrađena podrška za slike ( slike importovane preko Image item-a su neprihvatljivo loše )

- bolje urađena podrška za kreiranje i importovanje Java binova ( nepotrebno zakomplikovano, bez ozbiljnog  modula u samom IDE-u koji bi developerima pomogao pri kreiranju binova )

- veća sloboda pri kreiranju i oblikovanju data blokova. ( Npr. da se može zadati upit na osnovu kojeg će se u run time-u izgenerisati  data blok ( ok, koji bi bio read-only ) . Npr. kao data grid koji imamo u BCB-u, .NET-u... .)

Naravno, ima još toga čime bi se trebalo pozabaviti u formsu, kao što je npr. debugger, VCS , prelaženje sa aplet aplikacija  na ajax aplikacije , standardizacija IDE-a itd i još dosta dosta toga...

Dakle, ko ima ideje - neka predloži...

Saturday, 28 November 2009

NetBeans subversion update issue

For me , NetBeans is the best IDE I tried so far…
And believe me, I tried and used plenty…
I’m not talking about Java IDE only, but IDE in general…

But there’s a bug in it that made me wonder if there is a need for me to look for another IDE to use when developing applications.

At one moment , I considered moving to Eclipse, maybe a community edition of IntelliJ IDEA, or even a JDeveloper.
After a while I decided not to switch to other IDE in the middle of the project, and I doubt I’ll be moving after because I found a solution to a problem I’ll be talking about now…
After all, this is the only serious issue i have with NetBeans so far…

So, what is it about?

I noticed that every now and then , after I update my local project from subversion repository , I have a problem deploying it…
Just for the record: project in the subversion I updated to is a fully legal and working project.

NetBeans manage to update it, but when I try to deploy a project, all I get is an exception saying:


Caused by: Action class […some Action class…] not found - action - file:/C:/Documents%20and%20Settings/Darko/My%20Documents/NetBeansProjects/MyProject/build/web/WEB-INF/classes/struts.xml:714:99
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:405)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:355)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:460)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:265)
        at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111)
        at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:189)
        at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
        ... 28 more



But there is no message saying what’s wrong…
As I said, this was a quite frustrating, and it still is, but now I know how to solve it and continue my work…

All you need to do is restart Netbeans and try to deploy your project again.
You’ll fail.
But now , you’ll get a message in your output window saying that some of your classes, is missing.
Find which one is “missing”.
It is not really missing. For some reason NetBeans is just saying it cannot “see” it…
Go to source packages and open this class.
Go to the end of it and just enter few new lines in it and click “save”.
Let NetBeans save it, and then do a right-click on the project and click “Build” and hit the “Clean and Build” button…


 





Now try to deploy it…
You’ll probably succed…
I know I do!

If you don’t, do all the process once again…
Not ALL the process, just the one after restarting NetBeans.

I would really like to see this bug fixed.
I don’t know if this is really a NetBeans bug, or a Subversion bug, or Tomcat bug ( I use Tomcat ) but it exists…

As I said, this is the only serious bug I found so far in NetBeans , and would really like to hear from you if there is a way of solving somehow different… Some regular way …


Friday, 27 November 2009

Oracle OpenScript


Nema, Oracle je zaista Interesantan...
Ono što on napravi MORA ostaviti utisak na vas!
Makar na mene ostavlja...

Nekad cete biti zaprepašceni kako je Oracle nešto loše i/ili nestandardno uradio ( npr. Oracle-ova konzola, code editor u Oracle forms-u, oracle designer, odredene specifičnosti PL/SQL-a… i još mnogo toga) , a nekad ( uglavnom ) cete biti zapanjeni kvalitetom uradenog ( npr. Oracle Discoverer , ADF , oracle Reports, APEX , web util ... i još  mnogo toga )
E, postoji jedan alat koji je posljednji u nizu ostavio više nego pozitivan utisak na mene.
Njegovo ime je Oracle OpenScript.



Svi koji rade na razvoju Oracle Forms ili klasicnih web aplikacija ce biti više nego oduševljeni onim što ovaj alat ima da ponudi.

Rijec je o Eclipse-based IDE-u u kojem možete kreirati skriptove za automatizovano testiranje vaših aplikacija.


Ja ga još nisam detaljno ispitao, ali i sa ovoliko malim iskustvom sa Oracle openScript-om oduševljeno tvrdim da je ovo jedna nova stavka mome spisku must-have alata za razvoj forms i web aplikacija.
I upravo je stigao u savršenom trenutku, što se mene tice!

Kreiranje ogromnih formi je upravo postao mnogo lakši posao ?

E kad se samo sjetim dugometražnih unosa podataka i beskonacnih pozivanja novih i novih formi i LOV-ova da bi dobio samo jednu logicku cjelinu unutar baze novog IS-a zarad testiranja uradenog…
Pa ako nešto ne valja, ispraviš to i sve iz pocetka…

Kako se radi sa Oracle openScriptom?

Ono što sam ja do sada vidjeo – jako jednostavno!

Kreirajte script za automatizovano testiranje vaše aplikacije,



i dobicete novi prayan script sa defaultnim cjelinama :

-    initialize
-    run
-    finish



Rijec je ustvari o vizuelnoj prezentaciji java coda koji se generiše u pozadini, tj. Na jezicku “Java code”




The OpenScript Tree View scripting interface provides a graphical representation of the test script. Multiple script windows can actually be open at the same time. Within each script window, the Tree View is broken down into 3 main script sections:
•    Initialize: For script commands that only execute once on the first iteration
•    Run: Main body of the script for commands that will run on every iteration
•    Finish: For script commands that only execute once on the last iteration
Within each section, script Steps and Navigation nodes can be created automatically during script recording or manually through the Tree View user interface. Additional script commands will also be represented as nodes in Tree View including test cases, data inputs, log messages, etc. Each Tree View node has a corresponding representation in the Java Code View.



A kako se to Javin kod generiše?

Pa, po onome što sam vidio , najjednostavnije npr. klikom na dugme “record” .
Kada kliknemo na ovo dugme, otvorice nam se defaultni browser ( ovo možete promjeniti u podešavanjima unutar samog okruženja ) i Oracle openScript ce na osnovu vašeg djelovanja generisati script ( Java code ) koji ce biti code-prezentacija onoga što ste vi uradili prilikom testiranja.
Dakle, IDE sve pamti, I upravo ce , kada kliknete na dugme “playback” sve sam ponovo uraditi.
Sve adrese koje upišete u adres bar , sve na šta kliknete, koje sve popup ili nove prozore otvorite, koji sve prozori preuzmu fokus, sve ce se “pamtiti” u kodu kreiranjem poziva prema odgovarajucim funkcijama API-ja koji Oracle OpsenScript koristi.

Sjajna stvar!

Ovo je, naravno, najlakši nacin za generisanje skripta.
Postoji i rucno pisanje koda, koje je sigurno naprednije i mocnije, i mnoge druge funkcionalnosti koje IDE nudi, ali kažem – nisam ga mnogo koristio da bih mogao prenijeti tips and tricks…

U svakom slucaju – u pitanju je stvarcica kojoj cu sigurno pružiti šansu. Još jedna od onih iz Oracle-ovih laboratorija koja vas ostavi bez daha…


Dakle, ko je zainteresovan da isproba, i olakša sebi život, download strana je:
http://www.oracle.com/technology/software/products/app-testing/index.html

Ko želi koristiti Oracle openScript sa Oracle Forms developerom , evo i jedan lijep link sa kratkim uvodom u tu materiju:

http://www.scl.com/software-quality/software-quality-resources/testing-oracle-forms-with-openscript


Cujemo se, nadam se , uskoro na ovu temu ponovo...  ;-)

Monday, 19 October 2009

Oracle ROWNUM

Na baze-podataka.net je izašao moj novi post, ovaj put posvećen priči o rownum-u u Oracle RDBMS-u.

Tema može biti interesantna ljudima koji ranije nisu detaljnije čitali o ovoj pseudo koloni.
Objašnjeno je  njeno pravilno korišćenje u upitima , i skrenuta pažnja na neke česte zablude u vezi rownum-a...

Link: http://www.baze-podataka.net/2009/10/19/oracle-rownum/

Wednesday, 7 October 2009

Struts2 config-browser plugin

Great thing that I recently discovered in struts2 is the ability of exploring the entire configuration that Struts2 uses to run your application by just including one .jar file - Struts2 config-browser plugin.jar

Using this plugin is quite easy…
All you need to do is to add  struts2-config-browser-plugin-2.x.x.jar to your project.
No other action is required!
Now, after you deploy your project, open config-browser by calling index.action inside config-browser namespace.

for example:

http://localhost:8084/MyApp/config-browser/index.action

After you run it, you’ll get a page containing entire configuration of you application.
You can click on any action you have mapped inside your struts.xml and see all the parameters set for it…







And not only actions!
You can explore the  struts constants too, for example…




and other things…

Try it! You could fine some interesting things, and it could actually help you when developing or maintaining application…

Thursday, 24 September 2009

Creating struts2 login page using Tomcat 6 and JNDI realm

Creating login module when using Struts2 and tomcat can be quite cool and interesting assignement, but can also be a quite annoying job if you are not familiar with all that you need to do…

When creating this module, there are several approaches. For example:

- Creating login module using container managed security
- Creating programmatic login module where you define a “database” of usernames, passwords, and roles. This way you define your login logic by yourself as well.
- Using some 3rd party library

This post describes how to configure Tomcat 6 to support container managed security, using JNDI realm.
I’ll use JNDI realm that enables application server to look for user’s information within Active Directory.

Realms are really cool!
They are, in fact, an instruction  for application server on where to look for user names, passwords and roles when a user that tries to login into your application needs to be authenticated or sometimes it’s a “database” of usernames, password and roles itself.
Great thing when using container managed security is that everything is already implemented, and all you have to do is to provide a realm and map several elements in web.xml, regarding  security.

Let’s start from the beginning.
At this moment, my web.xml file looks like this:


<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <session-config>
        <session-timeout>
            15
        </session-timeout>
    </session-config>

    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

And as for now, I put all my JSPs in the /jsp/ folder.
This is my application structure:

/ - root of  application
/jsp/  - contains JSPs
/css/main.css - contains CSS
/js/jsfile.js  - contains all of my java script code
/images/  - contains a lot of images

My task is to create a login system for this application, and to provide that only logged users , with roles “boss” or “manager” are allowed to se my JSP pages ( located in “/jsp/” folder )

To do that, the first thing we’ll do is to define (add ) roles in our web.xml.
This can be done in some other files as well, but I’ll do it here…
Note: These roles must be equal to those in active directory.

So, let’s add these two roles:

<security-role>
                <role-name>boss</role-name>
        </security-role>
        <security-role>
                <role-name>manager</role-name>
</security-role> 

Next thing we’ll do is to create a security constraint on accessing web pages:

<security-constraint>
                <web-resource-collection>
                        <web-resource-name>Protected area</web-resource-name>
                        <url-pattern>/*</url-pattern>                  
                </web-resource-collection>

                <auth-constraint>
                    <role-name>boss</role-name>
                    <role-name>manager</role-name>
                </auth-constraint>
</security-constraint>

This way, we deny acces to our resources to anyone except to those of  role “boss” or “manager”.

Next thing we need to do is to define the authentication method we will be using.
There are several authentication methods: BASIC, FORM-BASED , DIGEST , SECURE SOCKET LAYER ( SSL) and CLIENT CERTIFICATE AUTHENTICATION.

Which one to use  - depends on what exactly you need.

For us, the most  interesting method is FORM-BASED authentication.
With this method, you create your custom JSP login  form inside your application, with your own look and feel.
There are 3 very important  things to know when working with form-based authentication:

- input field containing user name must be named “j_username”
- input field containing password must be named “j_password”
- action for form containing these two inputs must be “j_security_check”


So, let’s create one!
Here is the example of such page,:

<html>
<head>
<title>Login Page for Examples</title>
<body bgcolor="white">
<form method="POST" action="j_security_check" >
  <table border="0" cellspacing="5">
    <tr>
      <th align="right">Username:</th>
      <td align="left"><input type="text" name="j_username"></td>
    </tr>
    <tr>
      <th align="right">Password:</th>
      <td align="left"><input type="password" name="j_password"></td>
    </tr>
    <tr>
      <td align="right"><input type="submit" value="Log in"></td>
      <td align="left"><input type="reset"></td>
    </tr>
  </table>
</form>
</body>
</html>

Let’s call it “login.jsp”, and place it in the root folder ( /login.jsp )

Now, let’s map it inside web.xml:

<login-config>
                <auth-method>FORM</auth-method>
                <form-login-config>
                        <form-login-page>/login.jsp</form-login-page>

                </form-login-config>
</login-config>

For now, this is good, but it’s not enough.
We also need to define a form-error-page inside a <form-login-config> tag…
Application server will open that page when user enters wrong user name or password.

Here is what I’m going to do:
I’ll define login.jsp page to be form-error-page too, but with result=false in URL.
This way we will know that we need to add some warning message to user that didn’t enter valid username and/or password.
Let’s edit that prevoius <login-config>:

<login-config>
                <auth-method>FORM</auth-method>
                <form-login-config>
                        <form-login-page>/login.jsp</form-login-page>
                        <form-error-page>/login.jsp?result=false</form-error-page>
                </form-login-config>
</login-config>

and let’s edit that login.jsp page, to show error messages when needed:

<html>
<head>
<title>Login Page for Examples</title>
<body bgcolor="white">
                     <%
                         String result = request.getParameter("result");
                         if(result == null)
                            result = "";
                         if (result.equalsIgnoreCase("false")) 
                         {
                    %>
                    <span style="color: red">
                    Wrong user name or password
                    <br>
                    </span>
                    <%       

                         }
                    %>
<form method="POST" action="j_security_check" >
  <table border="0" cellspacing="5">
    <tr>
      <th align="right">Username:</th>
      <td align="left"><input type="text" name="j_username"></td>
    </tr>
    <tr>
      <th align="right">Password:</th>
      <td align="left"><input type="password" name="j_password"></td>
    </tr>
    <tr>
      <td align="right"><input type="submit" value="Log in"></td>
      <td align="left"><input type="reset"></td>
    </tr>
  </table>
</form>
</body>
</html>

So…
We created login.jsp page, we mapped it in the web.xml  and earlier before we made an acces constraint to all of our folders so only logged users can access it.
But now question is: “what if our login page uses some image from /images/ folder in it, or some java script from within /js/ , or css from within /css/ as it  probably would?”

If we leave everything like this, your login form will not be able to read your css and images, and it will look very bad…

What we now need to do is to make some resource  public, so that our login.jsp page could use it…
To do so, we could make some existing folders public ( for example /css/ and /images/ ) ,  or we could copy particular resources ( some images and css that login.jsp needs ) to some new folder and make public only what has to be public ( what we copied ), nothing more…
We’ll do that…
Let’s call this folder “login_resources”
Let’s place it in the root:

/login_resources/

Copy all the resources that you login.jsp uses to this folder.
We will now create one more security constraint that will allow everyone ( login.jsp ) to access it:

<security-constraint>
        <web-resource-collection>
        <web-resource-name>Unprotected area</web-resource-name>
        <url-pattern>/login_resources/*</url-pattern>
        </web-resource-collection>
 </security-constraint>

We intentionaly “forgot” to set <auth-constraint> inside <security-constraint> so that everyone could access this resource.

Now, our login form will be able to read all the resources it needs…

And, at the end, we need to add our JNDI  realm to our context.xml file
You could add this realm to some other files as well, but I like to add it to context.xml.

Here is one example of it:

<Realm 
 className="org.apache.catalina.realm.JNDIRealm"
 debug="99"
 connectionURL="ldap://localhost:389"
 userPattern="uid={0},ou=people,dc=mycompany,dc=com"
 roleBase="ou=groups,dc=mycompany,dc=com"
 roleName="cn"
 roleSearch="(uniqueMember={0})"
/>

Please, visit http://tomcat.apache.org/tomcat-6.0-doc/realm-howto.html for more information on creating  realms.
Place this realm inside <context>  </context> tag in context.xml file.

So, let’s sumarize:

Our web.xml now looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

     <session-config>
        <session-timeout>
            15
        </session-timeout>
    </session-config>

    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

<security-role>
                <role-name>boss</role-name>
        </security-role>
        <security-role>
                <role-name>manager</role-name>
</security-role> 

<security-constraint>
                <web-resource-collection>
                        <web-resource-name>Protected area</web-resource-name>
                        <url-pattern>/*</url-pattern>                  
                </web-resource-collection>

                <auth-constraint>
                    <role-name>boss</role-name>
                    <role-name>manager</role-name>
                </auth-constraint>
</security-constraint>

<security-constraint>
        <web-resource-collection>
        <web-resource-name>Unprotected area</web-resource-name>
        <url-pattern>/login_resources/*</url-pattern>
        </web-resource-collection>
 </security-constraint>

<login-config>
                <auth-method>FORM</auth-method>
                <form-login-config>
                        <form-login-page>/login.jsp</form-login-page>
                        <form-error-page>/login.jsp?result=false</form-error-page>
                </form-login-config>
</login-config>


Once the user logs in, application server will create a session for him.
You can access it’s user name with

ServletActionContext.getRequest().getUserPrincipal().getName();

or check if he has a sufficient role with

ServletActionContext.getRequest().isUserInRole(“some_role”);


And if you would like to logout, you can use

getRequest().getSession().invalidate();





That’s it for now…
I hope I helped someone and saved him some time...