Mission Control: Prepare for landing
by Heiko Braun
I am glad to announce that we've begun preparing the 1.0 release of Errai:
http://anonsvn.jboss.org/repos/errai/branches/errai-1.0.x/
(Image courtesey of CBSNEWS)
We will add another round of QA during the next week and polish our documentation. If you are an early adopter, this would be a good time to tell us what problems you experience. So make sure to file your bugs and let us now through the mailing list.
/Heiko
14 years, 2 months
Errai Authentication
by Kevin Jordan
I'm wondering how authentication works (or is supposed to work) in Errai.
It seems from what I can gather, you're supposed to use doAuthentication in
the SecurityService, however, even if my custom AuthenticationAdapter does
nothing as it currently does (I was curious to see if I could get Spring
Security authentication information using it to pass it on since I can't
seem to in my services, which I can't in there either), but nothing calls
isAuthenticated or anything related to it later on even if I have
@RequireAuthentication or @RequireRoles on my services. In fact, it lets me
call the services even though as far as I think Errai knows, it should have
no authentication principals or roles. Is Authentication incomplete at this
point in time? At this time, I'm not requiring/needing the annotations, but
I do want to get my login information from Spring Security. I would
normally do it in the context of a servlet or jsp as:
try {
SecurityContext context =
SecurityContextHolder.getContext();
Object principal = null;
User user = null;
if (context != null) {
Authentication auth = context.getAuthentication();
if (auth != null) {
principal = auth.getPrincipal();
if (principal instanceof User) {
user = (User) principal;
logger.info(user.getUsername());
} else {
logger.debug("Principal is null or not a
User");
}
} else {
logger.debug("No authentication");
}
} else {
logger.debug("No context");
}
} catch (Exception e) {
logger.error("Error", e);
}
However, that doesn't seem to work, probably because it can't access the
ThreadLocal since I'm assuming most things in Errai, especially services,
get a new Thread? Is there any way for me to access the remote user from
the servlet? I doubt services get a link to the requesting servlet,
correct?
14 years, 2 months
RFC: public API, package split
by Heiko Braun
Please read carefully and let us know what you think.
We need to know if the early adopters out there would appreciate such a change
and can live with the impact it would have on existing implementations.
----
Before we branch the 1.0 release, I would suggest we split the public API according to the following
guidelines:
<module>.client.api.*: the general client API for anyone working with errai components
<module>.client.framework.*: module extension points, considered more like an SPI
The idea is to have two levels of public API, clearly identified by subpackage names.
One for working with errai (api.*) and one for extending errai (framework.*).
This allows users to focus on what they need, expecting most implementations to rely on the
client API (api.*), whereas integration with 3rd party technology would rely on the extension API (framework.*).
Javadocs should only be available for those subpackages and deprecation rules only allow
changes to that API in between major releases.
I've already prepared the workspaces module, but didn't touch the bus module yet.
Once we've come to an agreement, I would go ahead and prepare
the 1.0 release branch according to those guidelines.
/Heiko
14 years, 2 months
TheStore
by john destefano
Hi,
Having trouble with TheStore app. Ran mvn clean install in the parent
directory. Switched to the samples/TheStrore directory and ran mvn gwt:run.
The login box comes up then the screen goes blank. There is an error in the
Jetty console as follows:
00:00:19.021 [ERROR] Errors in
'file:/home/jdestef/workspaces/workspace-errai-bus/samples/TheStore/war/WEB-INF/classes/org/jboss/errai/demo/thestore/client/modules/MailSender.java'
00:00:19.021 [ERROR] Line 30: The import
org.jboss.errai.workspaces.client.svc cannot be resolved
00:00:19.021 [ERROR] Line 33: The type MailSender must implement the
inherited abstract method WSComponent.getWidget(WidgetCallback)
00:00:19.021 [ERROR] Line 59: Shoutbox cannot be resolved to a type
Thx
14 years, 2 months
TheStore Example
by John DeStefano
Hi,
A quick question on this example. I tries to run it with mvn gwt:run. The login dialog displays. After logging in the screen goes blank.
The error is:
00:02:22.845 [ERROR] Errors in 'file:/home/jdestef/workspaces/workspace-errai-bus/samples/TheStore/war/WEB-INF/classes/org/jboss/errai/demo/thestore/client/modules/MailSender.java'
00:02:22.845 [ERROR] Line 30: The import org.jboss.errai.workspaces.client.svc cannot be resolved
00:02:22.845 [ERROR] Line 33: The type MailSender must implement the inherited abstract method WSComponent.getWidget(WidgetCallback)
00:02:22.845 [ERROR] Line 59: Shoutbox cannot be resolved to a type
00:02:22.845 [ERROR] Line 59: Shoutbox cannot be resolved to a type
00:02:22.845 [ERROR] Line 74: Shoutbox cannot be resolved to a type
00:02:22.845 [ERROR] Line 77: Shoutbox cannot be resolved to a type
14 years, 2 months
Adding Marshalling/Demarshalling handlers?
by Kevin Jordan
Is there any easy way besides modifying JSONEncoder and TypeDemarshallHelper
to add something to convert a type for sending/receiving over the wire? I'm
wanting to do a subclass of Date for a DatePicker and want to serialize it a
String so TimeZone conversions don't need to happen on it since it'll
default to midnight for whatever the server timezone is. It seems as far as
TypeDemarshallHelper, I can just do a static add to
org.mvel2.DataConversion, but for JSONEncoder is doesn't seem that easy
since the handlers are added to a private Map. I assume on the client side,
it's as easy as adding a CustomFieldSerializer
(http://code.google.com/p/wogwt/wiki/CustomFieldSerializer)?
14 years, 2 months
@ExposeEntity and serialization of message parts
by Sean Flanigan
G'day,
I finally got my client and server talking on the same MessageBus, but I
discovered that my message parts were coming through (server->client) as
null. This was a silent failure - what happened to the "glorious
runtime exception"?. Anyway, I eventually found the post on errai-dev
about @ExposeEntity, and the new section in the documentation.
http://www.errai-framework.org/docs/html/en/#d0e362
The documentation says that classes annotated with @ExposeEntity will
have stubs generated for them, but this doesn't seem to be happening.
(NB: The docs & example should mention the need for Serializable; my
objects were originally designed for GWT-RPC, and implemented
IsSerializable.)
I've annotated both the concrete classes and the interface they
implement, but it doesn't look like the stub generator is even being
called. If it were, I think I would see the INFO logging in the JBoss
console at startup. Is there something else I need to do for these
stubs to be generated?
Do the stubs even work on the server, or are they client-side only?
Tracing the code, it seems like the ServerMessageBus calls JSONEncoder,
and I can't see where the stubs could come into it, even if they were
generated. (But perhaps I just don't understand the code well enough.)
JSONEncoder seems to be fairly happy as long as my objects implement
Serializable *and* provide getter methods for everything, but it doesn't
seem to handle Enums...
Hmm. I don't suppose anyone knows a way I can just ask GWT-RPC to
serialize my objects its way, and then just stick the result into a
message part?
Regards
Sean.
--
Sean Flanigan
Senior Software Engineer
Engineering - Internationalisation
Red Hat
14 years, 3 months
Sending a Date object?
by Kevin Jordan
Does anyone know if it's not possible to send a Date object to the client
over RPC (possibly at all)? I was doing a simple "return new Date();" in an
RPC endpoint and my client always seemed to get null back. As soon as I
changed it to a String, it worked fine, but I seem to always get a null for
a Date, even in a POJO. I can send them just fine to the server, oddly
though.
14 years, 3 months
Obtaining ErraiBus in the server with Seam
by Sean Flanigan
How can I obtain a reference to the MessageBus inside my Seam web
application on the server side?
I see that the ServerMessageBusImpl is being injected by Guice in
AbstractErraiServlet, but the injector instance seems to be private. So
even if I use Guice myself, it will be a different injector, and hence a
different singleton scope, right?
It looks like all the ErraiBus examples have server classes annotated
with @Service, and constructors which @Inject the MessageBus. I'm not
sure if I can do exactly that. For the moment, I would like to
construct the objects myself. If I could obtain the right Guice
injector, I could call Injector.injectMembers on the objects which need
the MessageBus.
Hmm. I'm not going to have to re-architect everything, am I? (BTW,
unlike the examples, I'm not implementing MessageCallback on the server,
I just want to send messages on the same bus that my clients are polling.)
So is there some way I can obtain a reference to the Injector or the
ErraiService from "outside"? Or will I have to annotate a class with
@Service? It looks to me as if ErraiServiceConfiguratorImpl wants to
construct the object itself (via Guice), which probably won't work for
Seam components...
Am I going about this all wrong, or what?
Thanks
Sean.
--
Sean Flanigan
Senior Software Engineer
Engineering - Internationalisation
Red Hat
14 years, 3 months