Browse Source

Build a minified version of vaadinPush.js in vaadin-push.jar (#11630)

* Replaced jquery and jquery.atmosphere.js with original, unmodified versions
* Added vaadinPush.js build target to ide.xml and push/build.xml
* Uses yuicompressor to compress the resulting push javascript

Change-Id: I59ba9c2bbf74e05d10325d38efdb106b638cd8e7
tags/7.1.0.beta1
Artur Signell 11 years ago
parent
commit
cdcdc115b7

+ 2
- 0
.gitignore View File

/WebContent/VAADIN/widgetsets /WebContent/VAADIN/widgetsets
/WebContent/VAADIN/gwt-unitCache* /WebContent/VAADIN/gwt-unitCache*


WebContent/VAADIN/vaadinPush.js

# /WebContent/WEB-INF/ # /WebContent/WEB-INF/
/WebContent/WEB-INF/classes /WebContent/WEB-INF/classes



WebContent/VAADIN/jquery-1.7.2.rebased.js → WebContent/VAADIN/jquery-1.7.2.js View File





})( window ); })( window );

window.jQueryVaadin = window.jQuery.noConflict(true);

WebContent/VAADIN/jquery.atmosphere.js
File diff suppressed because it is too large
View File


+ 8
- 0
WebContent/VAADIN/vaadinPush.js.tpl View File

@jquery.js@
window.jQueryVaadin = window.jQuery.noConflict(true);
(function(jQuery, undefined) {
@jquery.atmosphere.js@
})(jQueryVaadin);
if (console) {
console.log("Vaadin push loaded");
}

+ 21
- 6
build/ide.xml View File

<path location="client/src" /> <path location="client/src" />
</path> </path>


<target name="theme-and-default-widgetset" depends="default-widgetset, themes">
<target name="theme-and-default-widgetset" depends="default-widgetset, themes, vaadinPush.js">
</target> </target>
<target name="themes"> <target name="themes">
<antcall target="compile-theme"> <antcall target="compile-theme">
</java> </java>


</target> </target>
<target name="default-widgetset"> <target name="default-widgetset">
<antcall target="compile-widgetset"> <antcall target="compile-widgetset">
<param name="widgetset" value="com.vaadin.DefaultWidgetSet" /> <param name="widgetset" value="com.vaadin.DefaultWidgetSet" />
</antcall> </antcall>
</target> </target>
<target name="testing-widgetset"> <target name="testing-widgetset">
<antcall target="compile-widgetset"> <antcall target="compile-widgetset">
<param name="widgetset" value="com.vaadin.tests.widgetset.TestingWidgetSet" /> <param name="widgetset" value="com.vaadin.tests.widgetset.TestingWidgetSet" />
</antcall> </antcall>
</target> </target>
<target name="compile-widgetset"> <target name="compile-widgetset">
<property name="module" value="${widgetset}" /> <property name="module" value="${widgetset}" />
<property name="module.output.dir" location="WebContent/VAADIN/widgetsets" /> <property name="module.output.dir" location="WebContent/VAADIN/widgetsets" />
<jvmarg value="-Djava.awt.headless=true" /> <jvmarg value="-Djava.awt.headless=true" />
<jvmarg value="-Dgwt.usearchives=false" /> <jvmarg value="-Dgwt.usearchives=false" />
</java> </java>
</target>
</target>
<target name="vaadinPush.js">
<property name="vaadinPush.js.output" location="WebContent/VAADIN/vaadinPush.js" />

<loadfile srcfile="WebContent/VAADIN/jquery-1.7.2.js" property="jquery.js.contents" />
<loadfile srcfile="WebContent/VAADIN/jquery.atmosphere.js" property="jquery.atmosphere.js.contents" />
<loadfile srcfile="WebContent/VAADIN/vaadinPush.js.tpl" property="vaadinPush.js.contents">
<filterchain>
<replacetokens begintoken="@" endtoken="@">
<token key="jquery.js" value="${jquery.js.contents}" />
<token key="jquery.atmosphere.js" value="${jquery.atmosphere.js.contents}" />
</replacetokens>
</filterchain>
</loadfile>
<echo file="${vaadinPush.js.output}">${vaadinPush.js.contents}</echo>
</target>
</project> </project>

+ 34
- 7
push/build.xml View File

<?xml version="1.0"?> <?xml version="1.0"?>


<project name="vaadin-push" basedir="." default="publish-local">
<project name="vaadin-push" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant">
<description> <description>
Meta package which defines dependencies needed for push Meta package which defines dependencies needed for push
</description> </description>
<property name="module.name" value="vaadin-push" /> <property name="module.name" value="vaadin-push" />
<property name="module.symbolic" value="com.vaadin.push" /> <property name="module.symbolic" value="com.vaadin.push" />
<property name="result.dir" location="result" /> <property name="result.dir" location="result" />
<property name="vaadinPush.js" location="${result.dir}/js/VAADIN/vaadinPush.js" />
<path id="classpath.compile.custom" /> <path id="classpath.compile.custom" />
<union id="jar.includes"> <union id="jar.includes">
<fileset dir="${vaadin.basedir}/WebContent">
<include name="VAADIN/jquery-1.7.2.rebased.js" />
<include name="VAADIN/jquery.atmosphere.rebased.js" />
<fileset dir="${result.dir}/js">
<include name="VAADIN/vaadinPush.js" />
</fileset> </fileset>
</union> </union>
<target name="jar">

<target name="vaadinPush.js">
<mkdir dir="${result.dir}/js/VAADIN" />
<property name="vaadinPush.js.output" location="${result.dir}/js/VAADIN/vaadinPush.js" />
<property name="vaadinPush.js.combined.output" location="${result.dir}/js/VAADIN/push.combined.js" />

<loadfile srcfile="${vaadin.basedir}/WebContent/VAADIN/jquery-1.7.2.js" property="jquery.js.contents" />
<loadfile srcfile="${vaadin.basedir}/WebContent/VAADIN/jquery.atmosphere.js" property="jquery.atmosphere.js.contents" />
<loadfile srcfile="${vaadin.basedir}/WebContent/VAADIN/vaadinPush.js.tpl" property="vaadinPush.js.contents">
<filterchain>
<replacetokens begintoken="@" endtoken="@">
<token key="jquery.js" value="${jquery.js.contents}" />
<token key="jquery.atmosphere.js" value="${jquery.atmosphere.js.contents}" />
</replacetokens>
</filterchain>
</loadfile>
<echo file="${vaadinPush.js.combined.output}">${vaadinPush.js.contents}</echo>

<!-- Minify -->
<ivy:retrieve organisation="com.yahoo.platform.yui" module="yuicompressor" revision="2.4.7" inline="true" type="jar" pattern="${result.dir}/compressor.jar" />
<java jar="${result.dir}/compressor.jar" fork="true">
<arg value="-v"/>
<arg value="-o"/>
<arg file="${vaadinPush.js.output}"/>
<arg file="${vaadinPush.js.combined.output}"/>
</java>
</target>
<target name="jar" depends="vaadinPush.js">
<property name="server.osgi.import" value="" /> <property name="server.osgi.import" value="" />
<antcall target="common.jar"> <antcall target="common.jar">
<param name="require-bundle" value="" /> <param name="require-bundle" value="" />

+ 1
- 4
server/src/com/vaadin/server/BootstrapHandler.java View File

// Load client-side dependencies for push support // Load client-side dependencies for push support
fragmentNodes.add(new Element(Tag.valueOf("script"), "").attr( fragmentNodes.add(new Element(Tag.valueOf("script"), "").attr(
"type", "text/javascript").attr("src", "type", "text/javascript").attr("src",
vaadinLocation + "jquery-1.7.2.rebased.js"));
fragmentNodes.add(new Element(Tag.valueOf("script"), "").attr(
"type", "text/javascript").attr("src",
vaadinLocation + "jquery.atmosphere.rebased.js"));
vaadinLocation + "vaadinPush.js"));
} }


String bootstrapLocation = vaadinLocation + "vaadinBootstrap.js"; String bootstrapLocation = vaadinLocation + "vaadinBootstrap.js";

+ 2
- 3
server/src/com/vaadin/server/VaadinServlet.java View File

private boolean serveStaticResources(HttpServletRequest request, private boolean serveStaticResources(HttpServletRequest request,
HttpServletResponse response) throws IOException, ServletException { HttpServletResponse response) throws IOException, ServletException {


// FIXME What does 10 refer to?
String pathInfo = request.getPathInfo(); String pathInfo = request.getPathInfo();
if (pathInfo == null || pathInfo.length() <= 10) {
if (pathInfo == null) {
return false; return false;
} }




protected boolean isStaticResourceRequest(HttpServletRequest request) { protected boolean isStaticResourceRequest(HttpServletRequest request) {
String pathInfo = request.getPathInfo(); String pathInfo = request.getPathInfo();
if (pathInfo == null || pathInfo.length() <= 10) {
if (pathInfo == null) {
return false; return false;
} }



Loading…
Cancel
Save