JBoss Portlet Bridge

  • 1,223 views
Uploaded on

Palestra do JBoss In Bossa 2011 …

Palestra do JBoss In Bossa 2011
Brasília, 08/10/2011

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,223
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
16
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. JBoss Portlet Bridge A Ponte entre Portais e Aplicações Rafael Liu JBoss ConsultantJBossInBossa 2011 - Brasilia
  • 2. O que são Portais? • "[A portal] provides a secure unified access point, [...] and is designed to aggregate and personalize information through application- specific portlets" - WikipediaJBossInBossa 2011 - Brasilia
  • 3. O que são Portais? • Aglomerador de conteúdo • notícias, eventos, etc • Hotsites e subsites • campanhas, setores, etc • Colaboração • forum, chat, etcJBossInBossa 2011 - Brasilia
  • 4. JBossInBossa 2011 - Brasilia
  • 5. JBossInBossa 2011 - Brasilia
  • 6. JBossInBossa 2011 - Brasilia
  • 7. Portais em Java • Portlets • JSR 168 - Portlets 1.0 • JSR 286 - Portlets 2.0 • Portlet ContainerJBossInBossa 2011 - Brasilia
  • 8. GateIn • Solução de portal Red Hat / eXo (JBoss EPP) • Portável (WCI): JBoss, Tomcat, ..?.. • Padrões • JSR 168 - Portlets 1.0 • JSR 286 - Portlets 2.0 • JSR 170 - Java Content Repository • Open SocialJBossInBossa 2011 - Brasilia
  • 9. GateIn • Provê nativamente • Navegação, breadcrumbs, site maps, segurança • Provê através de módulos • Forum, enquetes, lista de contatos, calendário, agenda, web mail, FAQ, chat, perguntas e respostas, gerenciamento de conteúdo, versionamento, fluxo de publicação, auditoria, redes sociais, mashups, ...JBossInBossa 2011 - Brasilia
  • 10. Especificação Portlets public class SimplePortlet extends GenericPortlet { @Override protected void doView(RenderRequest req, RenderResponse resp) throws PortletException, IOException { resp.getWriter().println("Hello world"); } }JBossInBossa 2011 - Brasilia
  • 11. Déjà vu??JBossInBossa 2011 - Brasilia
  • 12. Especificação Servlet public class SimpleServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { resp.getWriter().println("Hello world"); } }JBossInBossa 2011 - Brasilia
  • 13. E tem JSP também! public class SimplePortlet extends GenericPortlet { @Override protected void doView(RenderRequest req, RenderResponse resp) throws PortletException, IOException { getPortletContext() .getRequestDispatcher("/portlet.jsp") .include(request, response); } }JBossInBossa 2011 - Brasilia
  • 14. Usando JSP <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%> <form method="post" action="<portlet:actionURL/>"> Name: <input type="text" name="name" value=""> <div id="<portlet:namespace />_mydiv"/> <input type="submit" name="submit" value="Say hello"> </form>JBossInBossa 2011 - Brasilia
  • 15. Usando JSP? <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%> <form method="post" action="<portlet:actionURL/>"> Name: <input type="text" name="name" value=""> <div id="<portlet:namespace />_mydiv"/> <input type="submit" name="submit" value="Say hello"> </form>JBossInBossa 2011 - Brasilia
  • 16. E não podia faltar um XML..JBossInBossa 2011 - Brasilia
  • 17. portlet.xml <portlet-app> <portlet> <portlet-name>SimplePortlet</portlet-name> <display-name>SimplePortlet</display-name> <portlet-class>net.rafaelliu.net.SimplePortlet</portlet-class> <supports> <mime-type>text/html</mime-type> <portlet-mode>VIEW</portlet-mode> </supports> <portlet-info> <title>SimplePortlet</title> </portlet-info> </portlet> </portlet-app>JBossInBossa 2011 - Brasilia
  • 18. E agora?JBossInBossa 2011 - Brasilia
  • 19. O que são Portlet Bridges? • "The Portlet Bridge for JavaServer Faces is a technology that sits between a portlet container and the JSF runtime enabling JSF applications to be exposed and run as portlets" - MyFaces Portlet Bridge FAQ • Faz adequações necessárias para transformar o ambiente provido pelo portal no ambiente esperado pelo JSFJBossInBossa 2011 - Brasilia
  • 20. Por que utilizar? • Diminuir a curva de aprendizado • Tornar API Portlet mais transparente • Facilitar a integração com sistemas legados JSFJBossInBossa 2011 - Brasilia
  • 21. Diminuir a curva de aprendizado • O desenvolvimento é feito todo em cima de JSF • Frameworks • Componentes • ToolingJBossInBossa 2011 - Brasilia
  • 22. Tornar API mais transparente • Trata da criação de IDs com namespaces • Trata da reescrita de URLs (referências e links) • Encapsula a session (PORTLET_SCOPE e APPLICATION_SCOPE)JBossInBossa 2011 - Brasilia
  • 23. Portlet Bridge VS IFrame • Redimensionamento natural • URLs no IFrame redirecionam para fora do portal • O alvo do IFrame precisa ser acessível do browser • Controle identidade visual (CSS) e JavaScriptJBossInBossa 2011 - Brasilia
  • 24. JBoss Portlet Bridge • JSF / RichFaces / JBoss Seam • GateIn e JBoss Portal • Versões • JBPB 1.x (JSR-301): JSF 1.2 para Portlet 1.0 • JBPB 2.x (JSR-329): JSF 1.2 para Portlet 2.0 • JBPB 3.x (JSR-?): JSF 2.0 • http://community.jboss.org/wiki/JBossPortletBridgePr ojectLayoutJBossInBossa 2011 - Brasilia
  • 25. Demo!JBossInBossa 2011 - Brasilia
  • 26. Inter-portlet Communication (IPC) • Portlet 2.0 • Public Render Parameter • EventingJBossInBossa 2011 - Brasilia
  • 27. Portlet Preferences Object request = FacesContext.getCurrentInstance(); .getExternalContext() .getRequest(); PortletRequest portletRequest = (PortletRequest)request; PortletPreferences portletPreferences = portletRequest.getPreferences(); // gravando portletPreferences.setValue("link", link); portletPreferences.store(); // lendo link = portletPreferences.getValue("link", "http://rafaelliu.net");JBossInBossa 2011 - Brasilia
  • 28. Dúvidas? @rafaelliu http://jboss.org/portletbridge http://rafaelliu.net http://jboss.org/gateinJBossInBossa 2011 - Brasilia