I'm using Single Copy XPage Design, with all my business logic written as Java in files in WebContent\WEB-INF.
If I need to make a change to an XPage or Custom Control, I can update my template, refresh design and the change is picked up immediately.
However, if I want to make changes to the Java code, everything seems cached and the only method I've found to pick up the changes is to restart http task.
So far I've tried:
refreshing the design of the SCXD database
replacing the design of the SCXD database
cleaning the SCXD database
editing the faces-config (both in the template and the SCXD database)
deleting the .class files for the compiled Java code in the SCXD database and re-building
issuing a "tell http xsp refresh" command to the server
replacing the SCXD database with a new copy
replacing the design of the database that's pointing to the SCXD database
Nothing seems to get the web to pick up the Java code changes, other than restarting the http task.
Is there something I've missed?
We've logged this issue as SPR# LHEY9X5EBP.
I sent this question around the XPages team, and Maire Kehoe provided the following information and workaround to try.
Not a known issue. Looks like a bug in NSFComponentModule.refresh(),
when there is a templateModule, it never finds any change to files, and never resets the classLoader.
Workaround: Button to click to do the reset.
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:button value="Reset App ClassLoader" id="button1">
<xp:eventHandler event="onclick" submit="true" refreshMode="complete">
<xp:this.action><![CDATA[#{javascript:inapp.ResetUtil.reset()}]]></xp:this.action>
</xp:eventHandler>
</xp:button>
Java code:
package inapp;
import com.ibm.domino.xsp.module.nsf.ModuleClassLoader;
public class ResetUtil {
public static void reset(){
ClassLoader appClassLoader = Thread.currentThread().getContextClassLoader();
((ModuleClassLoader)appClassLoader).resetDynamicClassLoader();
// That code will give:
// Script interpreter error, line=1, col=17: Error calling method 'reset()' on java class 'inapp.ResetUtil'
// Access denied (java.lang.RuntimePermission getClassLoader)
// need to edit C:\Domino\jvm\lib\security\java.policy file to have:
// grant codeBase "xspnsf://server:0/disc2.nsf/-"{ // nsf name here must be .toLowerCase of actual nsf name.
// permission java.lang.RuntimePermission "getClassLoader";
//};
}
}
Permissions to allow that Java code to run. In C:\Domino\jvm\lib\security\java.policy add a line like so, updated to your nsf name:
grant codeBase "xspnsf://server:0/disc2.nsf/-"{ // nsf name here must be .toLowerCase of actual nsf name.
permission java.lang.RuntimePermission "getClassLoader";
};
Related
I am using MVC 5 to build an application. In my web.config I have defined a custom section which I will use to display menu to user. It is something like:
<Menus>
<Menu>
<MainMenu Title="Home"></MainMenu>
<SubMenus>
<SubMenu Title="Page1" PageName="home/index" ADGroup="BusinessUsers">
<SubMenu Title="Page2" PageName="home/index2" ADGroup="ITUsers">
</SubMenus>
</Menu>
<Menu>
<MainMenu Title="About Us"></MainMenu>
<SubMenus>
<SubMenu Title="Another Page1" PageName="about/mypage1" ADGroup="BusinessUsers">
<SubMenu Title="Some Other Page" PageName="about/mypage2" ADGroup="OtherUsers">
</SubMenus>
</Menu>
</Menus>
I am using Windows authentication and everyone will have access via AD groups. By default I have denied access to all users using authorization rule in web.config like below:
<authorization><deny users="*"/></authorization>
Is it possible to define authorization rules based on MENU above in Application_Start at runtime? Something like:
Global.Filters.AuthorizeUser("BusinessUsers", "home/index, about/mypage1");
Global.Filters.AuthorizeUser("ITUsers", "home/index2");
What you're doing here isn't a standard way of defining a menu, so there is no standard way of enforcing authorization on it. You will need to implement it yourself.
Somewhere in your code during a request, you will have to loop through each SubMenu and use HttpContext.Current.User.IsInRole("DOMAIN\\GroupName") to test whether the user is in the appropriate group. I can't give you any further direction than that without seeing more of your code.
I'm sure you have your reasons for putting this in web.config, but what I have done in my own projects is define the menu in a partial view and check the roles right in the view:
#if (HttpContext.Current.User.IsInRole("DOMAIN\\GroupName") {
Some menu item
}
If you're worried about being able to update the menu items without recompiling the whole project, then that's still fine since the cshtml files aren't compiled anyway - you can update it on the fly.
Hello trying to figure out the Jsf (primefaces) and little that goes viz. Compiled war archive in maven try to run through the Glassfish, the server starts but in the beginning writing "Artifact qwe-1.0-SNAPSHOT.war: Server is not connected. Deploy is not available." But in the late writes "Artifact qwe-1.0-SNAPSHOT.war: Artifact is being deployed, please wait... Artifact is deployed successfully." It seems like everything is normal, then opened my page in the browser is empty although in my index.xhtm and my pom.xml and web.xml link pastebin
and should be a button with styles that are connected in primefaces tell me if I'm doing something wrong?
here's a screenshot of the result in the browser. link1
<p:button outcome="productDetail" value="Bookmark" icon="ui-icon-star"> targets you to the productDetail page. If you do not have productDetail.xhtml page at the currect path, the index.xhtml page cannot resolve NavigationCase for outcome. Thus, Create page productDetail.xhtml and put into the same directory of index.xhtml.
In addition, You should use JSF Standard tags(h:head, h:body).
in this posting:
How to disable Client-side Validation for an XPage?
Sven demonstrated setting the property to disable the client side validation.
<xp:this.properties>
<xp:parameter name="xsp.client.validation" value="false" />
</xp:this.properties>
I tried this in a test XPage and it works great, I then tried it in my application and I get an error when the Submit button is clicked that my Rich Text Field is undefined. I have a custom control that contains all the input and validation and it is called from the an ext Lib Application Layout Control. I have removed most everything I can from my App Layout but when I do a submit it does the correct validation but also gives the message:
---------------------------
xpWFSDemoInput
---------------------------
An error occurred while updating some of the page.
dijit.byId("view:_id1:_id2:_id3:_id4:callback1:_id145:callback1:_id148:inputRichText1") is undefined
---------------------------
OK
---------------------------
I place my input custom control inside a new Xpage, set the parameter on the Xpage and run it and it works fine, it sees the RichText and processes it correctly. So there would appear to be something in the App Layout that is causing problems.
I will try putting the Ext Lib Applayout into an XPage and see what happens.
Some further info -- I found the problem code which is some client side script that does a periodic time check. No idea why it hates the RTF though.
If you want to disable client-side validation for the application, you can do so in the Xsp Properties in the application. You can also do it in an xsp.properties file on the server. Check out XPages Portable Command Guide for more details on this and all xsp.properties settings
I am using JSF 2.0 and Liferay 6.1
On any kind of request to any Java class my init() is getting called. Even in case of PrimeFaces component calls for its related PrimeFaces Java method. This method should be called only once when my portlet will initialize.
#ManagedBean
#ViewScoped
public class MyMangedBean {
public void init() {
System.out.println("Init method called");
}
}
Please help me to find out possible solution.
EDIT
I found the component behind this cause
In my xhtml file I have
<bridge:inputFile id="MyFileUpload" size="50"
binding="#{myBean.toBeUploadFile}" onchange="{fileSelected(this);}" style="position: absolute;height: 29px;width:107px;opacity:0;filter: alpha(opacity=0);z-index:100;"/>
Whenever I remove its binding attribute. My project works fine. It will not call init() multiple times. But I need this attribute to get my file uploaded.
I have kept xml namespace as
xmlns:bridge="http://portletfaces.org/bridge"
I have also kept dependency for commons-io(version 1.3) and commons-filedownload(1.2.1) in pom.xml
I dont know what else I am missing for this component or what is actual cause behind this.
You should consider using the bridge:inputFile tag that comes with the latest release of Liferay Faces instead of the older obsolete tags that come from portletfaces.org.
There is a nice demo here that uses the bridge:inputFile that you can try on a Liferay tomcat portal instance, and then follow the same pattern that it uses for file upload.
That demo has been tested, it works great, and it is supported by Liferay.
There are many more demos that are tested and working well on Liferay Portal 6.1. You can download the source for them and build them for yourself as shown here. And follow the version scheme here to make sure that you align the correct versions of the Portal, Mojarra, and the Liferay Faces Bridge.
Hope that helps.
I have strange problem on my simple form in JSF 2.0. In this form, I use two selects, if the first select is chosen, the second should be reload with new options. I use the same mechanism as on Primefaces demo page : Primefaces demo page. My bean is #ViewScoped. I also run my app on jetty-maven plugin by "mvn jetty:run". No problem so far. My form works well.
The problem occurs when I change something while my server is running, jetty is reloading. And after that these two selects don't work - if I choose option on the firts one, second one isnt responding. I have to clear all session by logout in Spring Security and after that my form come back to work.
When i changed my bean to #SessionScoped, problem disappeared.
Is this working proper? I dont want to have my form on session scoped, I prefer ViewScoped.
Try to check your context is postback like this on postConstruct in your bean.
#PostConstruct
public void init() {
if (!FacesContext.getCurrentInstance().isPostback()) {
//Write your code here...
}
Or try close to partial state saving on your web.xml if jsf version is 2.0, but with this method, your application may need more memory allocation
<context-param>
<param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
<param-value>false</param-value>
</context-param>
Good Luck!