css and js not found when embedding

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

css and js not found when embedding

p.vaglio
Hello there,
I am trying a POC of embedding a form within a JSP.
I am deploying an ear file containing the JSP and deploying orbeon.war (PE)
localhost8080/orbeon gives me access to the builder and the form runner with no issues.
The JSP page is loaded and the API is called nicely but the returned HTML calls for css and js that cannot be found.
For example http://localhost:8080/orbeon/o/3438fd82ca24b73625c22f3fdc61f8d537c7eab7/ops/javascript/orbeon/xforms/Document.min.js 
In fact this js is found under
http://localhost:8080/orbeon/3438fd82ca24b73625c22f3fdc61f8d537c7eab7/ops/javascript/orbeon/xforms/Document.min.js without the "/o"

I mut be missing something and I need a clue.
Any help would be greatly appreciated

Thanks
Philippe
Reply | Threaded
Open this post in threaded view
|

Re: css and js not found when embedding

Alessandro  Vernet
Administrator
Hi Philippe,

Are you embedding a form you created with Form Builder using the embedding API (linked below)? Is this with Orbeon Forms 2016.3? Can you reproduce this when embedding a build-in form, say the Bookshelf Form? And if you can, could you share with us some code that does this, so we can reproduce the issue here?

https://doc.orbeon.com/form-runner/link-embed/java-api.html

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: css and js not found when embedding

p.vaglio
Hi Alex,
Thanks for your answer.
Yes I am embedding a form created with the form builder using the embedding API with version 2016.3.
I was trying to have the form runner using the same instance of the servlet container.
I now have the form runner running on a separate container and it is working.
Here is the setup.
orbeon-embedding.jar in the WEB-INF/lib of my app with the following web.xml
<filter>
    <filter-name>orbeon-form-runner-filter</filter-name>
    <filter-class>org.orbeon.oxf.fr.embedding.servlet.ServletFilter</filter-class>
    <init-param>
        <param-name>form-runner-url</param-name>
        <param-value>http://localhost:8180/orbeon</param-value>
    </init-param>
    <init-param>
        <param-name>orbeon-prefix</param-name>
        <param-value>/orbeon</param-value>
    </init-param>
</filter>
<filter-mapping>
    <filter-name>orbeon-form-runner-filter</filter-name>
    <url-pattern>*.jsp</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
</filter-mapping>
<filter-mapping>
    <filter-name>orbeon-form-runner-filter</filter-name>
    <url-pattern>/orbeon/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
</filter-mapping>
The form runner is running on localhost:8180 and my app on localhost:8080
The JSP
<%@ page import="org.orbeon.oxf.fr.embedding.servlet.API" %>
 <link rel="stylesheet" href="//getbootstrap.com/2.3.2/assets/css/bootstrap.css">
 <link rel="stylesheet" href="//getbootstrap.com/2.3.2/assets/css/bootstrap-responsive.css">
	<div class="container">
<%
        API.embedFormJava(
            request,            // HttpServletRequest: incoming HttpServletRequest
            out,                // Writer: where the embedded form is written
            "MBIO",   			// String: Form Runner app name
            "Form1",          	// String: Form Runner form name
            "new",              // String: Form Runner action name
            null,               // String: Form Runner document id (optional)
            null,               // String: query string (optional)
            null                // Map<String, String>: custom HTTP headers (optional)
        );
%>
    </div>

Not sure if that was the cause I will do more test and post back what I've found

Philippe
Reply | Threaded
Open this post in threaded view
|

Re: css and js not found when embedding

Alessandro  Vernet
Administrator
Hi Philippe,

I'm glad it works with a separate container. Things should work out when running both your app and Orbeon Forms on the same container. In fact this is how we test the feature, and how most customers are using it, so I would have been less surprised had you told me things don't work when using different containers :). Anyhow, thank you for the update.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: css and js not found when embedding

p.vaglio
Hi,
I've found what was the problem with the deployment in the same container.
It is fixed by using a different orbeon-prefix then /orbeon
for the runner-filter
<filter>
    <filter-name>orbeon-form-runner-filter</filter-name>
    <filter-class>org.orbeon.oxf.fr.embedding.servlet.ServletFilter</filter-class>
    <init-param>
        <param-name>form-runner-url</param-name>
        <param-value>http://localhost:8080/orbeon</param-value>
    </init-param>
    <init-param>
        <param-name>orbeon-prefix</param-name>
        <param-value>/other-prefix</param-value>
    </init-param>
</filter>
and then modifying the filter-mapping with the same prefix
<filter-mapping>
    <filter-name>orbeon-form-runner-filter</filter-name>
    <url-pattern>/other-prefix/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
</filter-mapping>

Philippe
Reply | Threaded
Open this post in threaded view
|

Re: css and js not found when embedding

Erik Bruchez
Administrator
Philippe,

Interesting: the default `/orbeon` prefix should work. Did you deploy your JSP in the root context by any chance? We might not have tested that scenario.

-Erik
Reply | Threaded
Open this post in threaded view
|

Re: css and js not found when embedding

p.vaglio

Hey Erik,

Yes the JSP is indeed in the root context.

Philippe


Le 02/02/2017 à 06:07, Erik Bruchez [via Orbeon Forms community mailing list] a écrit :
Philippe,

Interesting: the default `/orbeon` prefix should work. Did you deploy your JSP in the root context by any chance? We might not have tested that scenario.

-Erik


If you reply to this email, your message will be added to the discussion below:
http://discuss.orbeon.com/css-and-js-not-found-when-embedding-tp4662145p4662176.html
To unsubscribe from css and js not found when embedding, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: css and js not found when embedding

Erik Bruchez
Administrator
Then it's probably a bug related to that. Do you need to use the root context or could you move to another context?

-Erik