<div dir="ltr"><div><div><div><div>Hi Paul,<br><br></div>I tried:<br>CmsObject cmso = cms.getCmsObject();<br>cmso.loginUser("myUserName","myPassword");<br><br></div>It still: works fine in offline&online project, but got HTTP500 error in actual webpage..(without adding the switching context code yet) :(<br></div><br><br></div><div>But thanks a lot for help<br></div><div><div><div><div><br></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-10-26 17:42 GMT+02:00 Paul-Inge Flakstad <span dir="ltr"><<a href="mailto:flakstad@npolar.no" target="_blank">flakstad@npolar.no</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div link="blue" vlink="purple" lang="NO-BOK">
<div class="m_7271210721060220901WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d" lang="EN-US">Hi,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d" lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d" lang="EN-US">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></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d" lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d" lang="EN-US">Try switching to a user with sufficient privileges before you switch to the Offline project.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d" lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d" lang="EN-US">Best regards,<br>
Paul<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d" lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US"> <a href="mailto:opencms-dev-bounces@opencms.org" target="_blank">opencms-dev-bounces@opencms.<wbr>org</a> [mailto:<a href="mailto:opencms-dev-bounces@opencms.org" target="_blank">opencms-dev-bounces@<wbr>opencms.org</a>]
<b>On Behalf Of </b>Qi Zhang<br>
<b>Sent:</b> 26. oktober 2016 17:29<br>
<b>To:</b> Christoph Kukulies <<a href="mailto:kuku@physik.rwth-aachen.de" target="_blank">kuku@physik.rwth-aachen.de</a>><br>
<b>Cc:</b> The OpenCms mailing list <<a href="mailto:opencms-dev@opencms.org" target="_blank">opencms-dev@opencms.org</a>><br>
<b>Subject:</b> Re: [opencms-dev] write access to file<u></u><u></u></span></p><div><div class="h5">
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Other pages are all fine. Just this one after clicking submit button..<u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">I have checked,as long as I have these lines of code. I have the error:<br>
<br>
<b>if(curProject.isOnlineProject(<wbr>)){<br>
CmsProject offlineProject = cmso.readProject("Offline");<br>
cmsContext.setCurrentProject(<wbr>offlineProject);<br>
}</b><u></u><u></u></p>
</div>
<p class="MsoNormal">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>
<br>
Here are some related code:<br>
<i><span style="color:#666666">CmsJspActionElement cms = new CmsJspActionElement(<wbr>pageContext, request, response);<br>
CmsObject cmso = cms.getCmsObject();<br>
<br>
CmsRequestContext cmsContext = cmso.getRequestContext();<br>
CmsProject curProject = cmsContext.currentProject();</span></i><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">2016-10-26 14:26 GMT+02:00 Christoph Kukulies <<a href="mailto:kuku@physik.rwth-aachen.de" target="_blank">kuku@physik.rwth-aachen.de</a>>:<u></u><u></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">
<div>
<div>
<p class="MsoNormal">Am 26.10.2016 um 13:09 schrieb Qi Zhang:<u></u><u></u></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p>Yes, it's a form and the action is a jsp.<u></u><u></u></p>
</blockquote>
<p class="MsoNormal">Permissions of the jsp? <br>
<br>
Do other pages work in <a href="http://www.123.com" 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>
You gotta gather more information. <br>
<br>
Can you invoke the jsp alone in the browser (possibly passing the neccessary parameters to it).<u></u><u></u></p>
<div>
<div>
<p class="MsoNormal"><br>
<br>
<u></u><u></u></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p>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></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On 26 Oct 2016 10:16, "Christoph Kukulies" <<a href="mailto:kuku@physik.rwth-aachen.de" target="_blank">kuku@physik.rwth-aachen.de</a>> wrote:<u></u><u></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">
<div>
<div>
<p class="MsoNormal">what does the log say (opencms.log, tomcat logs)?<br>
You say, it's a form, right? Is the action a jsp that is invoked?<br>
<br>
Am 25.10.2016 um 20:50 schrieb Qi Zhang:<u></u><u></u></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Hi,<u></u><u></u></p>
</div>
<p class="MsoNormal">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></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">2016-10-25 19:55 GMT+02:00 Jose Fermin Athie Campollo <<a href="mailto:athiecampollo@gmail.com" target="_blank">athiecampollo@gmail.com</a>>:<u></u><u></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">
<div>
<div>
<p class="MsoNormal">Hi,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">A few questions:<u></u><u></u></p>
</div>
<p class="MsoNormal">Do you use a balancer or is the server of opencms who resolve the domain?
<u></u><u></u></p>
<div>
<p class="MsoNormal">If it is from opencms you have to set the new domain <a href="http://www.opencms-wiki.org/wiki/MultiSite_configuration_instructions" target="_blank">http://www.opencms-<wbr>wiki.org/wiki/MultiSite_<wbr>configuration_instructions</a><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">In <a href="http://www.123.com" target="_blank">www.123.com</a> is the only page they can not see?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Regards<u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">El mar., 25 de oct. de 2016 a la(s) 11:53, Qi Zhang <<a href="mailto:kksjtu@gmail.com" target="_blank">kksjtu@gmail.com</a>> escribió:<u></u><u></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">
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Hi,<u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">thanks for the help!<u></u><u></u></p>
</div>
<p class="MsoNormal">Yes, I was coding according to the 1st documentation. But my problem is<u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
<br>
<a href="http://opencms.123.com/index.html" target="_blank">http://opencms.123.com/index.<wbr>html</a><span style="font-family:"Calibri",sans-serif">(</span>offline<span style="font-family:"Calibri",sans-serif">)</span><br>
works!<br>
<a href="http://opencms.123.com/index.html" target="_blank">http://opencms.123.com/index.<wbr>html</a><span style="font-family:"Calibri",sans-serif">(</span>online<span style="font-family:"Calibri",sans-serif">)</span><br>
works!<br>
<a href="http://www.123.com/index.html" target="_blank">http://www.123.com/index.html</a><span style="font-family:"Calibri",sans-serif">(</span><wbr>online<span style="font-family:"Calibri",sans-serif">)</span><br>
NOT working!<br>
<br>
<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal">Do you have any idea why it happen?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">2016-10-25 5:35 GMT+02:00 Jose Fermin Athie Campollo <span class="m_7271210721060220901m-7519527499398234260m4627645167713404567m-8670407722494514482gmailmsg">
<<a href="mailto:athiecampollo@gmail.com" target="_blank">athiecampollo@gmail.com</a>></span>:<u></u><u></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">
<div>
<p class="MsoNormal">Hi <u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Right now i can't see this page. <a href="http://www.opencms-wiki.org/wiki/Write_a_file_programatically" target="_blank">http://www.opencms-wiki.<wbr>org/wiki/Write_a_file_<wbr>programatically</a> in it you could find a way to create a resource and
then publish it <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Some one else publish the code to create a resource <a href="http://opencms.996256.n3.nabble.com/Create-resource-programatically-td15459.html" target="_blank">http://opencms.<wbr>996256.n3.nabble.com/Create-<wbr>resource-programatically-<wbr>td15459.html</a> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">You should see the javadoc of<span class="m_7271210721060220901m-7519527499398234260m4627645167713404567m-8670407722494514482m-8552496068675999157m457778963602854218inbox-inbox-apple-converted-spacem4627645167713404567m-8670407722494514482gmailmsg"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif"> </span></span><span class="m_7271210721060220901m-7519527499398234260m4627645167713404567m-8670407722494514482gmailmsg"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif">CmsObject
</span></span><span class="m_7271210721060220901m-7519527499398234260m4627645167713404567m-8670407722494514482m-8552496068675999157m457778963602854218inbox-inbox-apple-converted-spacem4627645167713404567m-8670407722494514482gmailmsg"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif"> you
can do a lot of thing with it. </span></span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><span class="m_7271210721060220901m-7519527499398234260m4627645167713404567m-8670407722494514482m-8552496068675999157m457778963602854218inbox-inbox-apple-converted-spacem4627645167713404567m-8670407722494514482gmailmsg"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif">Regards</span></span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
</div>
</div>
<p class="MsoNormal"><br clear="all">
<u></u><u></u></p>
</blockquote>
</div>
<p class="MsoNormal"><br>
-- <u></u><u></u></p>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal">Best regards,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Qi Zhang<u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</blockquote>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
<br>
<u></u><u></u></p>
</blockquote>
</div>
</div>
</blockquote>
<p><u></u> <u></u></p>
</div>
</div>
<div>
<p class="MsoNormal">-- <br>
Chris Christoph P. U. Kukulies kukulies (at) <a href="http://rwth-aachen.de" target="_blank">
rwth-aachen.de</a> <u></u><u></u></p>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><br>
<br clear="all">
<br>
-- <u></u><u></u></p>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal">Best regards,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Qi Zhang<u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div></div></div>
</div>
<br>______________________________<wbr>_________________<br>
This mail is sent to you from the opencms-dev mailing list<br>
To change your list options, or to unsubscribe from the list, please visit<br>
<a href="http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev" rel="noreferrer" target="_blank">http://lists.opencms.org/cgi-<wbr>bin/mailman/listinfo/opencms-<wbr>dev</a><br>
<br>
<br>
<br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div>Best regards,<br></div><div dir="ltr">Qi Zhang<br></div></div></div></div></div></div></div></div>
</div>