Mag Wells

Ranch Hand
+ Follow
since Jun 02, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mag Wells

are there any standard patterns of developing a swing application ?
For me the problem is this -
I have a panel, I keep adding components to it.. some of them are panels, textboxes, dropdowns etc. There are some other rendered on top of these.

How do I know which component was clicked/active/focussed ? where do I place listener and what kind of listener?
13 years ago
I have an xml that looks like this -


how do I define the element employees above ? I would start with defining employee element which would look like this



but employees ???
There is one more issue with that code - i.e. how does it know the type of the Java Object that the query returns !
Here is an interesting article - http://www.javalobby.org/articles/hibernate-query-101/ that tells how to select only some attributes from a table and populate in the java object. However, my concern is more about where
do I put this class ? Should I make it a base class and if needed the other classes might extend it ? or do I need to tie in these methods to the DAO classes ?

Bear Bibeault wrote:Well, firstly you can't mean "combobox" (read HtmlHasNoComboBox).

Secondly, you didn't say whether you have the option to modify what's contained in the response, or to create alternative services. What sort of tips are you looking for?



oops. actually combobox is more generic term. Anyways it is a drop down, you can imagine in an html page.
something like


Now, yes, I can modify what is in the response. But thing is that I would want to retain the original behaviour. as pasted in the previous post. Just that when I want to populate the combobox or rather <select> I want the shortened version. Now to be theoretically correct, I cannot modify the URLs i.e. say for example,
URL1 - GET details
and URL2- GET a shortened version.

because resource remains the same. ie. in the above case books.

I don't know, if creating alternative service wud be a good idea, then. I need a mechanism, idea or suggestion so as to get shortened reply for combobox box, else detailed version

may be something like


some samples would be great. I know that I can hack it one way or the other, butT i want to be closer to the standardS
13 years ago
Here is an interesting design problem that I am facing.

the following GET request gets me all the books


which is good, not syntax or any other issues.
Now consider a combobox that I would want to populate in certain html by books.

I would make the same call, but it would return unecessary data, and taking a tad longer, for a combobox to populate.

Any suggestions ?
13 years ago
yeah, I guess metadata is the right word. Thanks.

Now there are couple of questsions-
1. What would the general metadata look like ?
2. How do I embed that metadata of every response.

Bit of clarification on #2.
I have java objects say for example Book. My spring framework serializes it and converts it to <book> ..... </book>
set of books would be returned as List.
That is <list> <book>..</book><book>..</book><book>..</book><book>..</book></list>
so do I create a new class metadata and make every other class inherit that ?
13 years ago
I am a bit confused about what standard restful service call output is ? I mean for example, my current web service,



This looks pretty ok. But what I am missing is seems the (error)messages from the server, may be the resultset size and things like that. I really have no clue what all addons like these should be included.

Any pointers/samples would be a great help. Also an idea about the gnrl class heirarchy for this to achieve.

-muncher
13 years ago
The following configuration works fine for me -



This works fine. It gets me a login page etc.. and the flow works perfect. However, when I try to access any other protected resource like for example

/myApp/yy/test.do

It says the resource is unavailable. How do I configure the the intercept-url so that /myApp/yy/test.do request goes thru the authentication mechanism i.e. if the user isn't logged in it gets back the login page etc.
13 years ago
yea, so I have a restful api. For every request I call openssesion and close it on completing the request. Whenever there is an on opensession call, it reads all the hbm.xml files etc.
which to me seems a bit slow. Instead the app should read the xml mapping only once, when the app starts..

how do I do that ?
I am struggling with this. I have MVC based web app. I open up some session in the BO object and pass it to DAO. But most of the time is consumed in the opensession() call. I would want to reduce that.



This is how my util method looks like from where I get the sessions.

Any better suggestion ?
Yep, will take a look at that pattern.

So by 1) you mean, I have assign or configure the urls of the composite resources in controllers ? Is there a way to do it in Business Object (BO) Layer ? I mean creating an interface that lists relative paths..


For example Book is at /books/
Author is at /authors/

etc.. and then convertor can plug it in. Basically, I employ convertors in BO layer. It is not exactly the UI that it outputs but an xml for rest service.
13 years ago
cool. Looks like something is working out. What pattern ? some keywords or topic or pattern info would be great.. to get me on right foot.
13 years ago
Apart from that, I have to plug in the relative urls .. how do I do that ?
13 years ago
Yes you are right. I do have the required Id.

Now here is the basic flow/sequence.

1- httprequest -- spring framework -- some Java Objects---> Dao ---> DB
2. DB --> hibernate POJO --> Business Object (Convert hibernate POJO to UI POJO )---> Controller ---> XStream
3. Now, when I convert the hibernate POJO, I have a convertor for every pojo.
So, for example there is a convertor for Author and Book POJO. When I am converting the Author POJO to UI POJO, it calls the Book Convertor.
Now, every convertor takes as input a hibernate POJO and outputs a UI POJO. So, for composite objects, how do I control what should be converted and what not. Passing flags etc. just seems noob.
13 years ago