Tim Sparg

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

Recent posts by Tim Sparg

Hi all

I need some help understanding json, and how it is returned.

I've got a simple user object (usercode,userFirstname,userSurname,pwChanged).
Which is represented like so in in json

This I completely understand. However when I get a List of the user objects from Glassfish, I get the following

When I try and pass this through something like Google GSON I get an error until I change the json string to look like the following

Note the removal of the {"user"[]} that surrounded the first list.

Am i misunderstanding something here?
13 years ago
I've been browsing around trying to work this out - I think this is how it works, but then again I might be conpletely misdirected

http://companyA.example.com resolves to myserver:765
http://companyB.example.com resolves to myserver:234

Either your application picks up what port the request is coming through and from there is able to serve unique content for the company/user
You have some kind of proxy/filter sitting in front of your application that puts something into the http header like "companyCode", then your application is on the look out for the companyCode http header

Does any of this sound roughly right?

there are websites out there that have the following url schema

so in our example we will use these 2 urls.
  • http://companyA.example.com
  • http://companyB.example.com

  • When you go to http://companyA.example.com the logo for the company shows up on the landing page.
    The same happens when you go to http://companyB.example.com

    How does this work?

    Apparently the problem is around type erasures...

    anyway the solution i found was to use an Array instead of a List

    13 years ago
    I'm trying to write some generic code that simplifies things for other developers in my company.

    I'm currently getting stuck returning a list of generic items from a REST web service

    the getList1(..) method functions perfectly, but the moment I take the concrete class references out and try and replace them with generics ( getList.(..) ) i get the following exception from my webservice:

    com.sun.jersey.api.client.ClientHandlerException: A message body reader for Java type, interface java.util.List, and MIME media type, application/xml, was not found

    am I declaring my generic code incorrectly?

    13 years ago

    Thanks, that was exactly what I was looking for

    13 years ago
    Hi guys

    I'm having fun with regex, and hope somebody can help me out.

    I have a string that will be along the lines of "/bleh/yadda/{userCode}/{blah}"
    I'm trying to use regex to isolate userCode and bleh

    Currently I have

    which returns me '{userCode}'

    Now I've got 2 issues here.
    Firstly I can't seem to get the pattern to pick up multiple matches ie - '{blah}'
    I've tried

    and variations thereof, but then the whole pattern seems to go out of wack.

    Secondly, is there any way that I can remove the { and } characters from being returned from the match?
    So I still want the characters in the string, I just don't want them as part of the result
    13 years ago
    Although I didn't ask to meany questions i definitely utilised the search button a fair amount on this forum.
    So thanks for the help!

    13 years ago
    for the username

    edit sorry just re-read that, you're looking for the session ID not userID
    13 years ago
    Was just coming here to post the same thing ... Oh well, I'll just have to get the studyguide (when it comes out) and go give it another bash
    did anybody here take the Java EE6 Java Persistence API Developer Exam?

    I don't see another topic for it, and I thought you bunch would be the most likely to have participated!

    Mikalai Zaikin wrote:

    Tim Sparg wrote:I prefer to think that the quality of the candidates was exceptionally high

    Probably because the Beta costed $50 - so people spent time on reading docs before rushing to test center.

    Which is still cheaper than the exam will be.

    My attitude was that if I pass it cool, otherwise it was a slightly pricey test
    I prefer to think that the quality of the candidates was exceptionally high
    Thanks for the tip guys, just checked and i Passed!!
    The last that I've heard was mid February