Store an XMPPConnection (Smack chat library obj) in a session

Hello all,
I am attempting to develop a web based chat client (I have already seen jwchat and some others) using the open source Smack libraries.
I want a way to maintain the XMPPConnection object in the session.
Below is some code I am using:
//here is a method within my class file that will return a XMPPConnection object (this is a connection to a XMPP chat server) it also attaches a listener to the connection object.
//Called when the user submits his/her credentials..
//This works fine as I can see a connection in the chat server admin page.
   public XMPPConnection getConnx(String user, String pwd) throws XMPPException
       XMPPConnection connx = new XMPPConnection(HOST,PORT);
       PacketTypeFilter filter = new PacketTypeFilter(Message.class);
       connx.addPacketListener(messageListener,filter);
       connx.login(user,pwd);
       System.out.println("getConnx called");
       return connx;
//This is a method that creates the chat. I call this from  a jsp using Ajax to a servlet see below:
   public void setChat(String msg,String user,Object connex) throws XMPPException
       XMPPConnection connx = (XMPPConnection) connex;
       Chat chat = connx.createChat(user+"@asterisk1.local");
       Message message = chat.createMessage();
       message.setBody(msg);
       chat.sendMessage(message);
       System.out.println("ORIGIINATE from this conx="+connx.getConnectionID());
//below is the ajax call to SendChat.java (servlet)
    var file = "SendChat?user="+User+"&message="+Message+"&connx="+<%=session.getAttribute("connection")%>;
//then SendChat calls the  above setChat method like so:
            String message = request.getParameter("message");
            String user = request.getParameter("user");
            XMPPConnection connx = (XMPPConnection) request.getAttribute("connection");
           webconnect.setChat(message,user,connx);I am getting a null pointer exception that points to the setChat method (the following line):
Chat chat = connx.createChat(user+"@asterisk1.local");I am thinking that I cannot store the connection in the session?
Can I ?
If so does it look like I am storing and passing the connection properly?
Here is one more line of code from the jsp that actually creates the session:
session.setAttribute("connection",chatt.getConnx(request.getParameter("id"),request.getParameter("pwd")));TIA!

Dear Gforty
I'm sending this message after checking part of your XMPP sources using Smack chat library at Java forum.
I'm planning to a make web-based chatting program and I would like to get some idea from your sources if you don't mind.
Could you send me the whole sources to the following e-mail address, please?
I hope your reply, thank you
[email protected] !!!

Similar Messages

  • I downloaded 11.1 but now can't access the store, can only view my library. I've reinstalled but still get a blank, white screen when I try to go to the itunes store. How can I get to the store for purchases?

    I downloaded 11.1 but now can't access the store, can only view my library. I've reinstalled but still get a blank, white screen when I try to go to the itunes store. How can I get to the store for purchases?

    In iTunes prefs>Store - is the Store check box unchecked?
    Did you repair pemissions with Disk Utility?
    MJ

  • HT1918 Is there a way to transfer iTunes Store purchases or an iTunes library from one user to another?

    Is there a way to transfer iTunes Store purchases or an iTunes library from one user to another?
    Historically, I have my own laptop and my 8 year old daughter has a laptop as well.  I also have an iPad and iPhone.  In the past, I have managed all devices with the same apple ID, and used my laptop as the main library, storing all music, apps, video, etc.  I then  just selectively copied things to the other authorized devices, so my daughter's laptop has a copy of her music under my apple ID.  Now she has her own iPod touch, so I would live to move her music and apps to her own iTunes library with a name I create for her on her laptop and iPod.
    Is this possible without having to repurchase all of her media?

    Welcome to AD!
    You can try these Apple directions
    http://support.apple.com/kb/HT1329
    Or buy a 3rd-party ipod manager such as CopyTrans.

  • I am trying to store my sister's nano library on windows vista, her nano is formatted in mac.  Is there a way I can preserve her music and not lose it by restoring the original settings.

    I am trying to store my sister's nano library on windows vista p.c. The nano is formatted using a macintosh system.  Is there away that I can store the music on window vista?

    awoodburn wrote:
    Is there a way to get these non-intunes store bought songs into my newly downloaded itunes library?
    check out this post by Zevoneer.

  • TS1741 How can I store music in my remote library in my iPad library

    How can I store music in my remote library in my iPad library

    I don't know what your remote library is so you will have to explain that one.
    Music is stored in the music app and it gets into the Music app via the sync process with iTunes on your computer or direct downloads from the iTunes Store on your iPad.

  • Semi Guage Meter Chat Library File

    Is there any Semi Guage Meter Chat Library File? If have any one link for this, Can u do post that URL link?

    Not sure what you meant by chat library, but if you want a guage, you can have a look at this one and tweak it to make it semi guage as per your requirement:
    http://www.brightpointinc.com/flexdemos/gauge_v04/gauge_v04.html

  • Error in running a query in XSJS - column store error: [2950] user is not authorized :  at ptime/session/dist/RemoteQueryExecution.cc:1354]

    Hi All,
    I get the below error when i load my xsjs file in browser,
    Error while executing query: [dberror(PreparedStatement.executeQuery): 2048 - column store error: column store error: [2950] user is not authorized : at ptime/session/dist/RemoteQueryExecution.cc:1354]
    I am able to execute the same query in  HANA SQL editor
    Please note that ,No Analytical privileges are applied to the view.
    Could you please help solving this issue.
    Regards,
    Logesh Kumar.

    Hay,
    are you using the same Database user for both SQL Editor and XSJS ?
    try the following.
    Before executing the query , display it and copy the same from browser and execute in SQL editor.
    Put the statement in  a try catch block and analyse the exception .
    Sreehari

  • "show in itunes store" command missing from video library

    updated to itunes 11.1, and ios7.
    This isn't a pro or con diatribe, just a list of the minorish bugs that i have noticed:
    First (probable?) bug:
    With the latest update, the (control click) "show in itunes store" command is missing from all video layouts (unwatched, shows, genres) except "list".
    I assume this is just a temporary bug, as it limits easy access to purchasable store content.
    This is especially important since "check for available downloads", while still around, has been, as far as i can tell, completely nonfunctional for months.
    I now have all my email notifications for passes turned on, and just manually click on the emails to download new content.
    However, especially for shows with extra content, sometimes the email doesn't download the actual show, just the extra content.
    for this reason, and for non pass shows, and just for general shopping and impulse buys, I liked to use the "show in itunes store" to easily check shows that i am currently interested in.
    except that now it is gone.
    Another (probable) bug:
    I have a lot of purchased content, so i have the cloud turned off to control the flow of menu information.  i don't need to see everything i have purchased all the time, only the newest shows that i actually have loaded onto the ipad.  I still just load in the shows i want to watch from my main computer after i have downloaded them from apple to the hard drive, which i guess is now a bit old fashioned.  ios7 doesn't seem to like this very much, as it initially displays the cloud content when opening the "video" app, before blanking and replacing it with the edited down version. But the real bug is this:
    Now when i delete a video on the ipad, it crashes the "video" app.
    And, instead of recognizing the delete when i sync to the computer, it ignores it and reloads the video onto the ipad.
    ......And finally:
    There is still a tendency for the ipad and itunes to throw up the "sign in" pop up, often multiple times in a row, anywhere and for no reason, even when i am already signed in. Sometimes i can just hit "cancel" and it disappears, other times it forces me to retype my password.  It's gotten a lot better and less frequent than when it first started earlier this year, but it's still around. 
    Having said this, I'm still, of course, a huge fan of the change earlier this year that keeps track of purchases and allows me redownload, instead of the old "lose it and its gone, tough luck" policy. 

    Ha.  Maybe it's just me then.  When i control click on a show, i'm getting:
    In Library/TV Shows:  Unwatched, Shows, and Genres:
    play "[show]"
    mark as watched
    mark as unwatched
    [depending on blue dot]
    get info
    rating
    show description
    show in finder
    reset plays
    show in playlist
    copy
    as opposed to, in List (and everywhere else):
    play "[show]"
    mark as watched
    mark as unwatched
    [depending on blue dot]
    get info
    rating
    show description
    show in finder
    show in itunes store
    get album artwork
    reset plays
    consolidate files
    new playlist from selection
    add to playlist
    show in playlist
    copy
    delete
    uncheck selection
    apply sort field
    I have my sidebar turned on, but it doesn't seem to make a difference if it is showing or not.
    I looked around in settings, view, and window for a way to modify the control click menu, but couldn't find anything.
    It's a very minor issue.
    If your menu is working, maybe I just need to delete my copy of itunes and reinstall.  Or change a setting somewhere.

  • My recent purchases show up in the iTunes store but not in my library and when I try to transfer it, it says "This Computer is already associated with an Apple ID"

    I just got a new iPhone 4S to replace my old iPhone 4S. There were some songs I purchased on my iPhone that were not on my iTunes library on the Mac. Now I lost them. The thing is, if I open the iTunes store on my Mac and go to "Purchased", the songs I bought on my old iPhone show up. They are also in my library, but there is an exclamation point next to them and they will not download onto my new iPhone! Help!!!!

    I'm having the exact same problem and I am the only person who has ever been logged on to this computer to use iTunes Match.  Only my wife also uses this computer, and she has never used or signed up for Match. 
    Interestingly, I have the same number of days listed on my error, 82 days.
    Obviously, Apple has screwed up somewhere.  I've put a help request in.  If we cannot find a solution, we'll have to let everybody know that Match is a ripoff and that all should avoid this fraud like the plague...
    Shalom, y'all!
    L. Bangs

  • Can u help me please: ios 5 and 6 aren't working i prefer 5 over 6 cause when i updated both ipod touch 4 and my pc itunes to ios 6 it freezes and crashes on both and in app store as well as music library and when playing music it repeatssticksawfulbeeps

    i liked ios 5 better but still had problems but now since i updated to ios 6 on both my pc itunes and ipod touch 4 my music library glithches freezes skips crashes sticks repeats when i play my music and it's unbearable especially since i'm a huge adele fan and can't listen to her wonderful voice properly and i'm experiencing problems syncing my ipod touch and when i connect to the app store on my ipod touch it always crashes and i can't connect to download new apps the only problems i had with ios 5 was sometimes when i use safari on my ipod touch it would occasionally crash but i would rather revert back to ios 5 than be stuck with ios 6 please fix this or revert the software please i'm frustrated and want this resolved and ios 6 is the worst software update i have ever had.
    thank you

    For the App store crashing see:
    IOS 6 App store crash: Apple Support Communities
    For othe other problems try:
    Try:
    - Reset the iPod. Nothing will be lost
    Reset iPod touch: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Reset all settings
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup
    - Restore to factory settings/new iPod.

  • I cannot connet to app store using wifi in the library

    I have recently been in the local library to connect to the app store via wi fi as this is required for some apps but i cann connect to i tunes or the app store, i can connect to the net BBC i player etc.
    Does anyone know why i cannot connect

    The library network probably has a firewall which is blocking use of the ports needed to access the App store.
    See this Apple for information: http://support.apple.com/kb/ts3297

  • Why are all the purchased in my store homepage not in my library  purchased

    I have many more songs in my store "purchased" list that are not in my library purchased or playlist.

    I don't know what happened, but if you're sure Lightroom has the settings you want for them, just save (xmp) metadata to resolve the conflict.
    e.g. select all then press ctrl/cmd-s.

  • Previous Store purchases not showing in library

    So This might have been answered previously, or might be a stupid question. But I can't find the answers I seek.
    I've got quite a few TV Shows, Movies, Music Albums etc. That I've bought off Itunes.
    I can see them if I go to my iTunes store>Purchased list. I can't see them in my library.
    Please note, if I download these TV Shows, movies, etc. They will show up in the library.
    Now my question is.. Why do I have to download these from the 'purchased' page from the iTunes store, where previously this was not required.
    All content. Downloaded, or not. Would show up in my library and I was just able to stream it if I could.
    I would prefer to stream the content if I could, and I would like to be able to view it all in the library without much trouble.
    As I said before, initially, everything would be displayed in the library..
    Any help would be appreciated. Thanks.
    - Lincoln

    Either they never downloaded properly...or something very strange is going on with your computer. First, check to make sure all of your purchases have been downloaded. To do this, when you're in iTunes go to the top toolbar and click on "Store" and then from this menu pick "check for purchases"/"check for available downloads" (option depends upon the version of iTunes you have installed). If you get a message telling you all of your purchases have been downloaded...then you need to contact the iTunes store and explain your problem.

  • I downloaded the album "ALBA" and six songs came thru with only 2-4 bars..I posted this and Varyak paw told me to delete them and then sign into the itunes store and click on the Library button in the upper rt corner .... BUT I have no library button

    I followed the instructions exactly but I have no library button in the upper rt. corner.  I made sure that I have "show Itunes in the cloud Purchases" checked and nothing I do works so I clicked on the link to apple support and it just sits there forever making little circles... Help?

    If iTunes says "iTunes Store" at the upper-right, then you're already viewing your Library and don't need to locate that button. But if clicking the cloud icons directly in the iTunes library listing doesn't work, try this, presuming you're using iTunes 11:
    - Delete the problem tracks from the iTunes library if you haven't done so already;
    - Locate the "iTunes Store" button at the upper-right. If you see "library" instead, you're already viewing the iTunes Store.
    - Click the Purchased link under the Quick Links;
    - Log into your iTunes Store account if necessary;
    - Locate the album in the sidebar;
    - Locate the problem tracks and click the "cloud" icon.
    If you are running iTunes 10.7, see the section titled "Using iTunes 10.7 or earlier" in the support article to which I linked in your previous thread.
    If you still have problems downloading or the tracks still are defective, you'll need to contact the iTunes Store. That you can't use the link I posted in your other thread either, that may indicate a connection problem in your computer, perhaps security software blocking access to the iTunes Store.
    Regard.
    BTW, it would have been better if you'd have continued this in your previous thread rather than starting a new topic, so that anyone reading had the full story on which to base further advice.

  • Why doesn't my podcast cover art show in store but appears in iTunes library after I subscribe?

    My podcast cover art is not showing up in the iTunes store: https://itunes.apple.com/us/podcast/liberation-radio/id591038133
    As soon as I subscribe via iTunes on my computer and look at the podcast in the Library, the cover art is there. I can't figure out what's wrong. The image is 1400x1400. The original feed submitted to iTunes is here: http://feeds.feedburner.com/LiberationRadio
    Can anyone assist? Thanks in advance!

    Great, that explains it. We had moved the image to a new URL and actually updated the original feed that we input into Feedburner with that URL ... but we also had Feedburner Smartcast turned on which creates its own iTunes tags and overrides any that may already be in the feed, and the image URL in Smartcast there was the old one.
    In any case, we not only updated Feedcast Smartcast with the correct image URL, but we also put a copy of the image at the old URL so that even the URL presently used by iTunes should work.
    Any idea how long it takes for the store to update the cover art? Anything we can do to expedite it?
    Thanks!

Maybe you are looking for