<div dir="ltr">Hi<div><br></div><div>For me it make sense switch the user. Another thing you can try to make some validation to return the error message to your page.</div><div><br></div><div>Regards</div></div><br><div class="gmail_quote"><div dir="ltr">El mié., 26 de oct. de 2016 a la(s) 10:43, Paul-Inge Flakstad <<a href="mailto:flakstad@npolar.no">flakstad@npolar.no</a>> escribió:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="NO-BOK" link="blue" vlink="purple" class="gmail_msg">
<div class="m_5782570075731493768WordSection1 gmail_msg">
<p class="MsoNormal gmail_msg"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d" class="gmail_msg">Hi,<u class="gmail_msg"></u><u class="gmail_msg"></u></span></p>
<p class="MsoNormal gmail_msg"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d" class="gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></span></p>
<p class="MsoNormal gmail_msg"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d" class="gmail_msg">I may be wrong here, but I'm guessing it's because the Guest user cannot switch to the Offline project. (Keep in mind
that your CmsObject is initialized with a user.) This would explain why it works when you test it with your user in the Online project, but fails in the actual online version.)<u class="gmail_msg"></u><u class="gmail_msg"></u></span></p>
<p class="MsoNormal gmail_msg"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d" class="gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></span></p>
<p class="MsoNormal gmail_msg"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d" class="gmail_msg">Try switching to a user with sufficient privileges before you switch to the Offline project.<u class="gmail_msg"></u><u class="gmail_msg"></u></span></p>
<p class="MsoNormal gmail_msg"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d" class="gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></span></p>
<p class="MsoNormal gmail_msg"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d" class="gmail_msg">Best regards,<br class="gmail_msg">
Paul<u class="gmail_msg"></u><u class="gmail_msg"></u></span></p>
<p class="MsoNormal gmail_msg"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d" class="gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></span></p>
<p class="MsoNormal gmail_msg"><b class="gmail_msg"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif" class="gmail_msg">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif" class="gmail_msg"> <a href="mailto:opencms-dev-bounces@opencms.org" class="gmail_msg" target="_blank">opencms-dev-bounces@opencms.org</a> [mailto:<a href="mailto:opencms-dev-bounces@opencms.org" class="gmail_msg" target="_blank">opencms-dev-bounces@opencms.org</a>]
<b class="gmail_msg">On Behalf Of </b>Qi Zhang<br class="gmail_msg">
<b class="gmail_msg">Sent:</b> 26. oktober 2016 17:29<br class="gmail_msg">
<b class="gmail_msg">To:</b> Christoph Kukulies <<a href="mailto:kuku@physik.rwth-aachen.de" class="gmail_msg" target="_blank">kuku@physik.rwth-aachen.de</a>><br class="gmail_msg">
<b class="gmail_msg">Cc:</b> The OpenCms mailing list <<a href="mailto:opencms-dev@opencms.org" class="gmail_msg" target="_blank">opencms-dev@opencms.org</a>><br class="gmail_msg">
<b class="gmail_msg">Subject:</b> Re: [opencms-dev] write access to file<u class="gmail_msg"></u><u class="gmail_msg"></u></span></p></div></div><div lang="NO-BOK" link="blue" vlink="purple" class="gmail_msg"><div class="m_5782570075731493768WordSection1 gmail_msg">
<p class="MsoNormal gmail_msg"><span lang="EN-US" class="gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></span></p>
<div class="gmail_msg">
<div class="gmail_msg">
<div class="gmail_msg">
<p class="MsoNormal gmail_msg" style="margin-bottom:12.0pt">Other pages are all fine. Just this one after clicking submit button..<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<p class="MsoNormal gmail_msg" style="margin-bottom:12.0pt">I have checked,as long as I have these lines of code. I have the error:<br class="gmail_msg">
<br class="gmail_msg">
<b class="gmail_msg">if(curProject.isOnlineProject()){<br class="gmail_msg">
CmsProject offlineProject = cmso.readProject("Offline");<br class="gmail_msg">
cmsContext.setCurrentProject(offlineProject);<br class="gmail_msg">
}</b><u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<p class="MsoNormal gmail_msg">But isn't it the only way to have write access to files? Does it mean we can't change to offline context in published webpage?<br class="gmail_msg">
<br class="gmail_msg">
Here are some related code:<br class="gmail_msg">
<i class="gmail_msg"><span style="color:#666666" class="gmail_msg">CmsJspActionElement cms = new CmsJspActionElement(pageContext, request, response);<br class="gmail_msg">
CmsObject cmso = cms.getCmsObject();<br class="gmail_msg">
<br class="gmail_msg">
CmsRequestContext cmsContext = cmso.getRequestContext();<br class="gmail_msg">
CmsProject curProject = cmsContext.currentProject();</span></i><u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></p>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">2016-10-26 14:26 GMT+02:00 Christoph Kukulies <<a href="mailto:kuku@physik.rwth-aachen.de" class="gmail_msg" target="_blank">kuku@physik.rwth-aachen.de</a>>:<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm" class="gmail_msg">
<div class="gmail_msg">
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">Am 26.10.2016 um 13:09 schrieb Qi Zhang:<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt" class="gmail_msg">
<p class="gmail_msg">Yes, it's a form and the action is a jsp.<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</blockquote>
<p class="MsoNormal gmail_msg">Permissions of the jsp? <br class="gmail_msg">
<br class="gmail_msg">
Do other pages work in <a href="http://www.123.com" class="gmail_msg" target="_blank">www.123.com</a>? Error 500 is "Internal Server Error" which indicates a syntax error in jsp sometimes. It's not just a page not found (404).<br class="gmail_msg">
You gotta gather more information. <br class="gmail_msg">
<br class="gmail_msg">
Can you invoke the jsp alone in the browser (possibly passing the neccessary parameters to it).<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
<div class="gmail_msg">
<div class="gmail_msg">
<p class="MsoNormal gmail_msg"><br class="gmail_msg">
<br class="gmail_msg">
<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt" class="gmail_msg">
<p class="gmail_msg">I'm working for a university. So I have limited permissions. I can only see server internal error HTTP 500 etc when I visit the page and submit form as a guest. Within opencms system all fine.
<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></p>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">On 26 Oct 2016 10:16, "Christoph Kukulies" <<a href="mailto:kuku@physik.rwth-aachen.de" class="gmail_msg" target="_blank">kuku@physik.rwth-aachen.de</a>> wrote:<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm" class="gmail_msg">
<div class="gmail_msg">
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">what does the log say (opencms.log, tomcat logs)?<br class="gmail_msg">
You say, it's a form, right? Is the action a jsp that is invoked?<br class="gmail_msg">
<br class="gmail_msg">
Am 25.10.2016 um 20:50 schrieb Qi Zhang:<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt" class="gmail_msg">
<div class="gmail_msg">
<div class="gmail_msg">
<p class="MsoNormal gmail_msg" style="margin-bottom:12.0pt">Hi,<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<p class="MsoNormal gmail_msg">the page is visible, just the function doesn't work.There is a webform, after clicking the function should be called. And then the page got a HTTP 500 error..<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></p>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">2016-10-25 19:55 GMT+02:00 Jose Fermin Athie Campollo <<a href="mailto:athiecampollo@gmail.com" class="gmail_msg" target="_blank">athiecampollo@gmail.com</a>>:<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm" class="gmail_msg">
<div class="gmail_msg">
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">Hi,<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">A few questions:<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<p class="MsoNormal gmail_msg">Do you use a balancer or is the server of opencms who resolve the domain?
<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">If it is from opencms you have to set the new domain <a href="http://www.opencms-wiki.org/wiki/MultiSite_configuration_instructions" class="gmail_msg" target="_blank">http://www.opencms-wiki.org/wiki/MultiSite_configuration_instructions</a><u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">In <a href="http://www.123.com" class="gmail_msg" target="_blank">www.123.com</a> is the only page they can not see?<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">Regards<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
</div>
<div class="gmail_msg">
<div class="gmail_msg">
<p class="MsoNormal gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></p>
<div class="gmail_msg">
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">El mar., 25 de oct. de 2016 a la(s) 11:53, Qi Zhang <<a href="mailto:kksjtu@gmail.com" class="gmail_msg" target="_blank">kksjtu@gmail.com</a>> escribió:<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm" class="gmail_msg">
<div class="gmail_msg">
<div class="gmail_msg">
<div class="gmail_msg">
<div class="gmail_msg">
<p class="MsoNormal gmail_msg" style="margin-bottom:12.0pt">Hi,<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<p class="MsoNormal gmail_msg" style="margin-bottom:12.0pt">thanks for the help!<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<p class="MsoNormal gmail_msg">Yes, I was coding according to the 1st documentation. But my problem is<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
</div>
<div class="gmail_msg">
<div class="gmail_msg">
<p class="MsoNormal gmail_msg" style="margin-bottom:12.0pt"><br class="gmail_msg">
<br class="gmail_msg">
<a href="http://opencms.123.com/index.html" class="gmail_msg" target="_blank">http://opencms.123.com/index.html</a><span style="font-family:"Calibri",sans-serif" class="gmail_msg">(</span>offline<span style="font-family:"Calibri",sans-serif" class="gmail_msg">)</span><br class="gmail_msg">
works!<br class="gmail_msg">
<a href="http://opencms.123.com/index.html" class="gmail_msg" target="_blank">http://opencms.123.com/index.html</a><span style="font-family:"Calibri",sans-serif" class="gmail_msg">(</span>online<span style="font-family:"Calibri",sans-serif" class="gmail_msg">)</span><br class="gmail_msg">
works!<br class="gmail_msg">
<a href="http://www.123.com/index.html" class="gmail_msg" target="_blank">http://www.123.com/index.html</a><span style="font-family:"Calibri",sans-serif" class="gmail_msg">(</span>online<span style="font-family:"Calibri",sans-serif" class="gmail_msg">)</span><br class="gmail_msg">
NOT working!<br class="gmail_msg">
<br class="gmail_msg">
<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">Do you have any idea why it happen?<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></p>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">2016-10-25 5:35 GMT+02:00 Jose Fermin Athie Campollo <span class="m_5782570075731493768m-7519527499398234260m4627645167713404567m-8670407722494514482gmailmsg gmail_msg">
<<a href="mailto:athiecampollo@gmail.com" class="gmail_msg" target="_blank">athiecampollo@gmail.com</a>></span>:<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm" class="gmail_msg">
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">Hi <u class="gmail_msg"></u><u class="gmail_msg"></u></p>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">Right now i can't see this page. <a href="http://www.opencms-wiki.org/wiki/Write_a_file_programatically" class="gmail_msg" target="_blank">http://www.opencms-wiki.org/wiki/Write_a_file_programatically</a> in it you could find a way to create a resource and
then publish it <u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">Some one else publish the code to create a resource <a href="http://opencms.996256.n3.nabble.com/Create-resource-programatically-td15459.html" class="gmail_msg" target="_blank">http://opencms.996256.n3.nabble.com/Create-resource-programatically-td15459.html</a> <u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">You should see the javadoc of<span class="m_5782570075731493768m-7519527499398234260m4627645167713404567m-8670407722494514482m-8552496068675999157m457778963602854218inbox-inbox-apple-converted-spacem4627645167713404567m-8670407722494514482gmailmsg gmail_msg"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif" class="gmail_msg"> </span></span><span class="m_5782570075731493768m-7519527499398234260m4627645167713404567m-8670407722494514482gmailmsg gmail_msg"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif" class="gmail_msg">CmsObject
</span></span><span class="m_5782570075731493768m-7519527499398234260m4627645167713404567m-8670407722494514482m-8552496068675999157m457778963602854218inbox-inbox-apple-converted-spacem4627645167713404567m-8670407722494514482gmailmsg gmail_msg"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif" class="gmail_msg"> you
can do a lot of thing with it. </span></span><u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg"><span class="m_5782570075731493768m-7519527499398234260m4627645167713404567m-8670407722494514482m-8552496068675999157m457778963602854218inbox-inbox-apple-converted-spacem4627645167713404567m-8670407722494514482gmailmsg gmail_msg"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif" class="gmail_msg">Regards</span></span><u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
</div>
<div class="gmail_msg">
<div class="gmail_msg">
<p class="MsoNormal gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></p>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
</div>
</div>
<p class="MsoNormal gmail_msg"><br clear="all" class="gmail_msg">
<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</blockquote>
</div>
<p class="MsoNormal gmail_msg"><br class="gmail_msg">
-- <u class="gmail_msg"></u><u class="gmail_msg"></u></p>
<div class="gmail_msg">
<div class="gmail_msg">
<div class="gmail_msg">
<div class="gmail_msg">
<div class="gmail_msg">
<div class="gmail_msg">
<div class="gmail_msg">
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">Best regards,<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">Qi Zhang<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></p>
</blockquote>
</div>
<p class="MsoNormal gmail_msg" style="margin-bottom:12.0pt"><br class="gmail_msg">
<br class="gmail_msg">
<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</blockquote>
</div>
</div>
</blockquote>
<p class="gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></p>
</div>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">-- <br class="gmail_msg">
Chris Christoph P. U. Kukulies kukulies (at) <a href="http://rwth-aachen.de" class="gmail_msg" target="_blank">
rwth-aachen.de</a> <u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal gmail_msg"><br class="gmail_msg">
<br clear="all" class="gmail_msg">
<br class="gmail_msg">
-- <u class="gmail_msg"></u><u class="gmail_msg"></u></p>
<div class="gmail_msg">
<div class="gmail_msg">
<div class="gmail_msg">
<div class="gmail_msg">
<div class="gmail_msg">
<div class="gmail_msg">
<div class="gmail_msg">
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">Best regards,<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">Qi Zhang<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div></div>
_______________________________________________<br class="gmail_msg">
This mail is sent to you from the opencms-dev mailing list<br class="gmail_msg">
To change your list options, or to unsubscribe from the list, please visit<br class="gmail_msg">
<a href="http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev</a><br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
</blockquote></div>