-
Notifications
You must be signed in to change notification settings - Fork 0
/
cxf.tex
62 lines (48 loc) · 2.33 KB
/
cxf.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
\subsection{Apache CXF}
\begin{frame}{Introduction to Apache CXF}
\begin{itemize}
\item an open-source framework for web services.
\item includes a broad feature set, not only API for RESTful web services
\item high performance
\item easy integration with Spring Framework
\end{itemize}
\end{frame}
\begin{frame}{Configuring services in container with Spring}
To register services you need to add cxf servlet definition to web.xml
\lstinputlisting[language=XML]{code/cxf_web.xml}
And service bean to spring's beans.xml
\lstinputlisting[language=XML]{code/cxf_beans.xml}
\end{frame}
\begin{frame}{Apache CXF REST client}
You can use the service interfaces on client side to produce client which will act like proxy.
\lstinputlisting[language=JAVA]{code/SampleApplication.java}
Client definition in client's beans.xml
\lstinputlisting[language=XML]{code/client_beans.xml}
\end{frame}
\begin{frame}{Interceptors in Apache CXF}
Using interceptors you can read and manipulate request or response before it reach service implementation.
\lstinputlisting[language=JAVA]{code/SampleInterceptor.java}
Interceptor definition in beans.xml
\lstinputlisting[language=XML]{code/cxf_interceptor.xml}
\end{frame}
\begin{frame}{Providers in Apache CXF}
You can use built-in JAXB or Jackson providers for JSON/XML serialization or create a custom one.
\lstinputlisting[language=JAVA]{code/CustomProvider.java}
Provider definition in beans.xml
\lstinputlisting[language=JAVA]{code/cxf_providers.xml}
\end{frame}
\begin{frame}{Exception handling in Apache CXF}
It is possible to prepare custom exception mapper for your given exception type and handle it nicely.
\lstinputlisting[language=JAVA]{code/ExceptionMapper.java}
Exception Mapper definition in beans.xml
\lstinputlisting[language=XML]{code/cxf_exception.xml}
\end{frame}
\begin{frame}{CXF Advanced Features}
\begin{itemize}
\item multiparts - mapping to InputStream, DataSource or custom Java types
\item failover and load distribution - alternate addresses in case of connection failures or heavy load
\item complex search queries - mapping query parameters to a bean
\item integration with OSGi
\item bean with implementation can support JAX-RS and JAX-WS at the same time
\end{itemize}
\end{frame}