[opencms-dev] write access to file

Qi Zhang kksjtu at gmail.com
Wed Oct 26 19:07:27 CEST 2016


ahh sorry, it works fine for loging. Just not work when combining with
switching context code..

2016-10-26 19:02 GMT+02:00 Qi Zhang <kksjtu at gmail.com>:

> Hi Paul,
>
> I tried:
> CmsObject cmso = cms.getCmsObject();
> cmso.loginUser("myUserName","myPassword");
>
> It still: works fine in offline&online project, but got HTTP500 error in
> actual webpage..(without adding the switching context code yet) :(
>
>
> But thanks a lot for help
>
>
> 2016-10-26 17:42 GMT+02:00 Paul-Inge Flakstad <flakstad at npolar.no>:
>
>> Hi,
>>
>>
>>
>> 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.)
>>
>>
>>
>> Try switching to a user with sufficient privileges before you switch to
>> the Offline project.
>>
>>
>>
>> Best regards,
>> Paul
>>
>>
>>
>> *From:* opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at op
>> encms.org] *On Behalf Of *Qi Zhang
>> *Sent:* 26. oktober 2016 17:29
>> *To:* Christoph Kukulies <kuku at physik.rwth-aachen.de>
>> *Cc:* The OpenCms mailing list <opencms-dev at opencms.org>
>> *Subject:* Re: [opencms-dev] write access to file
>>
>>
>>
>> Other pages are all fine. Just this one after clicking submit button..
>>
>> I have checked,as long as I have these lines of code. I have the error:
>>
>>
>>
>>
>> *if(curProject.isOnlineProject()){             CmsProject offlineProject
>> = cmso.readProject("Offline");
>> cmsContext.setCurrentProject(offlineProject);        }*
>>
>> 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?
>>
>> Here are some related code:
>>
>>
>>
>>
>> *CmsJspActionElement cms = new CmsJspActionElement(pageContext, request,
>> response); CmsObject cmso = cms.getCmsObject(); CmsRequestContext
>> cmsContext = cmso.getRequestContext(); CmsProject curProject =
>> cmsContext.currentProject();*
>>
>>
>>
>> 2016-10-26 14:26 GMT+02:00 Christoph Kukulies <kuku at physik.rwth-aachen.de
>> >:
>>
>> Am 26.10.2016 um 13:09 schrieb Qi Zhang:
>>
>> Yes, it's a form and the action is a jsp.
>>
>> Permissions of the jsp?
>>
>> Do other pages work in www.123.com? Error 500 is "Internal Server Error"
>> which indicates a syntax error in jsp sometimes. It's not just a page not
>> found (404).
>> You gotta gather more information.
>>
>> Can you invoke the jsp alone in the browser (possibly passing the
>> neccessary parameters to it).
>>
>>
>>
>> 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.
>>
>>
>>
>> On 26 Oct 2016 10:16, "Christoph Kukulies" <kuku at physik.rwth-aachen.de>
>> wrote:
>>
>> what does the log say (opencms.log, tomcat logs)?
>> You say, it's a form, right? Is the action a jsp that is invoked?
>>
>> Am 25.10.2016 um 20:50 schrieb Qi Zhang:
>>
>> Hi,
>>
>> 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..
>>
>>
>>
>> 2016-10-25 19:55 GMT+02:00 Jose Fermin Athie Campollo <
>> athiecampollo at gmail.com>:
>>
>> Hi,
>>
>> A few questions:
>>
>> Do you use a balancer or is the server of opencms who resolve the domain?
>>
>> If it is from opencms you have to set the new domain
>> http://www.opencms-wiki.org/wiki/MultiSite_configuration_instructions
>>
>>
>>
>> In www.123.com is the only page they can not see?
>>
>>
>>
>> Regards
>>
>>
>>
>> El mar., 25 de oct. de 2016 a la(s) 11:53, Qi Zhang <kksjtu at gmail.com>
>> escribió:
>>
>> Hi,
>>
>> thanks for the help!
>>
>> Yes, I was coding according to the 1st documentation. But my problem is
>>
>>
>>
>> http://opencms.123.com/index.html(offline)
>> works!
>> http://opencms.123.com/index.html(online)
>> works!
>> http://www.123.com/index.html(online)
>> NOT working!
>>
>> Do you have any idea why it happen?
>>
>>
>>
>> 2016-10-25 5:35 GMT+02:00 Jose Fermin Athie Campollo <
>> athiecampollo at gmail.com>:
>>
>> Hi
>>
>>
>>
>> Right now i can't see this page. http://www.opencms-wiki.
>> org/wiki/Write_a_file_programatically in it you could find a way to
>> create a resource and then publish it
>>
>> Some one else publish the code to create a resource http://opencms.996256
>> .n3.nabble.com/Create-resource-programatically-td15459.html
>>
>>
>>
>> You should see the javadoc of CmsObject  you can do a lot of thing with
>> it.
>>
>>
>>
>> Regards
>>
>>
>>
>>
>>
>> --
>>
>> Best regards,
>>
>> Qi Zhang
>>
>>
>>
>>
>>
>>
>>
>> --
>> Chris Christoph P. U. Kukulies kukulies (at) rwth-aachen.de
>>
>>
>>
>>
>> --
>>
>> Best regards,
>>
>> Qi Zhang
>>
>> _______________________________________________
>> This mail is sent to you from the opencms-dev mailing list
>> To change your list options, or to unsubscribe from the list, please visit
>> http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
>>
>>
>>
>>
>>
>
>
> --
> Best regards,
> Qi Zhang
>



-- 
Best regards,
Qi Zhang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20161026/57abcb89/attachment.htm>


More information about the opencms-dev mailing list