Snaps Host using Spring [message #941489] |
Fri, 12 October 2012 11:21  |
Eclipse User |
|
|
|
Hi
I'm currently looking at OSGI with the view to implementing an OSGI based application framework.
Got most things working but struggling to configure snaps. Specifically I want to have the snaps host as a Spring MVC web bundle so it can handle login, home page etc.. I then want specific spring mvc snaps to provide component level functionality within the application.
I've got the host and snap deployed and the logs all look good in terms of the smap being joined to the host and I can see the link to my snap in the host when displaying the welcome page from the host that uses the <snaps: tag to provide a link to the snap.
However, this link always returns a 404, looking at the logs it seems as though the MVC side of the snap is not being wired up correctly and the dispatcher servlet is not picking up the url.
Cant seem to find any examples anywhere of using Spring MVC in the snap host - any ideas anyone ?
Cheers
Graeme
|
|
|
|
Re: Snaps Host using Spring [message #963036 is a reply to message #947692] |
Mon, 29 October 2012 10:24   |
Eclipse User |
|
|
|
Chris
Thanks for the reply, apologies for the delayed response, have been away from this for a while.
As requested here are the followning you've asked to see
(1) Host web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--links omitted for post -->
<display-name>Dealing Framework - Web</display-name>
<filter>
<filter-name>host-filter</filter-name>
<filter-class>org.eclipse.virgo.snaps.core.SnapHostFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>host-filter</filter-name>
<url-pattern>/</url-pattern>
<dispatcher>INCLUDE</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<!-- CONFIGURE A PARENT APPLICATION CONTEXT -->
<context-param>
<param-name>contextClass</param-name>
<param-value>org.eclipse.virgo.web.dm.ServerOsgiBundleXmlWebApplicationContext</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- DISPATCHER SERVLET CONFIG -->
<servlet>
<servlet-name>dealing-framework</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>dealing-framework</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</web-app>
(2) Snap Manifest
Manifest-Version: 1.0
Built-By: n428655
Build-Jdk: 1.6.0_35
Created-By: Maven Integration for Eclipse
Export-Package: com.iag.globaldealing.controller;version="1.0.0";uses:
="com.iag.globaldealing.web.controller,com.iag.globaldealing.web.form
,org.springframework.beans.factory.annotation,org.springframework.ste
reotype,org.springframework.ui,org.springframework.web.bind.annotation"
Tool: Bundlor 1.0.0.RELEASE
Bundle-Name: Dealing Framework Web Snap
Import-Bundle: com.springsource.org.apache.taglibs.standard;version="[
1.1.2,2.0)",org.eclipse.virgo.snaps.api;version="[3.5.0.RELEASE,3.5.0
.RELEASE]"
Bundle-Version: 1.0.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: dealing-web-snap
Import-Package: com.iag.globaldealing.framework.model.dto,com.iag.glob
aldealing.framework.service.api,com.iag.globaldealing.web.controller,
com.iag.globaldealing.web.form,javax.servlet.jsp.jstl.core;version="[
1.2.0,2.0.0)",org.eclipse.virgo.snaps.core;version="[3.5.0.RELEASE,3.
5.0.RELEASE]",org.eclipse.virgo.web.dm;version="[3.0.0, 4.0.0)",org.s
pringframework.beans.factory.annotation,org.springframework.context.c
onfig;version="[3.1.1.RELEASE, 3.1.1.RELEASE]",org.springframework.st
ereotype,org.springframework.ui,org.springframework.web.bind.annotati
on,org.springframework.web.context;version="[3.1.1.RELEASE, 3.1.1.REL
EASE]",org.springframework.web.servlet;version="[3.1.1.RELEASE, 3.1.1
.RELEASE]",org.springframework.web.servlet.mvc.annotation,org.springf
ramework.web.servlet.tags;version="[3.1.1.RELEASE, 3.1.1.RELEASE]",or
g.springframework.web.servlet.tags.form;version="[3.1.1.RELEASE, 3.1.
1.RELEASE]",org.springframework.web.servlet.view
Snap-Host: dealing-web;version="[1.0.0, 1.0.0]"
Snap-ContextPath: /dealing-snap
(3) The link from the host to the snap
localhost:8080/dealing-framework/dealing-snap/secure/dealing/ListDealElements.do
Cheers
Graeme
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Snaps Host using Spring [message #991428 is a reply to message #990420] |
Tue, 18 December 2012 23:11  |
Eclipse User |
|
|
|
Graeme, I looked over the config files quickly for the snap-test.
I will take a closer look tomorrow.
Try this web.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<!-- MUST NOT HAVE THIS CONTEXT LISTENER IN SNAP ONLY IN HOST
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
-->
<servlet>
<display-name>Snap Test Servlet</display-name>
<servlet-name>snaps-test</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<!--
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/snaps-test-servlet.xml </param-value>
</init-param>
-->
<init-param>
<param-name>contextClass</param-name>
<param-value>org.eclipse.virgo.web.dm.ServerOsgiBundleXmlWebApplicationContext</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>snaps-test</servlet-name>
<url-pattern>/snap/*</url-pattern>
</servlet-mapping>
<!-- <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> -->
</web-app>
|
|
|
Powered by
FUDForum. Page generated in 0.07044 seconds