<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"MS Gothic";
        panose-1:2 11 6 9 7 2 5 8 2 4;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@MS Gothic";
        panose-1:2 11 6 9 7 2 5 8 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
span.m-7519527499398234260m4627645167713404567m-8670407722494514482gmailmsg
        {mso-style-name:m_-7519527499398234260m_4627645167713404567m_-8670407722494514482gmail_msg;}
span.m-7519527499398234260m4627645167713404567m-8670407722494514482m-8552496068675999157m457778963602854218inbox-inbox-apple-converted-spacem4627645167713404567m-8670407722494514482gmailmsg
        {mso-style-name:"m_-7519527499398234260m_4627645167713404567m_-8670407722494514482m_-8552496068675999157m_457778963602854218inbox-inbox-apple-converted-space\000D\000Am_4627645167713404567m_-8670407722494514482gmail_msg";}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="NO-BOK" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language: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.)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Try switching to a user with sufficient privileges before you switch to the Offline project.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Best regards,<br>
Paul<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif"> opencms-dev-bounces@opencms.org [mailto:opencms-dev-bounces@opencms.org]
<b>On Behalf Of </b>Qi Zhang<br>
<b>Sent:</b> 26. oktober 2016 17:29<br>
<b>To:</b> Christoph Kukulies <kuku@physik.rwth-aachen.de><br>
<b>Cc:</b> The OpenCms mailing list <opencms-dev@opencms.org><br>
<b>Subject:</b> Re: [opencms-dev] write access to file<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></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..<o:p></o:p></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()){<br>
            CmsProject offlineProject = cmso.readProject("Offline");<br>
            cmsContext.setCurrentProject(offlineProject);<br>
       }</b><o:p></o:p></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(pageContext, request, response);<br>
CmsObject cmso = cms.getCmsObject();<br>
<br>
CmsRequestContext cmsContext = cmso.getRequestContext();<br>
CmsProject curProject = cmsContext.currentProject();</span></i><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></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>>:<o:p></o:p></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:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p>Yes, it's a form and the action is a jsp.<o:p></o:p></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).<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></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.
<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></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:<o:p></o:p></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:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Hi,<o:p></o:p></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..<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></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>>:<o:p></o:p></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,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">A few questions:<o:p></o:p></p>
</div>
<p class="MsoNormal">Do you use a balancer or is the server of opencms who resolve the domain?
<o:p></o:p></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-wiki.org/wiki/MultiSite_configuration_instructions</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></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?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Regards<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><o:p> </o:p></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ó:<o:p></o:p></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,<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">thanks for the help!<o:p></o:p></p>
</div>
<p class="MsoNormal">Yes, I was coding according to the 1st documentation. But my problem is<o:p></o:p></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.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.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>online<span style="font-family:"Calibri",sans-serif">)</span><br>
NOT working!<br>
<br>
<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal">Do you have any idea why it happen?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">2016-10-25 5:35 GMT+02:00 Jose Fermin Athie Campollo <span class="m-7519527499398234260m4627645167713404567m-8670407722494514482gmailmsg">
<<a href="mailto:athiecampollo@gmail.com" target="_blank">athiecampollo@gmail.com</a>></span>:<o:p></o:p></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 <o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></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.org/wiki/Write_a_file_programatically</a> in it you could find a way to create a resource and
 then publish it <o:p></o:p></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.996256.n3.nabble.com/Create-resource-programatically-td15459.html</a> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">You should see the javadoc of<span class="m-7519527499398234260m4627645167713404567m-8670407722494514482m-8552496068675999157m457778963602854218inbox-inbox-apple-converted-spacem4627645167713404567m-8670407722494514482gmailmsg"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif"> </span></span><span class="m-7519527499398234260m4627645167713404567m-8670407722494514482gmailmsg"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif">CmsObject
</span></span><span class="m-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><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><span class="m-7519527499398234260m4627645167713404567m-8670407722494514482m-8552496068675999157m457778963602854218inbox-inbox-apple-converted-spacem4627645167713404567m-8670407722494514482gmailmsg"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif">Regards</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
</div>
</div>
<p class="MsoNormal"><br clear="all">
<o:p></o:p></p>
</blockquote>
</div>
<p class="MsoNormal"><br>
-- <o:p></o:p></p>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal">Best regards,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Qi Zhang<o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</blockquote>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
<br>
<o:p></o:p></p>
</blockquote>
</div>
</div>
</blockquote>
<p><o:p> </o:p></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> <o:p></o:p></p>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><br>
<br clear="all">
<br>
-- <o:p></o:p></p>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal">Best regards,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Qi Zhang<o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>