|
Re: Snaps Host using Spring [message #947692 is a reply to message #941489] |
Wed, 17 October 2012 10:21 |
|
Hi,
This should work just fine but I would need to see the web.xml from the host, the manifest from the snap and the link that is hitting a 404 in order to diagnose it properly. Please check that the Snaps filter is defined before the dispatcher servlet as ordering matters in a web.xml. Also check that the link is in the format of '/hostContextPath/filterPath/snapContextPath' in order to get picked up by the filter and matched to the snap.
Thanks Chris.
------------------------------------------------
Chris Frost, Twitter @cgfrost
Springsource, a divison of VMware.
|
|
|
Re: Snaps Host using Spring [message #963036 is a reply to message #947692] |
Mon, 29 October 2012 14:24 |
Graeme Dougal Messages: 8 Registered: September 2012 |
Junior Member |
|
|
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 #968575 is a reply to message #963036] |
Fri, 02 November 2012 15:11 |
|
Hi,
That all looks good to me. Just had a read of the Servlet spec and it seems that '/' will be classed as a default mapping and the '*.do' extension mapping will always win out. If you change the snaps filter to '/*' it will always win out and then the dispatcher servlet in the host will never get a look in. '/*' would be considered a prefix mapping by the servlet spec and win over the extension mapping so this is also not useful. I don't believe it is possible to try the filter and if that fails to then try the dispatcher servlet without coding something bespoke up. If possible it might be easier to change the filter to something like '/snaps/*' to give a clearly different path to the one the hosts dispatcher servlet is using.
In short, I think this is an issue with the Servlet spec and Spring MVC and Snaps are working as designed.
------------------------------------------------
Chris Frost, Twitter @cgfrost
Springsource, a divison of VMware.
|
|
|
|
Re: Snaps Host using Spring [message #986847 is a reply to message #971980] |
Thu, 22 November 2012 00:13 |
|
Hi,
That could be the problem, remember that each Host and all its Snaps share the same Servlet context. Having filters with the same name could cause problems. It should work just fine having Spring MVC in both the host and its snaps just remember that it all ends up in the context. I can't remember what the 'Animals' example that ships with Snaps uses but that is the only example we have at the moment.
I've looked at this a couple of times now and I'm running out of ideas. I've asked another committer to have a look, he might be able to shed some light.
Chris.
------------------------------------------------
Chris Frost, Twitter @cgfrost
Springsource, a divison of VMware.
|
|
|
Re: Snaps Host using Spring [message #986848 is a reply to message #986847] |
Thu, 22 November 2012 00:49 |
|
Hi,
Could you provide the Snaps web.xml as well please.
Thanks, Chris.
------------------------------------------------
Chris Frost, Twitter @cgfrost
Springsource, a divison of VMware.
|
|
|
Re: Snaps Host using Spring [message #986945 is a reply to message #986848] |
Thu, 22 November 2012 13:26 |
Graeme Dougal Messages: 8 Registered: September 2012 |
Junior Member |
|
|
In the animal snaps example, the host is a standard web application and one of the snaps is a spring mvc web app.
web.xml from snap
<?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">
<display-name>Dealing Framework - Web Snap</display-name>
<welcome-file-list>
<welcome-file>welcome-file>index.html</welcome-file>
</welcome-file-list>
<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-snap</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>dealing-snap</servlet-name>
<url-pattern>/snaps/*.do</url-pattern>
</servlet-mapping>
</web-app>
[Updated on: Thu, 22 November 2012 13:27] Report message to a moderator
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04220 seconds