Matthew Young wrote:
log.error(Session.get().getId() + " " + Session.get().hashCode() + " " +
currentIp + " C: " + currentCustomer != null ? currentCustomer.getFullName()
: "nocustomer");
You should put parent around ?:. The '+' op is evaluated before "!=". Your
statement is effectively this:
Thanks, I found out earlier and have redeployed with parenthesis. I've also swapped out Session.get().getId()/hashCode() with just
getId()/hashCode() since I'm IN the session when I'm doing this :)
I would also like to submit some more code that might have something to do with the problem First up is my RequestCycleProcessor which I
override in the Application#init method:
@Override
protected IRequestCycleProcessor newRequestCycleProcessor() {
return new TornadoRequestCycleProcessor();
}
The point of this is to "mount" pages directly on /. What it does is basically pass some url's (starting with css/gfx or js to a
WebExternalResourceRequestTarget, or else sends the parameteres to a another page that will know how to get data from the database based on
the parameteres and display the correct page.
It's based on a tip from Igor a while back, so probably it's safe unless I
managed to severely fuck it up :)
I'll post another email with my custom UrlCodingStrategy as well.
Here is the code:
public class TornadoRequestCycleProcessor extends WebRequestCycleProcessor {
@Override
protected IRequestCodingStrategy newRequestCodingStrategy() {
return new TornadoRequestCodingStrategy();
}
private static class TornadoRequestCodingStrategy extends
WebRequestCodingStrategy {
private final TornadoUrlCodingStrategy strat = new
TornadoUrlCodingStrategy();
@Override
public IRequestTargetUrlCodingStrategy
urlCodingStrategyForPath(String path) {
IRequestTargetUrlCodingStrategy target =
super.urlCodingStrategyForPath(path);
if (target == null) {
target = strat;
}
return target;
}
}
private static class TornadoUrlCodingStrategy extends
BookmarkablePageRequestTargetUrlCodingStrategy {
public TornadoUrlCodingStrategy() {
super("/", PageModule.class, null);
}
@Override
public IRequestTarget decode(RequestParameters
requestParameters) {
String path = requestParameters.getPath();
if(path.startsWith("css") || path.startsWith("gfx") ||
path.startsWith("js"))
return new WebExternalResourceRequestTarget("/"
+ requestParameters.getPath());
if(requestParameters.getParameters().size() > 0) {
StringBuilder args = new StringBuilder("?");
Object[] keys =
requestParameters.getParameters().keySet().toArray();
Object[] values =
requestParameters.getParameters().values().toArray();
int size =
requestParameters.getParameters().size();
for(int i = size-1; i > -1; i--) {
Object[] valueMap = (Object[])
values[i];
args.append(keys[i] + "=" +
valueMap[0]);
if(i > 0)
args.append("&");
}
path = path + args.toString();
}
return new BookmarkablePageRequestTarget(PageModule.class, new
PageParameters("0=" + path));
}
}
}
-- Edvin
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]