[JBoss AS 7 Development] - Possible ThymeLeaf Integration
by Ondrej Zizka
Ondrej Zizka [https://community.jboss.org/people/ozizka] modified the document:
"Possible ThymeLeaf Integration"
To view the document, visit: https://community.jboss.org/docs/DOC-48038
--------------------------------------------------------------
ThymeLeaf is a templating engine.
http://www.thymeleaf.org/documentation.html http://www.thymeleaf.org/documentation.html
h2. Possible integration points
h4. In CDI, even standalone:
* http://www.thymeleaf.org/apidocs/thymeleaf/2.0.14/org/thymeleaf/context/I... IContext - the map of values available for the template. Those could be filled from CDI.
@Inject CDIThymeContext ctx;
By default, ThymeLeaf uses OGNL against the map of variables to resolve the expressions.
The interface IContext has only *http://127.0.0.1:8082/resource/jar%3Afile%3A/home/ondra/.m2/repository/org/thymeleaf/thymeleaf/2.0.14/thymeleaf-2.0.14-javadoc.jar%21/org/thymeleaf/context/IContext.html#getVariables%28%29 getVariables*(), so the values are not resolved per case - whole map needs to be given at the time of this call. https://github.com/thymeleaf/thymeleaf/issues/101 RFE
Therefore, the map provided by CDIThymeContext would probably have to
** list all beans CDI could deliver, limited to those marked as beans somehow (i.e. not "any class"),
** override the methods of VariablesMap which ThymeLeaf actually uses, and look up the beans lazily.* Unfortunatelly, this wouldn't work:
*** java.lang.UnsupportedOperationException
at cz.oz.thymeleaftry.cdi.LazyVariablesMap.size(LazyVariablesMap.java:27)
at java.util.HashMap.putAll(HashMap.java:597)
at org.thymeleaf.context.AbstractProcessingContext.createEvaluationRoot(AbstractProcessingContext.java:95)
* Also, we could make the template names type-safe, by introducing one qualifier per page.
// Inject object with the template "Home", the template engine, and CDIThymeContext.
@Inject @Template @Home ThymeTemplate tpl;
// Additional variables.
tpl.getContext().setVariable("foo", bar);
// Process.
tpl.process( response.getWriter() );
h4. Additionally, in Application Server:
* http://www.thymeleaf.org/apidocs/thymeleaf/2.0.14/org/thymeleaf/resourcer... IResourceResolver - to load resources from deployments. ThymeLeaf's ClassLoaderResourceResolver uses just
ClassLoaderUtils.getClassLoader(ClassLoaderResourceResolver.class).getResourceAsStream(resourceName);
* http://www.thymeleaf.org/apidocs/thymeleaf/2.0.14/org/thymeleaf/cache/ICa... ICacheManager - use InfiniSpan as cache.
* @Resource TemplateEngine templateEngine; - inject template engine configured as module. (Probably not much useful, ThymeLeaf is pretty simple, almost no config.)
* http://www.thymeleaf.org/apidocs/thymeleaf/2.0.14/org/thymeleaf/messagere... IMessageResolver - anything useful to get the strings from?
--------------------------------------------------------------
Comment by going to Community
[https://community.jboss.org/docs/DOC-48038]
Create a new document in JBoss AS 7 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=102&c...]
11 years, 5 months
[JBoss AS 7 Development] - Possible ThymeLeaf Integration
by Ondrej Zizka
Ondrej Zizka [https://community.jboss.org/people/ozizka] modified the document:
"Possible ThymeLeaf Integration"
To view the document, visit: https://community.jboss.org/docs/DOC-48038
--------------------------------------------------------------
ThymeLeaf is a templating engine.
http://www.thymeleaf.org/documentation.html http://www.thymeleaf.org/documentation.html
h2. Possible integration points
h4. In CDI, even standalone:
* http://www.thymeleaf.org/apidocs/thymeleaf/2.0.14/org/thymeleaf/context/I... IContext - the map of values available for the template. Those could be filled from CDI.
@Inject CDIThymeContext ctx;
By default, ThymeLeaf uses OGNL against the map of variables to resolve the expressions.
The interface IContext has only *http://127.0.0.1:8082/resource/jar%3Afile%3A/home/ondra/.m2/repository/org/thymeleaf/thymeleaf/2.0.14/thymeleaf-2.0.14-javadoc.jar%21/org/thymeleaf/context/IContext.html#getVariables%28%29 getVariables*(), so the values are not resolved per case - whole map needs to be given at the time of this call.
Therefore, the map provided by CDIThymeContext would probably have to
** list all beans CDI could deliver, limited to those marked as beans somehow (i.e. not "any class"),
** override the methods of VariablesMap which ThymeLeaf actually uses, and look up the beans lazily.
* Also, we could make the template names type-safe, by introducing one qualifier per page.
// Inject object with the template "Home", the template engine, and CDIThymeContext.
@Inject @Template @Home ThymeTemplate tpl;
// Additional variables.
tpl.getContext().setVariable("foo", bar);
// Process.
tpl.process( response.getWriter() );
h4. Additionally, in Application Server:
* http://www.thymeleaf.org/apidocs/thymeleaf/2.0.14/org/thymeleaf/resourcer... IResourceResolver - to load resources from deployments. ThymeLeaf's ClassLoaderResourceResolver uses just
ClassLoaderUtils.getClassLoader(ClassLoaderResourceResolver.class).getResourceAsStream(resourceName);
* http://www.thymeleaf.org/apidocs/thymeleaf/2.0.14/org/thymeleaf/cache/ICa... ICacheManager - use InfiniSpan as cache.
* @Resource TemplateEngine templateEngine; - inject template engine configured as module. (Probably not much useful, ThymeLeaf is pretty simple, almost no config.)
* http://www.thymeleaf.org/apidocs/thymeleaf/2.0.14/org/thymeleaf/messagere... IMessageResolver - anything useful to get the strings from?
--------------------------------------------------------------
Comment by going to Community
[https://community.jboss.org/docs/DOC-48038]
Create a new document in JBoss AS 7 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=102&c...]
11 years, 5 months
[JBoss AS 7 Development] - Possible ThymeLeaf Integration
by Ondrej Zizka
Ondrej Zizka [https://community.jboss.org/people/ozizka] modified the document:
"Possible ThymeLeaf Integration"
To view the document, visit: https://community.jboss.org/docs/DOC-48038
--------------------------------------------------------------
ThymeLeaf is a templating engine.
http://www.thymeleaf.org/documentation.html http://www.thymeleaf.org/documentation.html
h2. Possible integration points
h4. In CDI, even standalone:
* http://www.thymeleaf.org/apidocs/thymeleaf/2.0.14/org/thymeleaf/context/I... IContext - the map of values available for the template. Those could be filled from CDI.
@Inject CDIThymeContext ctx;
The interface IContext has only *http://127.0.0.1:8082/resource/jar%3Afile%3A/home/ondra/.m2/repository/org/thymeleaf/thymeleaf/2.0.14/thymeleaf-2.0.14-javadoc.jar%21/org/thymeleaf/context/IContext.html#getVariables%28%29 getVariables*(), so the values are not resolved per case - whole map needs to be given at the time of this call.
* Also, we could make the template names type-safe, by introducing one qualifier per page.
// Inject object with the template "Home", the template engine, and CDIThymeContext.
@Inject @Template @Home ThymeTemplate tpl;
// Additional variable
tpl.getContext().setVariable("foo", bar);
// Process
tpl.process( response.getWriter() );
h4. Additionally, in Application Server:
* http://www.thymeleaf.org/apidocs/thymeleaf/2.0.14/org/thymeleaf/resourcer... IResourceResolver - to load resources from deployments. ThymeLeaf's ClassLoaderResourceResolver uses just
ClassLoaderUtils.getClassLoader(ClassLoaderResourceResolver.class).getResourceAsStream(resourceName);
* http://www.thymeleaf.org/apidocs/thymeleaf/2.0.14/org/thymeleaf/cache/ICa... ICacheManager - use InfiniSpan as cache.
* @Resource TemplateEngine templateEngine; - inject template engine configured as module. (Probably not much useful, ThymeLeaf is pretty simple, almost no config.)
* http://www.thymeleaf.org/apidocs/thymeleaf/2.0.14/org/thymeleaf/messagere... IMessageResolver - anything useful to get the strings from?
--------------------------------------------------------------
Comment by going to Community
[https://community.jboss.org/docs/DOC-48038]
Create a new document in JBoss AS 7 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=102&c...]
11 years, 5 months
[JBoss ESB Development] - jbossesb-server-4.7\samples\quickstarts\webservice_producer
by carl lee
carl lee [https://community.jboss.org/people/carl918] created the discussion
"jbossesb-server-4.7\samples\quickstarts\webservice_producer"
To view the discussion, visit: https://community.jboss.org/message/781874#781874
--------------------------------------------------------------
h5. public class SendMessage
public static void main(String args[]) throws Throwable
{
String args1[] = {"jms"};
//String args1[] = {"socket","8888"};
SendMessage sm = new SendMessage();
String msg = getMessage("01");
String protocol = args1[0];
if(protocol.equals("jms")) {
sm.sendMessageOverJMS(msg);
} else {
sm.sendMessageToJBRListener(protocol, Integer.parseInt(args1[1]), msg);
}
}
h5. got the exception
23:37:16,424 INFO [JBossRemotingGatewayListener] JBoss Remoting Gateway listener 'listener' started.
23:37:16,474 INFO [JBossRemotingGatewayListener] JBoss Remoting Gateway listener 'listener' started.
23:38:08,653 INFO [ServiceInvoker] Badly formed EPR [EPR: PortReference < <wsa:Address http://localhost:8765/ http://localhost:8765/> >] for Service [MyServiceCategory:MyWSProducerService] and Message [header: [ ]].Courier for EPR not supported: ESB-unaware EPR used!
23:38:08,890 INFO [STDOUT] [Quickstart_webservice_producer] BEFORE invoking jbossws endpoint:
23:38:08,890 INFO [STDOUT] [<soapenv:Envelope xmlns:soapenv=" http://schemas.xmlsoap.org/soap/envelope/ http://schemas.xmlsoap.org/soap/envelope/" xmlns:good=" http://webservice_producer/goodbyeworld http://webservice_producer/goodbyeworld">
<soapenv:Header/>
<soapenv:Body>
<good:sayGoodbye>
<message>Goodbye!!</message>
</good:sayGoodbye>
</soapenv:Body>
</soapenv:Envelope>].
23:38:08,946 ERROR [SOAPFaultHelperJAXWS] SOAP request exception
java.lang.ClassCastException: org.jboss.ws.core.soap.EnvelopeBuilderDOM cannot be cast to org.jboss.ws.core.soap.EnvelopeBuilder
at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:275)
at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:195)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:447)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:284)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:201)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:134)
at org.jboss.soa.esb.actions.soap.SOAPProcessor.process(SOAPProcessor.java:187)
at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.processPipeline(ActionProcessingPipeline.java:634)
at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.processPipeline(ActionProcessingPipeline.java:586)
at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.process(ActionProcessingPipeline.java:420)
at org.jboss.soa.esb.listeners.message.MessageAwareListener$TransactionalRunner.run(MessageAwareListener.java:540)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
23:38:08,972 ERROR [RequestHandlerImpl] Error processing web service request
org.jboss.ws.WSException: java.lang.ClassCastException: org.jboss.ws.core.soap.SOAPMessageImpl cannot be cast to org.jboss.ws.core.soap.SOAPMessageImpl
at org.jboss.ws.WSException.rethrow(WSException.java:68)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:325)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:201)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:134)
at org.jboss.soa.esb.actions.soap.SOAPProcessor.process(SOAPProcessor.java:187)
at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.processPipeline(ActionProcessingPipeline.java:634)
at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.processPipeline(ActionProcessingPipeline.java:586)
at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.process(ActionProcessingPipeline.java:420)
at org.jboss.soa.esb.listeners.message.MessageAwareListener$TransactionalRunner.run(MessageAwareListener.java:540)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/781874#781874]
Start a new discussion in JBoss ESB Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 5 months
[JBoss AS 7 Development] - Authentication Service
by Darran Lofthouse
Darran Lofthouse [https://community.jboss.org/people/dlofthouse] modified the document:
"Authentication Service"
To view the document, visit: https://community.jboss.org/docs/DOC-47997
--------------------------------------------------------------
h1. Authentication Service
This article is do describe the new authentication service being added to AS7 to support security context proagation and connection re-authentication. Until the component is complete this article should be considered work in progress.
Due to the dependencies involved this service is developed as a stand alone project that will be subsequently integrated into the application server, most likely the security subsystem.
h3. Project Structure
The project (will) provide(s) the following: -
h4. Authentication Service
This is the core service running within the application server, this service is associated with all supported security realms and handles the authentication requests and the providing of the authenticated identities internally.
h4. Server API
Fer secured services looking to use the identities an API will be provided for direct access to the service. A permissions check on the SecurityManager (if any) will be performed to verify the call should be allowed, user code must not be able to interact with the service unless that permission is granted.
The server API may also provide an API that can be mapped to domain management operations to allow the state of the authentication service and the connection to be managed.
h4. Internal Client API
On the client side calls will be made to the remote authentication service using the defined protocol over Remoting - to simplify the use of the protocol this will be wrapped by an API - however this is most likely not the API that the clients will use to manage the associated identities.
Reporting the internal reasons for authentication failure to a client is generally bad - however despite this there are a lot of users asking that error messages can be sent to client. By default we should keep the errors server side only but do allow propagation to be switched on.
h4. Public Client API
This is the API that will be used by client applications to manipulate the identities associated with the current connection, use cases are being identified and the resulting API will be to solve those use cases.
The current discussions are along the lines that this will re-introduce the concept of a SecurityContext on the client side - this SecurityContext will allow the association of many identities that can then be selected for the actual invocations.
h4. Versioned Remoting Protocol
The protocol itself will live in it's own module, client and server side of the protocol will be written in parallel to ensure they remain in synch.
h3. Remoting Protocol
The protocol is a versioned protocol, this means that the client and server will negotiate to use the most up to date protocol that both sides understand. The only exception to this is that both sides will also allow for versions to be excluded either through configuration, their APIs or by system properties - the reason for this is that if a vulnerability or bug is found in a version of the protocol it can be excluded - this is applicable even for older versions as you may not want a client to force the use of an older version with a known issue.
The versioning will also indicate if the protocol version is from a Final release or an intermediate release, backwards compatibility is only maintained within a protocol once it has reached the final state.
h3. Security Permissions and Policies
The ability to both manipulate the client side SecurityContexts and the ability to access the service AND any associations with the Remoting Connection will be strictly protected using Permissions and the Java SecurityManager.
The development must output documented sample security policies that demonatrate how to grant the required permissions, the AS integration will also build on this to demonstrate the policy required server side.
As a stand alone project the testsuite of the project should also include full testing with a security manager and the sample policies.
h3. Application Server Integration
h4. Configuration
Items to be configured within the application server: -
The service itself is a generic service, initially this is being used for EJB invocations however this can potentially be used for all services so the configuration of the service needs to be central - I would suggest within the security subsystem.
The service will only be installed if the configuration is present.
* Available Realms
* Advertise Realms? Should clients be able to request a list of available realms.
* SASL Configuration - the capabilities of the realms guide this but additional overrides may be needed.
* Caching configuration - validity periods? limit per connection?
* Error propagation.
h4. EJB Container
The EJB container will need to be modified so that if a request is received with a token ID then the Server API should be used to obtain that identity and run the request as that identity.
Where a call is being made to a remote server there needs to be some form of switch to enable propagating the identity to the remote server, this most likely needs an API option and a configuration option to enable it.
h4. EJB Clients
The EJB client side in conjunction with the public client API will need to support the client side management and switching of identities and the passing of the selected token with the method invocation.
h4. Security Realms
The security realms now need to be updated as to support this feature a user authenticating to the server needs to be able request an alternative id for the authorization decisions.
--------------------------------------------------------------
Comment by going to Community
[https://community.jboss.org/docs/DOC-47997]
Create a new document in JBoss AS 7 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=102&c...]
11 years, 5 months