How to customize crystal_servlet_uri? - eclipse

I am having a problem with Crystal Report in JSP.
The report is viewed 1st page successfully, but I could not be viewed the next page, or export.
I've used a tool to catch the error. I realize that the error cause by invalid request.
For example my project url: http://localhost:8080/myproject, but when we navigate to next page or export report, it request to http://localhost:8080/CrystalReportViewerHandler.
It should be http://localhost:8080/myproject/CrystalReportViewerHandler.
What I have tried is put crystal_servlet_uri in web.xml:
<context-param>
<param-name>crystal_servlet_uri</param-name>
<param-value>/myproject/CrystalReportViewerHandler</param-value>
</context-param>
However, the request is not change (still http://localhost:8080/CrystalReportViewerHandler).
Does any one know another solution for this problem?
Thanks!

I experienced this exact same problem. The only solution I have found that works is to place your CrystalReportsViewer.jsp in the document root of the project. As soon as you place it anywhere under WEB-INF, the 'myproject' is dropped from subsequent calls (like next page).
However, if the JSP you use to create and process the CrystalReportViewer object is placed alongside WEB-INF (not in it), then the 'myproject' re-appears and everything works. (Or at least it did for me.)
This is maybe not the best news from a security perspective, but the requester must already have a ReportClientDocument to pass to this JSP, and that part you can control access to.

Related

Wicket reporting same FileUpload object in subsequent requests

I have a panel used in multiple pages in an app we're developing. In this panel is a FileUploadField that uses AjaxFormSubmitBehavior (extended as FileUploadBehavior) on "change" to upload a file, which I then add to a list via ajax, update the view, clear the FileUploadField, and then allow them to select another file. And this is in fact exactly what happens in one of the pages using the panel...but not in another. In the non-working page, the first file selected is repeated over and over regardless of what file is picked after the first.
In the onSubmit of the behavior, we get the the FileUpload object which is supposed to be different between requests. I can see in the debugger that the FileUpload is the exact same object as the previous request, not merely carrying the same payload.
I'm scrutinizing the usage of the panel on the two pages and see no material differences. I can see the file control on the page DOES show the changed file name while I sit at my breakpoint on the server (so I suspect whatever is going wrong is on the java side). But I can't figure out why they behave differently or see where it's going wrong. The panels and pages are large and complex, so here's snippets of the relevant pieces.
FileUploadBehavior.onSubmit(AjaxRequestTarget) :
FileUploadField fileUploadField = (FileUploadField) fileUploadContainer.get("fileUploadField");
FileUpload fileUpload = fileUploadField.getFileUpload();
[...]
//clear file input after each request for next upload.
fileUploadField.clearInput();
target.add(fileUploadField);
I have a break right after this line and can see the first file gets repeated. The code that instantiates the field and behavior in the panel looks like:
FileUploadField fileUploadField = new FileUploadField("fileUploadField");
fileUploadField.add(new FileUploadBehavior("change", maxFileSize).setDefaultProcessing(false));
fileUploadContainer.add(fileUploadField);
The html tag:
<input wicket:id="fileUploadField" class="form-control" type="file" id="formFile" multiple>
I feel like the fact that it works in one page and not in another leads me to think the problem is outside the panel. The fact that the control in the browser shows the 2nd filename during test leads me to think it's on the java side. But nothing about the file event or definition happens outside the panel itself. The form elements are declared identically, and both have multipart enctypes when the pages render. Both successfully upload their first file. I'm kind of not even sure where to look for why wicket is re-using the FileUpload object in one page but not in another.
I should mention that we use Apache Wicket 6.26.
update: I looked into the source of FileUploadField, and it has an explicit check on whether FileUploads is null in it's internal property, and if so returns it without checking the actual request. I don't see any way to clear this value between requests. clearInput() doesn't affect it from what I see. I'm more confused by how this is working in one page than why it's not in the one where it doesn't now. I also don't know how to make the class 'reset' between requests.
Okay, figured this out. As martin-g pointed out, the fileUploads is set null in onDetach(), which I discovered about an hour after my update. The problem is that the onDetach() first tries to null out the model object. But that method was blowing up because there was no method 'fileUploadField' on the model attached to the form which was a compound property model. The page that worked does NOT use a compound property model for the form. For some reason, when this error occurred, it was being swallowed somewhere in the call stack and did not end up in my console log.
My solution was to provide a local model to the fileUploadField since that's not how I'm interacting with the control anyway (I'm using ajax and getting the FileUpload directly each time). That fixed it. It now works everywhere.

Error with Orbeon Forms

We have an older application based on Orbeon forms 4.4. Out of the blue, we started having a problem where various links and buttons on certain forms are not functioning correctly. The forms impacted seem to be Orbeon's built-in Forms Builder and a few of our forms that use the Orbeon "Wizard" view...the initial page displays properly, but navigation from one section to another seems to be broken.
The only unusual thing we see in the log files is this message:
WARN XmlLibraryChecker - Looking for a valid Parser...
Checking for Xerces, found version Xerces-J 2.11.0 needed version Xerces-J 2.9.0
Warning: Failed find a valid Parser!
Please add an appropriate Parser to the class-path, e.g. in the 'endorsed' folder of the servlet container or in the 'endorsed' folder of the JRE.
In the Orbeon webapps/orbeon/WEB-INF/lib directory, we see a xerces-2.11-orbeon.jar all of the JAR files in this directory are dated November 2013 and have not been changed best we can tell. I understand this is a "Warn" message, but there doesn't seem to be any other sign of problem.
In the case of Form Builder, we go to the listing of all the current forms, and are unable to page through the list. When we click on the paging control at the bottom of the page, we see an HTTP request to "xforms-server" from "connection.js:467". The data sent on this request is:
<!DOCTYPE xxf:event-request [<!ENTITY nbsp " ">]>
<xxf:event-request xmlns:xxf="http://orbeon.org/oxf/xml/xforms">
<xxf:uuid>a3a297feb1356b5190ce1050fdc165bfadae85e3</xxf:uuid>
<xxf:sequence>2</xxf:sequence>
<xxf:action>
<xxf:event name="DOMActivate" source-control-id="xf-432"></xxf:event>
</xxf:action>
</xxf:event-request>
This seems to work (HTTP response code 200) and we seem to get a response that has the next page worth of values in a long XML format. The display at the browser is unchanged however...the list of displayed items in Form Builder doesn't move or change in any way.
The pattern in our "Wizard View" forms is similar...we see the same HTTP transaction sent to the server, get a similar XML response, but no display update occurs.
Clients are Chrome 58 and 60, plus Safari 10.1.2.
Server side is Tomcat 7 with Java 1.7.051 and MySQL as the persistence layer.

Page is not loading properly with editor.html in the url AEM6.1

My page is not loading properly with the url having "editor.html" (http://localhost:4502/editor.html/content/mypage.html). But when I remove editor.html, it loads perfectly (http://localhost:4502/content/mypage.html).
I am using AEM6.1. If I open the page in classic UI, its looks good. But when I open it in touch UI, its not loading properly.
I already have a property "sling:resourceSuperType = wcm/foundation/components/page"
Some of the content is coming on the page.
It can be a JS issue, but even if I remove all the js files from my component, the issue is still there.
Anyone experienced the same issue?
This issue might be due to the 'Apache Sling Main Servlet' default configuration.
And also we can observe the error message 'components could not be loaded' or 'out of memory' in browser console when we are in Touch UI editor Mode.
By default 'Apache Sling Main Servlet' is configured with 1000 calls per request. If we increase this limit then the issue will be resolved.
For updating this follow the steps.
1. Go to the http://<host>:<port-number>/system/console/configMgr (ex: http://localhost:4502/system/console/configMgr)
2. Ctrl + F and Search for "Apache Sling Main Servlet".
3. Change the value of 'Number of Calls per Request' from 1000 (defaulut value) to 1500 or 2000.
4. Click on Save.
5. Now you can go to Touch UI edit mode and can be able to edit the components.
Check in your CRXDE under the folder /libs/wcm/core/content and look for a folder called "editor.html" with the sibling of just "editor". If you delete the editor.html folder and keep "editor", then your page will start working again.

Netbeans project integration with different frameworks

We work as a third party with MVC traditional framework with oracle 11g (no hibernate) with login.jsp page to enter the systems
The main company took the
struts2 and spring and hibernate frameworks approach also with oracle 11g and they have thier login.jsp
When we integrated our work together the login.jsp approved the is the last one due to privileges issues (from the main company) although they are too similar but its programmed with hibernate,struts,spring.
There is one problem occurred that their login.jsp page gives an error (below)
java.lang.IllegalArgumentException: Unknown entity: com.uts.entities.appsecurity.Users
The details is too long so i stored it in jsfiddle just for viewing...
The error
Now i should mention when integration i added some extra files .xml from the main company to work with theire framework in addition to their actual work:
1)libraries
2)persistence.xml
3)struts.xml
4)validators.xml
5)applicationContext.xml
Now if i enter the login.jsp i used to use in development it works but not the main company login.jsp we are looking for a solution for this !
the deploy does not give an error and when pressing login apachetomcat output does not give an error , it just redirect to error page on http://localhost:8084/HumanResources_2/presentation/securityAction.action
The main company login
http://localhost:8084/HumanResources_2/presentation/Login.jsp
Our(my) login
http://localhost:8084/HumanResources_2/login.jsp
Another thing the login page of the main company the text appearing as undefined all of them.
i don`t know what causing this it works before integration , note that the main company using Eclipse am ready for any thing i can provide
the problem was a BUG in netbeans
look at the photo there is line i must remove to make it work the selected one
the check when true the above line added automatically am not sure why but it solved it

GWT - spring security - caching issue

I have a GWT application which is secured by Spring Security. I have a Main.html which serves the application and Login.html for login. For most part everything works fine everytime. But sometimes after restarting my application I can still access Main.html - although most of the widgets on the page are unusable. I can see the Login.html's HTML in the console being printed as exception. On refreshing, it takes me to login page. Has anyone ran into similar issue? Is this some kind of caching issue? How can this be avoided?
It seems that in your case your bootstrap file is beining cached and thus a wrong version of your app is being loaded.
You have to make sure that your bootstrap file (the one which is named nocache) is never cached. See here for more details.
You can check if your bootstrap file is cached by using Firebug and looking at the HTTP requests for your scripts. You can check two things:
If the correct <md5>.cache.html are loaded (compare it to the ones in your gwt output folder).
The response type of your .nocache. file is not 304 or so.
Adding meta tag on top of my Main.html - helped me resolve my issue for now.
Read this for more details : HTML http-equiv Attribute