Vladimir Razov

Ranch Hand
+ Follow
since Jul 22, 2013
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Vladimir Razov

Hi,

I have been reading about transactions in web services lately, and it is quite confusing area. Most of the specifications, articles, blogs are more than 10 years old. As I have understood, there are three different specifications related to transactions in web services: Business Control Protocol - BTP, Web Services Coordination - WS-C(with WS-AT and WS-BA), and Web Services Application Framework - WS-CAF(WS-CTX, WS-TXM).

Most of the articles, blogs on this topic are written by few, same people that enrolled in writing these specifications. It seems like some of these specs are deprecated, sidelined by other ones.

I need to learn more about transactions in web services, and not quite sure where to start from, which topics are actively used today? What things I should focus on at first? Which specifications are bigger players, like are JBoss, WebLogic, WebSphere, using (implemented)?
Have anything changed on this field lately, because as I said, all material on web services transactions is more than 10 years older.

I am looking for simple advice from anyone who works with transactional web services, or knows the situation there.
Thanks
10 years ago
Well, that's how form based authentication works .
Form's action="j_security_check" sends form field values to container, which handles login process and forwards to asked/secured page (or servlet) if login succeeds.

I was thinking to use this login form "explicitly": just to go to this page, enter login details and press Submit button. But, as I understood, that can't be done when using form based security.

So, I have implemented this like: when user wants to login, user clicks on login link somewhere on the page, which is a link to secured, user account details jsp page.
10 years ago
I have configured form based JAAS in my app. Basically, in web.xml I have declared security constraints on certain jsp page, declared specific roles, login and error pages.
So, my login form is:

This works fine when some user tries to access some of the pages declared in <security-constraint> tag of web.xml.
Container automatically manages login process, redirects to login page and if login details are valid, gives access to secured page.

Now, how should I implement login system so that user can go to login page (possibly same login form) and log in from there?
10 years ago
Check http://www.coreservlets.com/ . Very well organized lessons, with examples and solutions: JSP, Servlets, JSF and much more, setting environment, configuring server ... Everything explained in details so everyone willing to learn can easy follow lessons.
10 years ago
JSP
I was missing pageContext object , request by itself is not implicit object in JSP page.


And JSTL equivalent for <%=request.getUserPrincipal().getName().toString()%> is: <c:out value="${pageContext.request.userPrincipal.name}"/>
10 years ago
JSP
I am using form based, declarative security approach. And, when some user, on login form enters user credentials (username and password), he is being redirected to certain/secured jsp page. Part of that page content is:

You can see that this is implemented using JSP scriptlet. And this works. I would like to use JSTL instead of scriptlet. So, instead of scriptlet, I put this JSTL code: <c:out value="${requestScope.userPrincipal.name}"/>, but not getting user's username with it.
Basically, I don't clearly understand where and how are these objects/user credentials being stored with Form based JAAS.

And, as stated in subject question, I would like on JSP page to check if some user is already logged in. So, if there is logged user to display user's name (also with JSTL).
Something like this:

Here I tried with sessionScope but still not getting anything.
10 years ago
JSP
This works (in MySQL):


where pattern="%" + someString + "%";

@K.Tsang thanks for help
It looks to me that its best to implement this using LIKE expression.
Something like this:

SELECT p FROM Post p where p.title LIKE :pattern and p.date>=:startDate AND p.date<=:endDate

Now, how should then pattern attribute look like. For example, if I want to check if there is word "hello" part of the title field. Is following expression appropriate: "%hello%"
Actually I am trying to implement something like this (this is not valid JPQL): SELECT p FROM Post p WHERE p.title contains :substring
@K. Tsang Yes, I am aware of adding named queries at the entity class. I already have some for this class.
My problem here is how should JPQL query look?
I need something similar to someString.contains(someSubstring) function in Java.

Actually, my goal is to get all posts where post's title field (which is string) contains given substring - searching posts by some word from their title.
Basicaly, its similar like looking if certain word exists in sentence. There is entity Post:


What I am trying to implement is simple search mechanism. User eneters a word and if that word is consisted in the post's title, then the post is being returned.
So, I nedd JPQL query that will search for Post entity instances that have certain word/string (called byTitle, passed as an argument) in their title field, and two more arguments of Date type, that represents date range - startDate and endDate.

I have something like this on my mind: SELECT p FROM Post p WHERE :byTitle IN (set of strings created from parsing p.title field) AND p.date>=:startDate AND p.date<=:endDate
May be, that I wrong approached implementing this. If you have any experience with this kind of searching concept, I appreciate any help.
How to implement this kind of JPQL query? Or maybe JPA Criteria API should be used?
Yes, you are right. Checking if resultList is empty is not needed. Thanks for pointing out.
This is valid code:

I found out that another way to get all posts from database ordered by number of comments is by using JPA Criteria API.
This is what I am trying now:

I am aware I am missing getting the size of the set comments, but don't know how to add that part. Need help with Criteria API.