我们将我的 Orbeon 迁移到了 4.2 版,并且遇到了以前在使用旧版本时没有遇到的问题。使用用户名登录后,选项卡没有显示在页面中,只有在刷新页面后才会显示。我们在使用 orbeon 3.9 和旧版本的 orbeon 时没有遇到这个问题。我们无法找到这个问题的根源和解决方案,怀疑它可能是由会话引起的。请帮助解决这个问题。
谢谢
基本上我们使用 web-inf/web.xml 来控制谁可以访问 url,代码如下:
<security-constraint>
<web-resource-collection>
<web-resource-name>UIS Protected Resources</web-resource-name>
<url-pattern>/uis-welcome/login/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>registered</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/uis-authentication/login</form-login-page>
<form-error-page>/uis-authentication/login-error</form-error-page>
</form-login-config>
</login-config>
<security-role>
<role-name>registered</role-name>
</security-role>
我们在 config/theme.xsl 文件中过滤用户访问,代码如下:
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:f="http://orbeon.org/oxf/xml/formatting"
xmlns:xh="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:version="java:org.orbeon.oxf.common.Version">
<xsl:import href="theme-plain.xsl"/>
<!-- This contains some useful request information -->
<xsl:variable name="request" select="doc('input:request')" as="document-node()"/>
<xsl:variable name="session" select="doc('input:session')" as="document-node()"/>
<xsl:variable name="current-user-role" select="$session/users/user/user_role" as="xs:string"/>
<xsl:variable name="current-user-agent" select="$request/*/headers/header[name='user-agent']/value" as="xs:string"/>
<!-- List of applications -->
<xsl:variable name="applications-welcome" select="doc('/ubd_gen_next_degrees-apps-list-welcome.xml')" as="document-node()"/>
<xsl:variable name="applications-student" select="doc('/ubd_gen_next_degrees-apps-list-student.xml')" as="document-node()"/>
<xsl:variable name="applications-admission-staff" select="doc('/ubd_gen_next_degrees-apps-list-admission-staff.xml')" as="document-node()"/>
<!-- Current application id -->
<xsl:variable name="current-application-id" select="tokenize(doc('input:request')/*/request-path, '/')[4]" as="xs:string"/>
<xsl:variable name="current-category-id" select="tokenize(doc('input:request')/*/request-path, '/')[3]" as="xs:string"/>
<xsl:variable name="current-section-id" select="tokenize(doc('input:request')/*/request-path, '/')[2]" as="xs:string"/>
<!-- Try to obtain a meaningful title for the example -->
<xsl:variable name="title" select="if (/xh:html/xh:head/xh:title != '')
then /xh:html/xh:head/xh:title
else if (/xh:html/xh:body/xh:h1)
then (/xh:html/xh:body/xh:h1)[1]
else '[Untitled]'" as="xs:string"/>
<xsl:template match="xh:head">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
<xh:link rel="stylesheet" href="/fr/style/bootstrap_all/css/bootstrap.css" type="text/css"/>
<xh:link rel="stylesheet" href="/fr/style/form-runner-bootstrap-override.css" type="text/css"/>
<xh:link rel="stylesheet" href="/config/theme-staff/examples.css" type="text/css" media="all"/>
<xh:link rel="stylesheet" href="/fr/style/menu_style.css" type="text/css" />
<xh:link rel="shortcut icon" href="/ops/images/orbeon-icon-16.ico"/>
<xh:link rel="icon" href="/ops/images/orbeon-icon-16.png" type="image/png"/>
</xsl:copy>
</xsl:template>
<xsl:template match="xh:body">
<xsl:copy>
<xsl:apply-templates select="@* except @class"/>
<xsl:attribute name="class" select="string-join(('orbeon', @class), ' ')"/>
<xh:div class="container">
<xh:div align="right">
<xsl:value-of select="string($request/*/remote-user)"/>
<xsl:choose>
<xsl:when test="string-length(string($request/*/remote-user)) = 0">
| <xh:a href="/uis-welcome/login/"><b>Login</b></xh:a>
</xsl:when>
<xsl:otherwise>
| <xh:a href="/uis-authentication/logout?global=true"><b>Logout</b></xh:a>
</xsl:otherwise>
</xsl:choose>
</xh:div>
<xh:ul id="nav">
<xsl:for-each select="$applications-welcome/*/section">
<xsl:variable name="main-selected" as="xs:boolean" select="@sid = $current-section-id"/>
<xh:li class="{if ($main-selected) then 'current' else ''}">
<xh:a href="#"><xsl:value-of select="@label"/></xh:a>
<xh:ul>
<xsl:for-each select="./category">
<xh:li>
<xh:a href="#"><xsl:value-of select="@label"/></xh:a>
<xh:ul>
<xsl:for-each select="./application">
<xh:li><xh:a href="/{@sid}/{@id}/"><xsl:value-of select="@label"/></xh:a></xh:li>
</xsl:for-each>
</xh:ul>
</xh:li>
</xsl:for-each>
</xh:ul>
</xh:li>
</xsl:for-each>
<xsl:for-each select="$session/users/user">
<xsl:if test="matches(.,'student')">
<xsl:for-each select="$applications-student/*/section">
<xsl:variable name="main-selected" as="xs:boolean" select="@sid = $current-section-id"/>
<xh:li class="{if ($main-selected) then 'current' else ''}">
<xh:a href="#"><xsl:value-of select="@label"/></xh:a>
<xh:ul>
<xsl:for-each select="./category">
<xh:li>
<xh:a href="#"><xsl:value-of select="@label"/></xh:a>
<xh:ul>
<xsl:for-each select="./application">
<xh:li><xh:a href="/{@sid}/{@id}/"><xsl:value-of select="@label"/></xh:a></xh:li>
</xsl:for-each>
</xh:ul>
</xh:li>
</xsl:for-each>
</xh:ul>
</xh:li>
</xsl:for-each>
</xsl:if>
<xsl:if test="matches(.,'admission-staff')">
<xsl:for-each select="$applications-admission-staff/*/section">
<xsl:variable name="main-selected" as="xs:boolean" select="@sid = $current-section-id"/>
<xh:li class="{if ($main-selected) then 'current' else ''}">
<xh:a href="#"><xsl:value-of select="@label"/></xh:a>
<xh:ul>
<xsl:for-each select="./category">
<xh:li>
<xh:a href="#"><xsl:value-of select="@label"/></xh:a>
<xh:ul>
<xsl:for-each select="./application">
<xh:li><xh:a href="/{@sid}/{@id}/"><xsl:value-of select="@label"/></xh:a></xh:li>
</xsl:for-each>
</xh:ul>
</xh:li>
</xsl:for-each>
</xh:ul>
</xh:li>
</xsl:for-each>
</xsl:if>
</xsl:for-each>
</xh:ul>
<xsl:apply-templates select="node()"/>
</xh:div>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
when we tried to debug from the epilogue-servlet.xpl:
<p:processor name="oxf:scope-generator">
<p:input name="config">
<config>
<key>requserdata</key>
<scope>session</scope>
<session-scope>application</session-scope>
</config>
</p:input>
<p:output name="data" debug="true" id="session"/>
</p:processor>
刷新页面后,输出数据将只有数据。
这是结语-servlet.xpl
<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:xh="http://www.w3.org/1999/xhtml"
xmlns:oxf="http://www.orbeon.com/oxf/processors"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:atom="http://www.w3.org/2005/Atom">
<!-- The document produced by the page view with XForms processing performed -->
<p:param type="input" name="xformed-data"/>
<!-- The raw document produced by the page view -->
<!-- <p:param type="input" name="data"/>-->
<!-- The XML submission if any -->
<p:param type="input" name="instance"/>
<p:processor name="oxf:scope-generator">
<p:input name="config">
<config>
<key>requserdata</key>
<scope>session</scope>
<session-scope>application</session-scope>
</config>
</p:input>
<p:output name="data" id="session"/>
</p:processor>
<!-- Get request information -->
<p:processor name="oxf:request">
<p:input name="config">
<config>
<include>/request/container-type</include>
<include>/request/request-path</include>
<include>/request/headers/header[name = 'user-agent']</include>
<include>/request/headers/header[name = 'accept']</include>
<!-- Return all parameters so they are made available to the theme -->
<include>/request/parameters/parameter</include>
<include>/request/remote-user</include>
</config>
</p:input>
<p:output name="data" id="request"/>
</p:processor>
<!-- The container is a servlet -->
<p:choose href="#xformed-data">
<!-- XHTML detection. Apply the theme, rewrite URLs, and serialize to HTML or XHTML. -->
<p:when test="/xh:html">
<!-- Pick theme -->
<p:choose href="#request">
<p:when test="/request/parameters/parameter[name = 'orbeon-theme']/value = 'plain'">
<!-- Plain theme -->
<p:processor name="oxf:identity">
<p:input name="data">
<config>oxf:/config/theme-plain.xsl</config>
</p:input>
<p:output name="data" id="theme-config"/>
</p:processor>
</p:when>
<!-- Get regular, embeddable or renderer theme -->
<p:otherwise>
<p:processor name="oxf:identity">
<p:input name="data"
href="aggregate('config', #request#xpointer(for $app in tokenize(/request/request-path, '/')[2] return
for $is-embeddable in
p:property('oxf.epilogue.embeddable')
or /request/parameters/parameter[name = ('orbeon-embeddable', 'orbeon-portlet')]/value = 'true' return
for $is-renderer in
p:get-request-attribute('oxf.xforms.renderer.deployment', 'text/plain') = ('separate', 'integrated') return
for $app-style in concat('oxf:/apps/', $app, if ($is-embeddable) then '/theme-embeddable.xsl' else '/theme.xsl') return
if (not($is-renderer) and doc-available($app-style))
then $app-style
else if ($is-embeddable) then p:property('oxf.epilogue.theme.embeddable')
else if ($is-renderer) then p:property('oxf.epilogue.theme.renderer')
else p:property('oxf.epilogue.theme')))"/>
<p:output name="data" id="theme-config"/>
</p:processor>
</p:otherwise>
</p:choose>
<!-- Apply theme if needed -->
<p:choose href="#request"><!-- dummy test input -->
<p:when test="not(p:property('oxf.epilogue.use-theme') = false())">
<!-- Theme -->
<p:processor name="oxf:url-generator">
<p:input name="config" href="#theme-config"/>
<p:output name="data" id="theme"/>
</p:processor>
<p:processor name="oxf:unsafe-xslt">
<p:input name="data" href="#xformed-data"/>
<p:input name="instance" href="#instance"/>
<p:input name="request" href="#request"/>
<p:input name="session" href="#session"/>
<p:input name="config" href="#theme"/>
<p:output name="data" id="themed-data"/>
</p:processor>
</p:when>
<p:otherwise>
<!-- No theme -->
<p:processor name="oxf:identity">
<p:input name="data" href="#xformed-data"/>
<p:output name="data" id="themed-data"/>
</p:processor>
</p:otherwise>
</p:choose>
<!-- Perform URL rewriting if needed -->
<p:choose href="#request">
<p:when test="not(starts-with(/request/request-path, '/xforms-renderer') and not(p:property('oxf.epilogue.renderer-rewrite')))">
<!-- Rewriting -->
<p:processor name="oxf:xhtml-rewrite">
<p:input name="data" href="#themed-data"/>
<p:output name="data" id="rewritten-data"/>
</p:processor>
</p:when>
<p:otherwise>
<!-- No rewriting -->
<p:processor name="oxf:identity">
<p:input name="data" href="#themed-data"/>
<p:output name="data" id="rewritten-data"/>
</p:processor>
</p:otherwise>
</p:choose>
<!-- Choose between XHTML output and HTML output -->
<p:choose href="#request">
<p:when test="p:property('oxf.epilogue.output-xhtml')">
<!-- Produce XHTML output -->
<p:choose href="#request">
<p:when test="contains(/request/headers/header[name = 'accept'], 'application/xhtml+xml')">
<p:processor name="oxf:plain-xhtml-converter">
<p:input name="data" href="#rewritten-data"/>
<p:output name="data" id="xhtml-data"/>
</p:processor>
<p:processor name="oxf:xml-converter">
<p:input name="config">
<config>
<method>xhtml</method>
<omit-xml-declaration>true</omit-xml-declaration>
<encoding>utf-8</encoding>
<content-type>application/xhtml+xml</content-type>
<indent>true</indent>
<indent-amount>0</indent-amount>
</config>
</p:input>
<p:input name="data" href="#xhtml-data"/>
<p:output name="data" id="converted"/>
</p:processor>
</p:when>
<p:otherwise>
<p:processor name="oxf:plain-html-converter">
<p:input name="data" href="#rewritten-data"/>
<p:output name="data" id="xhtml-data"/>
</p:processor>
<p:processor name="oxf:html-converter">
<p:input name="config">
<config>
<version>5.0</version>
<encoding>utf-8</encoding>
<indent>true</indent>
<indent-amount>0</indent-amount>
</config>
</p:input>
<p:input name="data" href="#xhtml-data"/>
<p:output name="data" id="converted"/>
</p:processor>
</p:otherwise>
</p:choose>
</p:when>
<p:otherwise>
<!-- Produce HTML output -->
<!-- For embeddable, don't put a doctype declaration -->
<p:choose href="#request">
<p:when test="(p:property('oxf.epilogue.embeddable')
or (/request/parameters/parameter[name = ('orbeon-embeddable', 'orbeon-portlet')]/value = 'true'))">
<p:processor name="oxf:identity">
<p:input name="data">
<config>
<encoding>utf-8</encoding>
<indent>true</indent>
<indent-amount>0</indent-amount>
</config>
</p:input>
<p:output name="data" id="html-converter-config"/>
</p:processor>
</p:when>
<p:otherwise>
<p:processor name="oxf:identity">
<p:input name="data">
<config>
<version>5.0</version>
<encoding>utf-8</encoding>
<indent>true</indent>
<indent-amount>0</indent-amount>
</config>
</p:input>
<p:output name="data" id="html-converter-config"/>
</p:processor>
</p:otherwise>
</p:choose>
<p:processor name="oxf:plain-html-converter">
<p:input name="data" href="#rewritten-data"/>
<p:output name="data" id="xhtml-data"/>
</p:processor>
<!-- Convert to HTML, choosing between embeddable and plain -->
<p:processor name="oxf:html-converter">
<p:input name="config" href="#html-converter-config"/>
<p:input name="data" href="#xhtml-data"/>
<p:output name="data" id="converted"/>
</p:processor>
</p:otherwise>
</p:choose>
<!-- Serialize to HTTP -->
<p:processor name="oxf:http-serializer">
<p:input name="config">
<config>
<!-- NOTE: converters specify content-type -->
</config>
</p:input>
<p:input name="data" href="#converted"/>
</p:processor>
</p:when>
<!-- Plain HTML detection. No theme is applied, but URLs are rewritten. -->
<p:when test="/html">
<!-- Rewrite all URLs in HTML documents -->
<p:processor name="oxf:html-rewrite" >
<p:input name="data" href="#xformed-data" />
<p:output name="data" id="rewritten-data" />
</p:processor>
<!-- Output regular HTML doctype -->
<p:processor name="oxf:html-converter">
<p:input name="config">
<config>
<version>5.0</version>
<encoding>utf-8</encoding>
<indent>true</indent>
<indent-amount>0</indent-amount>
</config>
</p:input>
<p:input name="data" href="#rewritten-data"/>
<p:output name="data" id="converted"/>
</p:processor>
<p:processor name="oxf:http-serializer">
<p:input name="config">
<config>
<!-- NOTE: HTML converter specifies text/html content-type -->
</config>
</p:input>
<p:input name="data" href="#converted"/>
</p:processor>
</p:when>
<!-- XSL-FO detection. Use the XSL-FO serializer -->
<p:when test="p:property('oxf.epilogue.process-xslfo') and /fo:root">
<p:processor name="oxf:xslfo-converter">
<p:input name="config"><config/></p:input>
<p:input name="data" href="#xformed-data"/>
<p:output name="data" id="converted"/>
</p:processor>
<p:processor name="oxf:http-serializer">
<p:input name="config">
<config>
<header>
<name>Content-Disposition</name>
<value>attachment; filename=document.pdf</value>
</header>
<!-- NOTE: XSL-FO converter specifies application/pdf content-type -->
</config>
</p:input>
<p:input name="data" href="#converted"/>
</p:processor>
</p:when>
<!-- SVG detection -->
<p:when test="p:property('oxf.epilogue.process-svg') and /svg:svg">
<p:processor name="oxf:svg-converter">
<p:input name="config"><config/></p:input>
<p:input name="data" href="#xformed-data"/>
<p:output name="data" id="converted"/>
</p:processor>
<p:processor name="oxf:http-serializer">
<p:input name="config">
<config>
NOTE: SVG converter specifies content-type, usually image/png
</config>
</p:input>
<p:input name="data" href="#converted"/>
</p:processor>
</p:when>
<!-- Atom detection -->
<p:when test="/atom:feed">
<p:processor name="oxf:xml-converter">
<p:input name="config">
<config>
<encoding>utf-8</encoding>
<content-type>application/atom+xml</content-type>
<indent>false</indent>
<indent-amount>0</indent-amount>
</config>
</p:input>
<p:input name="data" href="#xformed-data"/>
<p:output name="data" id="converted"/>
</p:processor>
<p:processor name="oxf:http-serializer">
<p:input name="config">
<config>
<!-- NOTE: XML converter specifies content-type -->
</config>
</p:input>
<p:input name="data" href="#converted"/>
</p:processor>
</p:when>
<!-- Non XML documents -->
<p:when test="/document[@xsi:type]">
<p:processor name="oxf:http-serializer">
<p:input name="config">
<config>
<!-- NOTE: use content-type specified on root element -->
</config>
</p:input>
<p:input name="data" href="#xformed-data"/>
</p:processor>
</p:when>
<!-- No particular document format detected. Output plain XML. -->
<p:otherwise>
<!-- Convert and serialize to XML -->
<p:processor name="oxf:xml-converter">
<p:input name="config">
<config>
<encoding>utf-8</encoding>
<indent>false</indent>
<indent-amount>0</indent-amount>
</config>
</p:input>
<p:input name="data" href="#xformed-data"/>
<p:output name="data" id="converted"/>
</p:processor>
<p:processor name="oxf:http-serializer">
<p:input name="config">
<config>
<!-- NOTE: XML converter specifies application/xml content-type -->
</config>
</p:input>
<p:input name="data" href="#converted"/>
</p:processor>
</p:otherwise>
</p:choose>
</p:config>