Material (incompleto) das aulas de Struts 2.x ministradas no curso de especialização em Sistemas Orientados a Objetos da Universidade Católica de Brasília.
How To Deliver High Performing Highly Available Cloud ApplicationsBen Rushlo
Whether you are just starting to think about adopting a cloud model or have already implemented this in your organization, by moving from on-premise applications to the cloud you are giving up lots of control. How do you make sure you meet end-users’ performance expectations when someone else takes the reigns? End-users expect sub 1s response times as your on-premise apps did. How can you ensure such performance with your cloud service provider? Web performance is paramount for your users and not having the right metrics in place to remain in control can lead to costly performance issues.
[WSO2Con EU 2017] Microservice Architecture (MSA) and Integration MicroservicesWSO2
Microservice architectures (MSA) are becoming popular and a lot of enterprises have already segregated their monolithic applications to fine-grained services. But, a major challenge they're faced with is how to integrate/orchestrate among those microservices and create composite services. This slide deck explores how to overcome this challenge and real-world use cases.
In this webinar the CTO and Product Management Director of Service2Media explain about the Service2Media App Lifecycle Platform - M2Active. M2Active is the technique behind the platform: Architecture and Runtimes. This webinar is rather technical and especially interesting for CIO's or app development and IT staff that are interested to use The App Lifecycle Platform to develop portfolio's of core and critical App's.
Both Ember.js & Backbone.js are capable JavaScript frameworks. Are you confused to make selection between both?Hire a web development companies in PHP to reduce the amount of time and coding needed to carry out the development process.
How To Deliver High Performing Highly Available Cloud ApplicationsBen Rushlo
Whether you are just starting to think about adopting a cloud model or have already implemented this in your organization, by moving from on-premise applications to the cloud you are giving up lots of control. How do you make sure you meet end-users’ performance expectations when someone else takes the reigns? End-users expect sub 1s response times as your on-premise apps did. How can you ensure such performance with your cloud service provider? Web performance is paramount for your users and not having the right metrics in place to remain in control can lead to costly performance issues.
[WSO2Con EU 2017] Microservice Architecture (MSA) and Integration MicroservicesWSO2
Microservice architectures (MSA) are becoming popular and a lot of enterprises have already segregated their monolithic applications to fine-grained services. But, a major challenge they're faced with is how to integrate/orchestrate among those microservices and create composite services. This slide deck explores how to overcome this challenge and real-world use cases.
In this webinar the CTO and Product Management Director of Service2Media explain about the Service2Media App Lifecycle Platform - M2Active. M2Active is the technique behind the platform: Architecture and Runtimes. This webinar is rather technical and especially interesting for CIO's or app development and IT staff that are interested to use The App Lifecycle Platform to develop portfolio's of core and critical App's.
Both Ember.js & Backbone.js are capable JavaScript frameworks. Are you confused to make selection between both?Hire a web development companies in PHP to reduce the amount of time and coding needed to carry out the development process.
Plano de ensino da disciplina Construção de Software ministrada no Programa de Pós-graduação em Computação Aplicada da Universidade de Brasília entre 13/05 a 08/07/2016.
Apresentação da disciplina Construção de Software apresentada no Mestrado em Computação Aplicada da Universidade de Brasília no 1º semestre de 2014. https://matriculaweb.unb.br/matriculaweb/posgraduacao/oferta_dados.aspx?cod=301906
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...Neo4j
Leonard Jayamohan, Partner & Generative AI Lead, Deloitte
This keynote will reveal how Deloitte leverages Neo4j’s graph power for groundbreaking digital twin solutions, achieving a staggering 100x performance boost. Discover the essential role knowledge graphs play in successful generative AI implementations. Plus, get an exclusive look at an innovative Neo4j + Generative AI solution Deloitte is developing in-house.
GridMate - End to end testing is a critical piece to ensure quality and avoid...ThomasParaiso2
End to end testing is a critical piece to ensure quality and avoid regressions. In this session, we share our journey building an E2E testing pipeline for GridMate components (LWC and Aura) using Cypress, JSForce, FakerJS…
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
How to Get CNIC Information System with Paksim Ga.pptxdanishmna97
Pakdata Cf is a groundbreaking system designed to streamline and facilitate access to CNIC information. This innovative platform leverages advanced technology to provide users with efficient and secure access to their CNIC details.
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIVladimir Iglovikov, Ph.D.
Presented by Vladimir Iglovikov:
- https://www.linkedin.com/in/iglovikov/
- https://x.com/viglovikov
- https://www.instagram.com/ternaus/
This presentation delves into the journey of Albumentations.ai, a highly successful open-source library for data augmentation.
Created out of a necessity for superior performance in Kaggle competitions, Albumentations has grown to become a widely used tool among data scientists and machine learning practitioners.
This case study covers various aspects, including:
People: The contributors and community that have supported Albumentations.
Metrics: The success indicators such as downloads, daily active users, GitHub stars, and financial contributions.
Challenges: The hurdles in monetizing open-source projects and measuring user engagement.
Development Practices: Best practices for creating, maintaining, and scaling open-source libraries, including code hygiene, CI/CD, and fast iteration.
Community Building: Strategies for making adoption easy, iterating quickly, and fostering a vibrant, engaged community.
Marketing: Both online and offline marketing tactics, focusing on real, impactful interactions and collaborations.
Mental Health: Maintaining balance and not feeling pressured by user demands.
Key insights include the importance of automation, making the adoption process seamless, and leveraging offline interactions for marketing. The presentation also emphasizes the need for continuous small improvements and building a friendly, inclusive community that contributes to the project's growth.
Vladimir Iglovikov brings his extensive experience as a Kaggle Grandmaster, ex-Staff ML Engineer at Lyft, sharing valuable lessons and practical advice for anyone looking to enhance the adoption of their open-source projects.
Explore more about Albumentations and join the community at:
GitHub: https://github.com/albumentations-team/albumentations
Website: https://albumentations.ai/
LinkedIn: https://www.linkedin.com/company/100504475
Twitter: https://x.com/albumentations
Dr. Sean Tan, Head of Data Science, Changi Airport Group
Discover how Changi Airport Group (CAG) leverages graph technologies and generative AI to revolutionize their search capabilities. This session delves into the unique search needs of CAG’s diverse passengers and customers, showcasing how graph data structures enhance the accuracy and relevance of AI-generated search results, mitigating the risk of “hallucinations” and improving the overall customer journey.
Pushing the limits of ePRTC: 100ns holdover for 100 daysAdtran
At WSTS 2024, Alon Stern explored the topic of parametric holdover and explained how recent research findings can be implemented in real-world PNT networks to achieve 100 nanoseconds of accuracy for up to 100 days.
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofsAlex Pruden
This paper presents Reef, a system for generating publicly verifiable succinct non-interactive zero-knowledge proofs that a committed document matches or does not match a regular expression. We describe applications such as proving the strength of passwords, the provenance of email despite redactions, the validity of oblivious DNS queries, and the existence of mutations in DNA. Reef supports the Perl Compatible Regular Expression syntax, including wildcards, alternation, ranges, capture groups, Kleene star, negations, and lookarounds. Reef introduces a new type of automata, Skipping Alternating Finite Automata (SAFA), that skips irrelevant parts of a document when producing proofs without undermining soundness, and instantiates SAFA with a lookup argument. Our experimental evaluation confirms that Reef can generate proofs for documents with 32M characters; the proofs are small and cheap to verify (under a second).
Paper: https://eprint.iacr.org/2023/1886
Communications Mining Series - Zero to Hero - Session 1DianaGray10
This session provides introduction to UiPath Communication Mining, importance and platform overview. You will acquire a good understand of the phases in Communication Mining as we go over the platform with you. Topics covered:
• Communication Mining Overview
• Why is it important?
• How can it help today’s business and the benefits
• Phases in Communication Mining
• Demo on Platform overview
• Q/A
Essentials of Automations: The Art of Triggers and Actions in FMESafe Software
In this second installment of our Essentials of Automations webinar series, we’ll explore the landscape of triggers and actions, guiding you through the nuances of authoring and adapting workspaces for seamless automations. Gain an understanding of the full spectrum of triggers and actions available in FME, empowering you to enhance your workspaces for efficient automation.
We’ll kick things off by showcasing the most commonly used event-based triggers, introducing you to various automation workflows like manual triggers, schedules, directory watchers, and more. Plus, see how these elements play out in real scenarios.
Whether you’re tweaking your current setup or building from the ground up, this session will arm you with the tools and insights needed to transform your FME usage into a powerhouse of productivity. Join us to discover effective strategies that simplify complex processes, enhancing your productivity and transforming your data management practices with FME. Let’s turn complexity into clarity and make your workspaces work wonders!
A tale of scale & speed: How the US Navy is enabling software delivery from l...sonjaschweigert1
Rapid and secure feature delivery is a goal across every application team and every branch of the DoD. The Navy’s DevSecOps platform, Party Barge, has achieved:
- Reduction in onboarding time from 5 weeks to 1 day
- Improved developer experience and productivity through actionable findings and reduction of false positives
- Maintenance of superior security standards and inherent policy enforcement with Authorization to Operate (ATO)
Development teams can ship efficiently and ensure applications are cyber ready for Navy Authorizing Officials (AOs). In this webinar, Sigma Defense and Anchore will give attendees a look behind the scenes and demo secure pipeline automation and security artifacts that speed up application ATO and time to production.
We will cover:
- How to remove silos in DevSecOps
- How to build efficient development pipeline roles and component templates
- How to deliver security artifacts that matter for ATO’s (SBOMs, vulnerability reports, and policy evidence)
- How to streamline operations with automated policy checks on container images
Unlocking Productivity: Leveraging the Potential of Copilot in Microsoft 365, a presentation by Christoforos Vlachos, Senior Solutions Manager – Modern Workplace, Uni Systems
1. Lato Sensu em
Sistemas Orientados a Objetos
Módulo 4.2
Struts 2
Friday, May 22, 2009
2. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Friday, May 22, 2009
3. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
4
1.
2 x
k
x
or
2.
x
0.
.2
1.
W
s
2.
ts
t
ts
eb
k
W u
ru
or
ru
bW
r
W
St
St
St
e
2000 2001 2002 2003 2004 2005 2006 2007 2008 2009
Friday, May 22, 2009
4. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Friday, May 22, 2009
5. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Struts 2
objetivo
simplificar o
desenvolvimento
web
Friday, May 22, 2009
6. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Struts 2
objetivo
Redução do XML
convenção sobre configuração
anotações
Actions são POJOs
melhor testabilidade
bind automático de parâmetros HTTP
Friday, May 22, 2009
7. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Struts 2
novidades
Interceptadores
pré e pós-processamento
Extensibilidade
plugins
Result Types
JSP, Velocity, Freemarker
Injeção de dependências
Spring, Plexus, PicoContainer
Friday, May 22, 2009
8. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
In a nutshell
Friday, May 22, 2009
9. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
http://
servidor/
app/
action
Friday, May 22, 2009
10. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
http://
servidor/
app/
action
struts.xml
Friday, May 22, 2009
11. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
http://
servidor/
app/
action
ActionTeste.java
Friday, May 22, 2009
12. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
http://
servidor/
app/
action
ok.jsp
Friday, May 22, 2009
13. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Friday, May 22, 2009
14. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Friday, May 22, 2009
15. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
XML mapeia POJO
comum
Friday, May 22, 2009
16. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
método execute()
obrigatório qdo
nenhuma configuração
é feita no XML
Friday, May 22, 2009
17. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
o retorno do método
execute() revela o
resultado da Action
Friday, May 22, 2009
18. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Action
e
struts.xml
libs
web.xml
*.html
*.jsp
Friday, May 22, 2009
19. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
At a glance
Friday, May 22, 2009
20. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
http://
servidor/
app/
action
Friday, May 22, 2009
21. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
http://
servidor/
app/
action
?
Friday, May 22, 2009
22. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Struts 1.x
Friday, May 22, 2009
23. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Struts 1.x
?
Friday, May 22, 2009
24. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
http://
servidor/ FrontController!
app/
action
Friday, May 22, 2009
25. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
web.xml
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Friday, May 22, 2009
26. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Estratégia de
Mapeamento de Actions
Friday, May 22, 2009
27. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Estratégia de
Mapeamento de Actions
http://localhost:8080/app/entrar
LoginAction.execute()
Friday, May 22, 2009
28. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Estratégia de
Mapeamento de Actions
http://localhost:8080/app/entrar
LoginAction.execute()
Friday, May 22, 2009
29. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Estratégia de
Mapeamento de Actions
http://localhost:8080/app/entrar
LoginAction.execute()
<action name=quot;entrarquot; class=quot;xpto.LoginActionquot;/>
Friday, May 22, 2009
30. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Estratégia de
Mapeamento de Actions
http://localhost:8080/app/entrar
ControleDeAcessoAction.login()
<action name=quot;entrarquot; method=quot;loginquot; class=quot;xpto.ControleDeAcessoActionquot;/>
Friday, May 22, 2009
31. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Estratégia de
Mapeamento de Actions
http://localhost:8080/app/entrar
ControleDeAcessoAction.login()
<action name=quot;entrarquot; method=quot;loginquot; class=quot;xpto.ControleDeAcessoActionquot;/>
Friday, May 22, 2009
32. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Estratégia de
Mapeamento de Actions
Patterns Matching
http://localhost:8080/app/acesso_login
ControleDeAcessoAction.login()
Friday, May 22, 2009
33. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Estratégia de
Mapeamento de Actions
Patterns Matching
http://localhost:8080/app/acesso_login
ControleDeAcessoAction.login()
Friday, May 22, 2009
34. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Estratégia de
Mapeamento de Actions
Patterns Matching
http://localhost:8080/app/acesso_login
ControleDeAcessoAction.login()
Friday, May 22, 2009
35. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Estratégia de
Mapeamento de Actions
Patterns Matching
http://localhost:8080/app/acesso_login
ControleDeAcessoAction.login()
<action name=quot;acesso_ *quot; method=quot; {1}quot; class=quot;xpto.ControleDeAcessoActionquot;/>
Friday, May 22, 2009
36. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Friday, May 22, 2009
37. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Friday, May 22, 2009
38. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Estratégia de
Mapeamento de Actions
Patterns Matching
http://localhost:8080/app/Usuario/edit
UsuarioAction.edit()
Friday, May 22, 2009
39. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Estratégia de
Mapeamento de Actions
Patterns Matching
http://localhost:8080/app/Usuario/edit
UsuarioAction.edit()
Friday, May 22, 2009
40. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Estratégia de
Mapeamento de Actions
Patterns Matching
http://localhost:8080/app/Usuario/edit
UsuarioAction.edit()
Friday, May 22, 2009
41. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Estratégia de
Mapeamento de Actions
Patterns Matching
http://localhost:8080/app/Usuario/edit
UsuarioAction.edit()
<action name=quot; */*quot; method=quot; {2}quot; class=quot;xpto. {1}Actionquot;/>
Friday, May 22, 2009
42. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Binding
Friday, May 22, 2009
43. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Dados de Requisição
usuario=alegomes
senha=123456
Friday, May 22, 2009
44. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Nada de ActionForms!
bind automático
Friday, May 22, 2009
51. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Testabilidade
Como Actions são POJOS, nenhuma
infra-estrutura mágica é necessária para
implementação de testes unitários.
Friday, May 22, 2009
52. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Friday, May 22, 2009
53. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Tags
Friday, May 22, 2009
69. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Results
implementação da
Camada View
Resposta da Action
Friday, May 22, 2009
70. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Results
login.jsp menu.jsp
Velocity Freemarker XSTL
Action
Friday, May 22, 2009
71. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Result Types
Velocity Freemarker XSTL
<action name=quot;qqcoisa*quot; method=quot;{1}quot; class=quot;br.ucb.soo.wa.struts2.lab3.QQActionquot;>
<result name=quot;result1quot;>menu.jsp</result>
<result name=quot;result1quot; type=”dispatcher”>some.jsp</result>
<result name=quot;result2quot; type=”freemarker”>login.ftl</result>
<result name=quot;result3quot; type=”velocity”>page.vt</result>
</action>
Friday, May 22, 2009
72. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Result Types
customizados
public interface Result extends Serializable {
public void execute(ActionInvocation invocation)
throws Exception;
}
<result-types>
<result-type name=quot;dispatcherquot;
default=quot;truequot;
class=quot;seu.pacote.SuaClassequot;/>
</result-types>
Friday, May 22, 2009
73. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Dependency Injection
Friday, May 22, 2009
74. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Interceptors
Friday, May 22, 2009
76. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Revisão
Intercepting Filters
Friday, May 22, 2009
77. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Revisão
Intercepting Filters
interceptors action interceptors
Friday, May 22, 2009
78. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Interceptors
pra quê?
Tratamento de exceção
Evitar submit duplo
Upload de arquivo
Ciclo de vida
Validações
http://struts.apache.org/2.1.6/docs/interceptors.html
Friday, May 22, 2009
79. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Interceptors
<package name=quot;defaultquot; extends=quot;struts-defaultquot;>
<interceptors>
<interceptor name=quot;timerquot; class=quot;...quot;/>
<interceptor name=quot;loggerquot; class=quot;...quot;/>
</interceptors>
<action name=quot;loginquot; class=quot;tutorial.Loginquot;>
<interceptor-ref name=quot;timerquot;/>
<interceptor-ref name=quot;loggerquot;/>
<result name=quot;inputquot;>login.jsp</result>
<result name=quot;successquot; type=quot;redirectActionquot;>/secure/home</result>
</action>
</package>
Friday, May 22, 2009
80. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Pacotes de Interceptors
<package name=quot;defaultquot; extends=quot;struts-defaultquot;>
<interceptors>
<interceptor name=quot;timerquot; class=quot;..quot;/>
<interceptor name=quot;loggerquot; class=quot;..quot;/>
<interceptor-stack name=quot;myStackquot;>
<interceptor-ref name=quot;timerquot;/>
<interceptor-ref name=quot;loggerquot;/>
</interceptor-stack>
</interceptors>
<action name=quot;loginquot; class=quot;tutuorial.Loginquot;>
<interceptor-ref name=quot;myStackquot;/>
<result name=quot;inputquot;>login.jsp</result>
<result name=quot;successquot; type=quot;redirectActionquot;>/secure/home</result>
</action>
</package>
Friday, May 22, 2009
82. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Exemplo
<action name=quot;login_*quot; method=quot;{1}quot; class=quot;br.ucb.soo.wa.struts2.lab3.LoginActionquot;>
<interceptor-ref name=quot;loggerquot;/>
<result name=quot;loginOKquot;>menu.jsp</result>
<result name=quot;loginNOKquot;>login.jsp</result>
</action>
May 15, 2009 11:39:22 AM com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Starting execution stack for action //login_autenticar
May 15, 2009 11:39:22 AM com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Finishing execution stack for action //login_autenticar
Friday, May 22, 2009
83. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Interceptors
coisas muito mais complexas
podem ser feitas...
Friday, May 22, 2009
84. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Interceptors
coisas muito mais complexas
podem ser feitas...
...e precisam ser testadas!
Friday, May 22, 2009
85. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Testes
Direto na Action
:-/
Friday, May 22, 2009
86. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Friday, May 22, 2009
87. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Friday, May 22, 2009
88. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Testes
Action Proxied
:-)
Friday, May 22, 2009
93. // create action context for my action, feed
// into the action context all request parameters
Map requestParameters = new HashMap();
requestParameters.put(quot;param1quot;, quot;param1-valuequot;);
requestParameters.put(quot;param2quot;, quot;param2-valuequot;);
Map actionContext = StrutsTestCaseSupport.getInstance().buildActionContext(
quot;my.hostname.comquot;, quot;getquot;, quot;/myActionNamespace/myActionNamequot;, requestParameters);
// create the proxy for the action, this encapsulates all
// the interception stack up to the real action
ActionProxy proxy = StrutsTestCaseSupport.getInstance().createActionProxy(
quot;myActionNamequot;, quot;myActionNameSpacequot;,actionContext);
// inject parameters as required
// let the full stack run
String result = proxy.execute();
// confirm result
assert result.equals(quot;myTestResponseStringquot;);
// look into mock HttpServletResponse, do whatever
// tests I need to do: returned HTML, returned headers,
// cookies, etc...
String responseXml = ((MockHttpServletResponse) actionContext.get(StrutsStatics.HTTP_RESPONSE)).getContentAsString();
assert responseXml.indexOf(quot;successquot;) != -1;
http://fassisrosa.blogspot.com/2006/11/unit-testing-struts-20.html
Friday, May 22, 2009
94. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Struts2
testes
org.apache.struts2.util.StrutsTestCaseHelper
Generic test setup methods to be used with any unit testing framework.
com.opensymphony.xwork2.TestNGXWorkTestCase
Base test class for TestNG unit tests. Provides common XWork variables and
performs XWork setup and teardown processes
com.opensymphony.xwork2.XWorkTestCase
Base JUnit TestCase to extend for XWork specific JUnit tests. Uses the generic
test setup for logic.
com.opensymphony.xwork2.util.XWorkTestCaseHelper
Generic test setup methods to be used with any unit testing framework.
Friday, May 22, 2009
95. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Include
Mecanismo para modularização
das configurações.
Friday, May 22, 2009
96. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Include
<struts>
<include file=quot;billing-config.xmlquot; />
<include file=quot;admin-config.xmlquot; />
<include file=quot;reports-config.xmlquot; />
...
</struts>
struts-default.xml e struts-plugin.xml são incluídos
implicitamente em todo struts.xml
Friday, May 22, 2009
97. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Packages
Mecanismo para organização lógica e
reaproveitamento de configurações
Friday, May 22, 2009
98. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Packages
<struts>
<package name=quot;exemploquot; extends=quot;struts-defaultquot;>
<action name=quot;login_*quot; method=quot;{1}quot; class=quot;br.ucb.soo.wa.struts2.lab3.LoginActionquot;>
<interceptor-ref name=quot;loggerquot;/>
<result name=quot;loginOKquot;>menu.jsp</result>
<result name=quot;loginNOKquot;>login.jsp</result>
</action>
<action name=quot;logout/*quot; class=quot;br.ucb.soo.wa.struts2.lab3.LogoutActionquot;>
<result>{1}.jsp</result>
</action>
</package>
</struts>
Friday, May 22, 2009
99. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Validators
Verificação declarativa de campos
Friday, May 22, 2009
100. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Bundled Validators
conversion validator
date validator
double validator
email validator
expression validator
fieldexpression validator
int validator
regex validator
required validator
requiredstring validator
stringlength validator
url validator
visitor validator
http://struts.apache.org/2.1.6/docs/validation.html
Friday, May 22, 2009
101. <interceptor name=quot;validationquot;
class=quot;org.apache.struts2.interceptor.validation.AnnotationValidationInterceptorquot;/>
struts.xml
Friday, May 22, 2009
111. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Friday, May 22, 2009
112. Friday, May 22, 2009
http://cwiki.apache.org/confluence/display/WW/Big+Picture
113. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Afinal, por que Struts2?
• Baseado em Actions
• Configurações
- XML e Annotations
• Actions POJO
- alta testabilidade
• Integrável
- Spring, SiteMesh e Tiles
• Opções de View
- JSP, Freemarker, Velocity e XSLT
Friday, May 22, 2009
• Plugável
114. Lato Sensu em Sistemas Orientados a Objetos
Desenvolvimento de Aplicaões Web Avançado - 1°/2009
Labs
“The Bootstap tutorials starts from the very
beginning and steps through creating a
simple application.”
http://struts.apache.org/2.x/docs/bootstrap.html
Friday, May 22, 2009
115. Lato Sensu em
Sistemas Orientados a Objetos
Q&A MSc. Alexandre Gomes
alegomes@gmail.com
Friday, May 22, 2009