SWF behaves strangely when it is embeded in HTML - flash-cs4

I have a SWF file and I am trying to embed it into an HTML.
I used the following code:
<object width="704" height="440">
<param name="movie" value="http://riskgames.ist.psu.edu/CyberLinkIT.swf"></param>
<embed src="http://riskgames.ist.psu.edu/CyberLinkIT.swf" type="application/x-shockwave-flash" menu="false" width="704" height="440">
</embed>
</object>
If you go to http://miaojiang.net/bug.html, you can see the problem. The button is blinking and all invisible text field are displayed.
However, if I open the swf file directly, there is no problem.
Any idea?

This is your problem.
SecurityError: Error #2149: Security sandbox violation: https://riskgames.ist.psu.edu/CyberLinkIT.swf cannot make fscommand calls to http://miaojiang.net/bug.html (allowScriptAccess is ).
at FSCommand$/_fscommand()
at global/flash.system::fscommand()
at CyberLinkIT_fla::MainTimeline/frame1()
<object width="704" height="440">
<param name="movie" value="http://riskgames.ist.psu.edu/CyberLinkIT.swf"></param>
<param name="AllowScriptAccess" value="always"></param>
<embed src="http://riskgames.ist.psu.edu/CyberLinkIT.swf" type="application/x-shockwave-flash" menu="false" width="704" height="440" AllowScriptAccess="always">
</embed>
</object>

Related

Is <param> tag ever supposed to work with <logger> or <root>?

From this Apache documentation page, I understand that the <param> tag is supposed to work with the <logger> tag, but apparently it doesn't.
For example, this:
<logger name="LogTest">
<level value="INFO"/>
<appender-ref ref="FileAppender"/>
<param name="File" value="f:\dev\logfile"/>
</logger>
...produces the following error:
XmlHierarchyConfigurator: Cannot find Property [File] to set object on [log4net.Repository.Hierarchy.DefaultLoggerFactory+LoggerImpl]. Source: log4net.Repository.Hierarchy.XmlHierarchyConfigurator.
What am I doing wrong?

How to write soapUI groovy script log into text file

I have to write Groovy script log in to a text file, I am able to write request and response of any Soap step using context.expand.
To write test request and response I am using:
def request = context.expand('${SoapRequest#Request}')
new File ("D:/RequestFile.txt").write(request)
What I want is to save the log output in a file:
Suggest me a way to write Groovy script log in a text file.
Config way log4j.xml
There is already a file for Groovy log configured in SOAPUI log4j configuration file.
In SOAPUI_HOME\bin\soapui-log4j.xml:
<appender name="GLOBAL_GROOVY_LOG" class="org.apache.log4j.FileAppender">
<errorHandler class="org.apache.log4j.helpers.OnlyOnceErrorHandler"/>
<param name="File" value="${soapui.logroot}global-groovy.log"/>
<param name="Threshold" value="DEBUG"/>
<param name="Append" value="true"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p [%c{1}] %m%n"/>
</layout>
</appender>
<logger name="groovy.log">
<level value="INFO" />
<appender-ref ref="GLOBAL_GROOVY_LOG" />
</logger>
A possible way is to add another custom FileAppender in this config file. If you change this file remember to restart SOAPUI in order that it can load the changes.
Something like this can do the trick:
<appender name="GLOBAL_GROOVY_LOG" class="org.apache.log4j.FileAppender">
<errorHandler class="org.apache.log4j.helpers.OnlyOnceErrorHandler"/>
<param name="File" value="${soapui.logroot}global-groovy.log"/>
<param name="Threshold" value="DEBUG"/>
<param name="Append" value="true"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p [%c{1}] %m%n"/>
</layout>
</appender>
<appender name="MYLOG_CUSTOM" class="org.apache.log4j.FileAppender">
<errorHandler class="org.apache.log4j.helpers.OnlyOnceErrorHandler"/>
<param name="File" value="/absoultePath/yourlogFile.txt"/>
<param name="Threshold" value="DEBUG"/>
<param name="Append" value="true"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p [%c{1}] %m%n"/>
</layout>
</appender>
<logger name="groovy.log">
<level value="INFO" />
<appender-ref ref="GLOBAL_GROOVY_LOG" />
<appender-ref ref="MYLOG_CUSTOM" />
</logger>
Dinamically using Groovy
However it seems that you want to do it dynamically using Groovy script, hence you can use the follow code to get <logger name="groovy.log"> and add a FileAppender to it; in order that you can save the logs in a custom file:
import org.apache.log4j.Logger
import org.apache.log4j.PatternLayout
import org.apache.log4j.RollingFileAppender
// get the groovy logger by name
def groovyLogger = Logger.getLogger('groovy.log')
// pattern Layout
PatternLayout layout = new PatternLayout("%d{ISO8601} [%t] %-5p %c %x - %m%n")
// create a file appender
RollingFileAppender fileAppender = new RollingFileAppender(layout, "/absolutePath/myLog.txt")
groovyLogger.addAppender(fileAppender)
log.info 'someText to the logger'
NOTE: If you don't use an absolute path in FileAppender the log file is saved relative to *SOAPUI_HOME\bin*
When you configure this the rest of logs in Groovy testSteps will be appended to this file. If you want to get only the log for a specific Groovy testStep then you can simply remove the appender at the end of the script:
groovyLogger.removeAppender(fileAppender);
UPDATE:
From you comment: I want to store output for each run, and if I am executing this again it should rewrite the file.
So you want to store output for each run... but you want to overwrite the file if you execute again? This is contradictory isn't?
If you want to overwrite the file instead of append the content you can use setAppend(false):
fileAppender.setAppend(false)
fileAppender.activateOptions()
groovyLogger.addAppender(fileAppender)

Spring Webflow - IllegalStateException when using multipart/form-data and file upload

I am trying to add file upload to my Spring Webflog form processing. As far as the form enctype is not set to multipart/form-data, form submition works just fine. But after I added enctype="multipart/form-data" to my Spring form, this Exception occurs:
java.lang.IllegalStateException: A flow execution action URL can only be obtained in a RenderRequest or a ResourceRequest
at org.springframework.webflow.context.portlet.PortletExternalContext.getFlowExecutionUrl(PortletExternalContext.java:215)
at org.springframework.webflow.engine.impl.RequestControlContextImpl.getFlowExecutionUrl(RequestControlContextImpl.java:178)
at org.springframework.webflow.mvc.view.AbstractMvcView.render(AbstractMvcView.java:189)
at org.springframework.webflow.engine.ViewState.render(ViewState.java:293)
at org.springframework.webflow.engine.ViewState.refresh(ViewState.java:242)
at org.springframework.webflow.engine.ViewState.resume(ViewState.java:220)
at org.springframework.webflow.engine.Flow.resume(Flow.java:537)
at org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:259)
at org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:169)
at org.springframework.webflow.mvc.portlet.FlowHandlerAdapter.handleAction(FlowHandlerAdapter.java:161)
at org.springframework.web.portlet.DispatcherPortlet.doActionService(DispatcherPortlet.java:670)
at org.springframework.web.portlet.FrameworkPortlet.processRequest(FrameworkPortlet.java:520)
at org.springframework.web.portlet.FrameworkPortlet.processAction(FrameworkPortlet.java:461)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:71)
I have added CommonsMultipartResolver to my spring context:
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!-- Limit uploads to one byte smaller than the server is allowed to handle -->
<property name="maxUploadSize" value="100000" />
</bean>
and have commons-fileupload.jar in my pom.xml:
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.2</version>
</dependency>
My JSP looks like this:
<portlet:actionURL var="processFormAction" >
<portlet:param name="execution" value="${flowExecutionKey}"/>
</portlet:actionURL>
<form:form action="${processFormAction}" modelAttribute="customerModel" enctype="multipart/form-data" method="post" >
<form:input path="firstName" cssClass="input-size-1 valid-required" />
<form:input path="lastName" cssClass="input-size-1 valid-required" />
<input name="avatar" id="avatar" type="file"/>
<input type="submit" name="_eventId_submit" id="send" value="Submit"/>
</form:form>
My flow.xml definition:
<view-state id="state1" model="customerModel">
...
<transition on="submit" to="submitFormActions"/>
</view-state>
<action-state id="submitFormActions">
<evaluate expression="portletAction.processForm(customerModel, flowRequestContext)" />
<transition on="success" to="state2"/>
<transition on="error" to="state1" />
</action-state>
The model object:
public class CustomerModel implements Serializable{
private String firstName;
private String lastName;
private MutlipartFile avatar;
...
//public getters and setters
}
Any thoughts what could be wrong? As I said, without enctype="multipart/form-data" the form processing works well.
Thanks
You are using org.springframework.web.multipart.commons.CommonsMultipartResolver which is not aware about the portlet context.
You need to change CommonsMultipartResolver to:
<bean id="portletMultipartResolver"
class="org.springframework.web.portlet.multipart.CommonsPortletMultipartResolver">
<!-- one of the properties available; the maximum file size in bytes -->
<property name="maxUploadSize" value="100000"/>
</bean>
Also, for this bean to be recognised by DispatcherPortlet, you need to define this bean id as mentioned above. The doc says:
Any configured PortletMultipartResolver bean must have the following id (or name): "portletMultipartResolver".
If you have defined your PortletMultipartResolver with any other name, then the DispatcherPortlet will not
find your PortletMultipartResolver, and consequently no multipart support will be in effect.

Passing value from Default.aspx to App or Main page in silverlight3

I'm using silverlight3 and vb.net..I want to pass the value from Default.aspx to my App or Main page. I wrote the code in my default.aspx page which it is returning the local ip address of the client System, I would like that same address to be used in my silverlight pages.
VB code
Dim clientIPAddress = System.Net.Dns
.GetHostAddresses(strHostName).GetValue(0).ToString()
This clientIPAddress will get the local ip of the client which is like 192.168.1.12. Now i want this value to be passed to my main page.
Please any one help to pass this value from default.aspx to my main page.
Thanks
Your default.aspx page will have an <object> tag where the Silverlight plugin is loaded. You can added a <param name="initParams value="clientID=192.168.1.12"> so it looks something like:-
<form id="form1" runat="server" style="height:100%">
<div id="silverlightControlHost">
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
<param name="source" value="ClientBin/Silverlight3App.xap"/>
<param name="onError" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="3.0.40818.0" />
<param name="autoUpgrade" value="true" />
<param name="initParams` value="clientID=192.168.1.12"`>
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40818.0" style="text-decoration:none">
<img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>
</a>
</object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div>
</form>
Except of course you wouldn't hardcode the IP address but you'd inject that with some VB.NET code (I don't do VB.NET).
The initParams parameter is a set of name=value pairs that are exposed in Silverlight as a IDictionary(Of String, String). You can get this dictionary from the Application Startup event arguments or from Application.Current.Host.InitParams.

Collecting Query string values from URL in Silverlight and WCF application

I am trying to retrieve query string values from a url. And the app should be a silverlight app.
For Eg: The sample URL might look like http://<hostname>/silverlightApp/Default.aspx?S=Name|address|title|sal|...
I should be able to take the query string and built a Silverlight UI.
Can this be done or Silverlight is not a good candidate for this type.
There are multiple ways you can do this. In the hosting page, you can pull out query string values using Request.QueryString, and then pass them to Silverlight using the initParams tag, i.e.:
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2"
width="100%" height="100%">
<param name="source" value="/ClientBin/MyApplication.xap" />
<param name="onerror" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="3.0.40620.0" />
<param name="autoUpgrade" value="true" />
<param name="windowless" value="true" />
<param name="initParams" value="<%=InitParameters %>" />
<param name="splashScreenSource" value="<%=SplashScreenSource %>" />
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40620.0" style="text-decoration: none;">
<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight"
style="border-style: none" />
</a>
</object>
Or from within the Silverlight application itself, you can grab the querystring and other parts of the URI by using HtmlPage.Document.documentUri, e.g.:
Uri uri = HtmlPage.Document.DocumentUri;
And once you've got the actual querystring, you can parse it using regular expressions, or whatever your poison of choice happens to be.
HTH.
See System.Web.HttpUtility.ParseQueryString() Method, which parses a query string into a NameValueCollection.
[Later] Sorry, the Silverlight runtime seems to be without the System.Web namespace.
See system.Uri.Query in the System namespace provided with Silverlight runtime.
The Query property contains any query information included in the URI. Query information is separated from the path information by a question mark (?) and continues to the end of the URI. The query information returned includes the leading question mark.
The query information is escaped according to RFC 3986.
The following example writes the query ?date= today to the console.
Uri baseUri = new Uri ("http://www.contoso.com/");
Uri myUri = new Uri (baseUri, "catalog/shownew.htm?date=today");
outputBlock.Text += "Uri.Query: ";
outputBlock.Text += myUri.Query;
outputBlock.Text += "\n";