[coldbox:15487] Re: [coldbox-3.5.1] Injection Happy

In short, no.

WireBox does not use the session storage plugin to persist its session-scoped mappings. It uses as cf scope class that puts the references in [id] as opposed to the session storage plugin which places things in session.cbstorage[key].

Your object exist in session.currentDomain, but you are looking for it in session.cbstorage.currentDomain.
Dump out the session scope and you will be able to see everything.

But basically, you should probably either use the session storage plugin OR ask WireBox to manage the scope, but not both.

Thanks!

~Brad

Question, related.

I’m not clear on this…are mapped session scope wirebox references stored in the same way to session that makes them available to sessionStorage.getVar()? I thought this would work:

component extends=“coldbox.system.Interceptor” {
property name=“hostservice” inject=“id:hostservice”;
property name=“sessionfacade” inject=“coldbox:plugin:sessionStorage”;

public void function preProcess(event, interceptData) {
var rc = event.getCollection();
var prc = event.getCollection(private=true);
var cdom = sessionfacade.getVar(“currentDomain”);
var temp = hostservice.getByHost(rc.cgiscope.gethttphost());
prc.validationResults = validateModel( temp );
if( prc.validationResults.hasErrors() ){
getPlugin(“MessageBox”).error( prc.validationResults.getAllErrors() );
}
else{
cdom.setMemento(temp.getMemento());
arguments.event.setSESBaseURL(“http://” & rc.cgiscope.gethttphost() & “/index.cfm”);
}
};
}

…and the mapping is…

map(“currentDomain”).to(“model.domain.DomainHost”).into(this.SCOPES.SESSION).asEagerInit();

…but the setMemento() line fails because only an empty string is being returned from sessionStorage. This at first tells me one of two things might be true.

  1. I don’t know what I’m doing…there are not a lot of details for this plugin, though as far as it’s use, there probably don’t need to be…how it functions or why you would use in a practical way would be helpful.
  2. If you don’t setVar() with sessionStorage, you can’t getVar() expecting any session scoped variable would be validly returned from the CB framework.
    Thoughts & wisdom?

Mike