At line 1 added 185 lines. |
''Please note that this tutorial is under development and here is not yet solved some issues. If you find any solution how to solve some problem I will very appreciate your help. Email: RadimBurget [[at] seznam [[.] cz'' |
|
!Table of Contents |
* [1] About Spring-rcp |
* [2] Configuring Appfuse - map servlet to be listening on "ws/*" url address |
* [3] Configuring Appfuse - create ws servlet |
* [4] Configuring Appfuse - add *.jar library dependicies |
* [5] Configuring Appfuse - add interface to allow remote clients login |
* [6] Configuring RichClient - source code |
* [7] Configuring RichClient - libraries |
* [8] Unsolved issues |
---- |
!!! About Spring-rcp [#1] |
The goal of the [spring-richclient project|http://www.springframework.org/spring-rcp] is to provide a viable option for developers that need a platform and a 'best-practices' guide forconstructing professional Swing applications quickly. |
|
|
My work is based on Spring-rcp Petclinic Demo (in [CVS|http://sourceforge.net/cvs/?group_id=113660] only) and I tryed to integrate it with Appfuse. |
|
%%(border: 1px solid black; margin: 0 auto; height: 380px; width: 455px) |
[RichClient/screenshot1.jpg] |
%% |
|
!!! Configuring Appfuse - map servlet to be listening on "ws/*" url address [#2] |
Add this part of code to metadata/web/__servlets.xml__ |
<div style="margin-left: 40px"> |
{{{ |
<!-- REMOTE ACCESS SERVELTET --> |
<servlet> |
<servlet-name>ws</servlet-name> |
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> |
<load-on-startup>2</load-on-startup> |
</servlet> |
|
<!-- |
- Dispatcher servlet mapping for HTTP web services. |
- (see ws-servlet.xml for the controllers). |
--> |
<servlet-mapping> |
<servlet-name>ws</servlet-name> |
<url-pattern>/ws/*</url-pattern> |
</servlet-mapping> |
}}} |
</div> |
|
!!! Configuring Appfuse - create ws servlet[#3] |
Create ws servlet XML beans descriptor. While I am using [Hessian|http://www.caucho.com/hessian/] instead of [Burlap|http://www.caucho.com/burlap/burlap.xtp] I have commented unused part of code. If you will ever want to use the burlap instead hessian uncomment this part of code. |
|
Difference between Hessian and Burlap is that Hessian is binary and Burlap XML based. |
<div style="margin-left: 40px"> |
{{{ |
<?xml version="1.0" encoding="UTF-8" ?> |
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> |
|
<!-- |
- $Id: ws-servlet.xml,v 1.1 2004/08/01 23:03:20 benalex Exp $ |
--> |
<beans> |
|
<!-- Hessian exporter for the Clinic --> |
<!-- Hessian is a slim binary HTTP remoting protocol --> |
<bean name="/Clinic-hessian" class="org.springframework.remoting.caucho.HessianServiceExporter"> |
<property name="service"><ref bean="userManager"/></property> |
<property name="serviceInterface"> |
<value>org.appfuse.service.UserManager</value> |
</property> |
</bean> |
|
<!-- Burlap exporter for the Clinic --> |
<!-- Burlap is a slim XML-based HTTP remoting protocol --> |
<!--bean name="/Clinic-burlap" class="org.springframework.remoting.caucho.BurlapServiceExporter"> |
<property name="service"><ref bean="clinic"/></property> |
<property name="serviceInterface"> |
<value>org.springframework.samples.petclinic.Clinic</value> |
</property> |
</bean--> |
|
<!-- Hessian exporter for the RemoteAuthenticationManager --> |
<bean name="/RemoteAuthenticationManager-hessian" class="org.springframework.remoting.caucho.HessianServiceExporter"> |
<property name="service"><ref bean="remoteAuthenticationManager"/></property> |
<property name="serviceInterface"> |
<value>net.sf.acegisecurity.providers.rcp.RemoteAuthenticationManager</value> |
</property> |
</bean> |
|
<!-- Burlap exporter for the RemoteAuthenticationManager --> |
<!--bean name="/RemoteAuthenticationManager-burlap" class="org.springframework.remoting.caucho.BurlapServiceExporter"> |
<property name="service"><ref bean="remoteAuthenticationManager"/></property> |
<property name="serviceInterface"> |
<value>net.sf.acegisecurity.providers.rcp.RemoteAuthenticationManager</value> |
</property> |
</bean--> |
|
</beans> |
}}} |
</div> |
|
!!! Configuring Appfuse - add *.jar library dependicies [#4] |
|
For more details read [how to add library to appfuse|http://raibledesigns.com/wiki/Wiki.jsp?page=AppFuseAddLibrary] here. |
|
Copy hessian.jar to appfuse/lib/hessian/hessian.jar |
|
To lib/lib.properties add path info: |
|
<div style="margin-left: 40px"> |
{{{ |
|
# |
# Hessian |
# |
hessian.version=0.1 |
hessian.dir=${lib.dir}/hessian-${hessian.version} |
hessian.jar=${hessian.dir}/hessian-${hessian.version}.jar |
}}} |
</div> |
|
If you will ever need burlap do the same with burlap *.jar files. |
|
Add in __build.xml__ hessian library dependency: |
<div style="margin-left: 40px"> |
{{{ |
<target name="package-web" ...... |
....... |
...... |
<lib file="${hessian.jar}"/> |
...... |
</target> |
}}} |
</div> |
|
(properties.xml does not need any changes) |
|
!!!Configuring Appfuse - add interface to allow remote clients to login[#5] |
|
Add to web/WEB-INF/__applicationContextSecurity.xml__ add this bean: |
|
<div style="margin-left: 40px"> |
{{{ |
<!-- Allows remote clients to check if a username/password is valid --> |
<bean id="remoteAuthenticationManager" class="net.sf.acegisecurity.providers.rcp.RemoteAuthenticationManagerImpl"> |
<property name="authenticationManager"><ref bean="authenticationManager"/></property> |
</bean> |
}}} |
</div> |
|
!!! Configuring RichClient - source code[#6] |
|
Download the [Appfuse Rich Client source code|wiki:RichClient/appfuse-richclient.zip] and copy them to your Appfuse project. |
|
%%note __NOTE__ At first I tryied to set new standalone project which will be independent on appfuse and will be only referencing to Appfuse project. Unfortunetly I had some issues with compilation so I decided to inegarte it directly to project.%% |
|
!!! Configuring RichClient - libraries [#7] |
|
You will need to download this jar archives and add to class path in eclipse (Eclipse: Project/Properties/Java Build Path/Libraries/Add JARs) Do not forget to refersh appfuse directory structure please. |
<div style="margin-left: 40px"> |
{{{ |
appfuse/lib |
/caucho |
(84 871) burlap.jar |
(83 245) hessian.jar |
/jgoodies |
(85 502) forms.jar |
(338 486) looks.jar |
/spring-rcp |
(366 615) spring-richclient-resources.jar |
(59 691) spring-richclient-sandbox.jar |
(736 813) spring-richclient.jar |
/javahelp |
(531 676) javahelp.jar |
/spring |
(741 379) spring-sandbox.jar |
}}} |
</div> |
|
%%note File sizes could differ based on your actual version. %% |
|
|
|
Now you should be able compile and run your application (org.appfuse.richclient.PetClinicClientServer) |
|
Please andsure that your server is running (http://localhost:8080/appfuse/ws/Clinic-hessian displays exception "HessianServiceExporter only supports POST requests") |
|
!!! Unsolved issues [#8] |
|
TODO: |