Grails and swf application - grails

I want to execute a flash application from grails 2.3.1.
I have a probleme loading my swf file's dependencies from a gsp.
Firstly, I tried to put all file needed into my web-app folder, and it worked like a charm :
wab-app
css
flash
index.html // <- Use for my first test.
flash.swf
prefs.xml
data-flash-folder
video-folder
txt-folder
xml-folder
intro.swf
main.swf
prefs.xml
static.xml
When I go to this url : http://localhost:8080/application-name/flash/index.html, all work like a charm.
So I decided to call it from a controller :
class FrontFlashController {
def openFlash() {
}
}
Here is my gsp calling flash :
<g:applyLayout name="frontFlash">
<div id="flash-render">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="1000" height="700" title="myFlash" >
<param name="movie" value="flash/flash.swf" />
<param name="FLASHVARS" value="idSession=rffcu96vn6j4tq3o56j1bgn5o7&lang=fr&xmlPath=prefs.xml">
<param name="quality" value="high" />
<embed src="/application-name/flash/flash.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="1000" height="700" flashvars="idSession=rffcu96vn6j4tq3o56j1bgn5o7&module=module&maxchapter=6&gochapter=3&jeu=0&cumul=285"></embed>
</object>
</div>
</g:applyLayout>
When calling the action by this url : http://localhost:8080/application-name/frontFlash/openFlash, my file 'flash.swf' is correctly loaded but none of his dependencies.
Here my firebug stack :
"NetworkError: 404 Not Found - http://localhost:8080/application-name/frontFlash/data-folder/static.xml"
"NetworkError: 404 Not Found - http://localhost:8080/application-name/frontFlash/data-folder/textes/default_en.xml"
"NetworkError: 404 Not Found - http://localhost:8080/application-name/frontFlash/data-folder/prefs.xml"
"NetworkError: 404 Not Found - http://localhost:8080/application-name/frontFlash/data-folder/intro.swf"
"NetworkError: 404 Not Found - http://localhost:8080/application-name/frontFlash/data-folder/main.swf"
Seems to grails is looking directly into my folder view instead of swf file folder.
How can I fix it ?
More, later I want to link swf ressource outside of my grails application, how can I do that ?
Snite

Try to use g.createLinkTo in src, like
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" title="myFlash" >
<param name="movie" value="flash/flash.swf" />
<param name="FLASHVARS" value="idSession=rffcu96vn6j4tq3o56j1bgn5o7&lang=fr&xmlPath=prefs.xml">
<param name="quality" value="high" />
<embed src="${g.createLinkTo(dir: 'flash', file: 'flash.swf')}" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" flashvars="idSession=rffcu96vn6j4tq3o56j1bgn5o7&module=module&maxchapter=6&gochapter=3&jeu=0&cumul=285"></embed>
</object>

I fix the problem adding <base href="/application-name/flash/"> into my head.
Here my final version of openFlash.gsp :
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>FLASH</title>
<base href="/application-name/flash/">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
swfobject.registerObject("myId", "9.0.0", "expressInstall.swf");
</script>
</head>
<body>
<div>
<g:if test="${flash}">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="1000" height="700" title="Module">
<param name="movie" value="flash.swf" />
<param name="FLASHVARS" value="idSession=rffcu96vn6j4tq3o56j1bgn5o7&lang=fr&xmlPath=prefs.xml">
<param name="quality" value="high" />
<embed src="${g.createLinkTo(dir: 'flash', file: 'flash.swf')}" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="1000" height="700" flashvars="idSession=rffcu96vn6j4tq3o56j1bgn5o7&maxchapitre=6&gochapitre=3&jeu=0&cumul=285"></embed>
</object>
</g:if>
<g:else>
<g:if test="${flash.error}">
<br />
<div class="alert alert-error">${flash.error}</div>
</g:if>
</g:else>
</div>
</body>
</html>

Related

How to embed VLC in zk's zul?

Using HTML, I can successfully embed VLC by object tag( please see the codes below).
Nevertheless, I couldn't see any video being played when I embed the same html inside zul.
This one has succeeded:
<!DOCTYPE html>
<html>
<body>
<object
classid='clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921'
codebase='http://download.videolan.org/pub/videolan/vlc/last/win32/axvlc.cab'
id='vlc'
name='vlc'
class='vlcPlayer'
events='True'>
<param name='Src' value='rtsp://10.1.21.228/stream/live?ch=1_0' />
<param name='ShowDisplay' value='True' />
<param name='AutoLoop' value='False' />
<param name='AutoPlay' value='True' />
<embed id='vlcEmb' type='application/x-google-vlc-plugin' version='VideoLAN.VLCPlugin.2' autoplay='yes' loop='no' width='640' height='480'
target='rtsp://10.1.21.228/stream/live?ch=1_0' ></embed>
</object>
</body>
</html>
The following fails:
<?page title="new page title" contentType="text/html;charset=UTF-8"?>
<zk>
<html><![CDATA[
<object
classid='clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921'
codebase='http://download.videolan.org/pub/videolan/vlc/last/win32/axvlc.cab'
id='vlc'
name='vlc'
class='vlcPlayer'
events='True'>
<param name='Src' value='rtsp://10.1.21.228/stream/live?ch=1_0' />
<param name='ShowDisplay' value='True' />
<param name='AutoLoop' value='False' />
<param name='AutoPlay' value='True' />
<embed id='vlcEmb' type='application/x-google-vlc-plugin' version='VideoLAN.VLCPlugin.2' autoplay='yes' loop='no' width='640' height='480'
target='rtsp://10.1.21.228/stream/live?ch=1_0' ></embed>
</object>
]]></html>
</zk>
Please help, thanks.

Thymeleaf flash(swf)issue

<body>
<object type="application/x-shockwave-flash" data="file3.swf"
id="applicationID" style="margin:0 50px;width:auto;height:auto;">
<param name="movie" value="file3.swf" />
<param name="wmode" value="transparent" /> <!-- Or opaque, etc. -->
<param name="FlashVars" value="" />
<param name="quality" value="high" />
<param name="menu" value="false" />
</object>
</body>
This is my thymeleaf page here file3.swf is the file i want play .
But when i run the page the flash does not play..!
I dont know how to show flash file in bowser, I assume that its correctly done :p
Have you check the firebug to see how its rendered ?

how to implement filter Search using Struts2 Jquery Plugin

I am trying to implement filter search for my Struts2 jquery grid. If I search any string (through jquery filter textbox) then it is calling my action class but i am unable to get the search string in my action class.
I tried to print this line inside my Action class but the Search String is not appearing in my Action class.
System.out.println("This line is getting printed But search textbox values is not printing."+searchString+""+searchField);
Please help me for this, i tried a lot ,and still am trying for it..
My Code:
Subjectinfo.jsp
<%# page contentType="text/html; charset=UTF-8"%>
<%# taglib prefix="s" uri="/struts-tags"%>
<%# taglib prefix="sj" uri="/struts-jquery-tags"%>
<%# taglib prefix="sjg" uri="/struts-jquery-grid-tags"%>
<html>
<head>
<title>Hello World</title>
<style type="text/css">
#import
url(<%=request.getContextPath()%>/css/style1.css);
</style>
<sj:head jqueryui="true" jquerytheme="le-frog"/>
</head>
<body>
<div id="setpage"> <s:url id="editurl" action="nedit"/>
<s:url id="editurl" action="nedit"/>
<s:url id="remoteurl" action="ntable"/>
<sjg:grid
id="gridtable"
caption="Customer Examples"
dataType="json"
filter="true"
filterOptions="{ stringResult :true,
searchOnEnter : false,
enableClear : true,
gridModel="gridModel"
rowList="10,15,20"
navigatorDelete="true">
<sjg:gridColumn name="id" index="subjectId" title="ID" formatter="integer" sortable="true" key="true"
search="true" searchoptions="{sopt:['eq']}" editable="true" hidden="true" />
<sjg:gridColumn name="subjectName" index="subjectName" title="Subject Name" sortable="true" search="true"
editable="true"
edittype="text" />
</sjg:grid>
</div>
</body>
</html>
From http://www.trirand.com/jqgridwiki/doku.php?id=wiki:toolbar_searching
When the stringResult option is set to true the data posted to the server is a string and the structure of the posted data is the same as in Advanced Search.
http://www.trirand.com/jqgridwiki/doku.php?id=wiki:advanced_searching#options
So I think your problem is that you are looking for searchString, but the jqgrid is sending a request variable called filters, which is a json string as described in the advanced search options link.

JSF2 ignores empty alt attribute

I have a jsf snippet:
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets">
<!-- Yandex.Metrika -->
<img src="//mc.yandex.ru/watch/xxx" alt=""/>
<!-- /Yandex.Metrika -->
</ui:composition>
But when I use it, web-client get HTML page whithout empty alt attribute in img element:
<!-- Yandex.Metrika -->
<img src="//mc.yandex.ru/watch/xxx" />
<!-- /Yandex.Metrika -->
As result my document has validation error (
How can I solve this problem?
You could use the JSF graphicImage component, which does render the empty alt attribute.
For Example:
<h:graphicImage value="#{resource['images:image1.png']}" alt="" />
or
<h:graphicImage value="http://somedomain.com/somecontext/xxx/image1.png" alt="" />
Not sure if that is a bug in JSF2 (JSF1.2 preserves empty attributes).
To 'workaround' that in JSF2, wrap code by f:verbatim, like this:
<f:verbatim>
<img src="//mc.yandex.ru/watch/xxx" alt=""/>
</f:verbatim>

How do I display video in my view? - ASP.NET MVC

I am using asp.net mvc, and I'd like to add media player control in my view page, so how do I do that?
My first three google finds:
1) A control (doesn't know if it works with mvc though)
http://www.beansoftware.com/free-asp.net-controls/asp.net-media-player-control.aspx
2) Silverlight Player
http://www.asp.net/aspnet-in-net-35-sp1/videos/introduction-to-the-aspnet-mediaplayer-control
3) Embed
if it doesnt matter which mediaplayer will be used:
<embed id="videocontent" width="550" height="480" type="video/avi" autstart="true" loop="false" runat="server" style="border: gray 1px solid"></embed>.
or in valid xhtml
<object classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" id="player" width="320" height="260">
<param name="url" value="<%= ViewData["src"] %>" />
<param name="src" value="<%= ViewData["src"] %>" />
<param name="showcontrols" value="true" />
<param name="autostart" value="true" />
<!--[if !IE]>-->
<object type="video/x-ms-wmv" data="<%= ViewData["src"] %>" width="320" height="260">
<param name="src" value="<%= ViewData["src"] %>" />
<param name="autostart" value="true" />
<param name="controller" value="true" />
</object>
<!--<![endif]-->
</object>
+1 to Christina, but #1 may not work in an MVC app.
Her answers, plus you'll want to create a controller action that returns a FileResult. Check this question (its about an image, but a file is a file all the web round):
Can an ASP.NET MVC controller return an Image?

Resources