JSF 2.x Serverside File selection dialog - jsf-2

With a JSF application, is it possible to show a file selection dialog to the user to select a config file from a specific folder on the server?
Under consideration is a scenario where an application needs to allow the user to select a file to use for a workflow or other process.
I have seen examples of client side File choosers, but haven't come across anything on selecting a file on the server. Is it restricted due to security considerations? Is there a way this could be done?
JSF 2.x
My focus is on ICEFaces at the moment, but would be keen to know if this is doable with any JSF framework.

Related

Secure ASP.NET Core 6 application back-end code

Is it possible to generate a DLL only from the *.cs files of the project and then remove them and deliver the DLL + rest of the files including the .cshtml files (views) for the client to have autonomy to edit the front? What kind of changes would I need to make to the project, would I need to keep 1 separate full version to be able to generate this DLL and a second project where I would have the DLL + views .cshtml? Do I need to reference this DLL somewhere? Would it be in the *.csproj file?
I recently decided to study ASP.NET Core 6 and ended up creating a very simple system that has several functions such as login, logout, user registration, customer registration, company registration, product registration, all of this is working perfectly, I used the scaffold of aspnet code generator + Entity Framework to generate Create, Delete, Details, Edit, Index and Migrations pages from Models (code first), I tested it with Sqlite initially and then with SqlServer, the system is OK, I can compile it in debug and release/publish, I can put it in production and send it to the client and it runs there without problems, this would be the default scenario where I would sell the solution without it having access to any source code (I won't go into details like reverse engineering , security, protection, etc..., as it is not the purpose of this question), what I need is for me to be able to edit the project for him so that he can edit only the *.cshtml files by modifying the i information from the front as I see fit and generate a new executable for the project, when he needs changes to the backend I would do it for him and charge for upgrades or not charge depending on the type of change.
It sounds like you are looking to deploy your application with Razor Runtime Compilation Enabled.
If you enable this, the .cshtml files that are deployed would be compiled at runtime, meaning that you could manipulate them on the fly without a visual studio recompile.
This is not enabled by default, so you will need to do a few things. First you will need to install the NuGet package for this
Install-Package Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation
Then you will need to add a call to AddRazorRuntimeCompilation() in your builder when you add either MVC or Razor Pages to your project.
For Razor Pages it would be similar to the following
builder.Services.AddRazorPages()
.AddRazorRuntimeCompilation();
You cannot do this if you are using Blazor

How to debug MVC web app with rest api controller backend? [duplicate]

In VS 2012, I am attempting to create an MVC 4 web application with jQuery calls to a Web API project. (Other devs will be consuming the API with our current, native app, and probably adding to the API in the future.) So I have one project that is the Web API, and another project that is the MVC 4 website. I can only set one of them to run, and they use localhost:xxxxx.
How do I debug changes to both? For example, let's say I add a new API path /api/customer/get and then a new jQuery ajax call to that path and do something with the resulting JSON. I've changed code in both projects and want to follow it end-to-end; how do I launch both? How do I debug both?
Just to be clear, the MVC app isn't making server-side calls to the API, I'm using MVC mostly to be able to easily use bundling, minification, and (hopefully) pre-compiled Handlebars templates in .NET; the API calls are coming from jQuery. As I am still relatively new to these technologies, alternate suggestions are welcome.
Thank you in advance.
I had the same problem and have found a solution from here:
forums.asp.net
The fix is to do the following:
In your solution file, click properties go to the Startup project node (if it is not already selected)
Next select Multiple startup projects. Select your website and your webservice and in the Action column make sure both of them have "Start" selected.
Now when you debug your website and put a break point in your webservice, it should hit the break point.
Coming late to the party but in case anyone else is looking for a solution, this is what was best for me: Set the Api project up to be the starting project (I needed to limit to one startup so that I could flip between browsers more easily). After firing up the service project, right click on the web/ui project and select debug, start new instance. You'll have both running and you'll seamlessly step from web to api.
I had a similar problem with my web api project. My solution consisted of an angular front end with 2 web api projects on the backend. One web api project handled "authorization" and the other handled "resources". I used the following tutorial by Taiseer Joudeh as a starting point:
http://bitoftech.net/2014/09/24/decouple-owin-authorization-server-resource-server-oauth-2-0-web-api/
Breakpoints worked on the "authorization server"... but not on the "resource server". I compared the packages from the two projects to see what was different. Once I added "Microsoft.AspNet.WebApi.Cors" to the "resource server" project, the breakpoints starting working.

Asp.net MVC - Open local files

Tricky one.
Browser Security says "No".
Scenario:
Forms and Templates are used throughout the business, this can be word, excel or pdfs files.
We have a intranet system and I would like to offer users the ability to open files via this way. (not download).
However the browser has other ideas (which I understand why), however is their a work around?
to achieve this?

Using Form-Builder-Generated-Form with Java Application

I tried the approach of using Form-Builder-Generated-Form within Java application suggested here < Running Orbeon-Form-Builder-Generated-Form with Java Application > : downloaded Orbeon nightly build, created a sample form using Form Builder and copy & pasted it into JSP page in my app. However, when I try to access this JSP, it redirects me to: /myapp/fr/unauthorized . Can you please tell me what I maybe doing wrong? Or what is the right way of making Orbeon process Form Builder generated content in Java app?
For my deployment I followed separate deployment and configuration specified in Orbeon documentation. Thanks in advance.
You are not doing anything wrong, but Orbeon Forms doesn't support this type of form deployment.
The separate deployment mode runs the output of your JSP directly through the XForms engine.
Form Builder-generated forms OTOH expect pre-processing via the Form Runner runtime, in particular through the components.xsl XSLT transform. This is needed to support all the Form Runner features, including built-in persistence, error summary, internationalization, etc.
Currently the cleanest way to integrate such forms with your own app is to just run them side by side (Orbeon WAR + your own WAR) and navigate between each other via links and POSTs.
You could also use an iframe, although that is often a disliked solution.
You could also transform the form produced by Form Builder into plain XForms that doesn't assume Form Runner. It wouldn't be too hard to do but would be outside the scope of this StackOverflow question.

JSF Integration with other JSF application

Currently we have 3 .war files built using JSF1.x I am going to create one more .war file using JSF 2.x There are some requirements to integrate with other .war files. All these war files are deployed separately meaning not in a .ear file.
Some of the integration scenarios are:
Existing .war1 will call the new application by clicking a link. The new application should prepopulate (Edit mode) its page and after submitting and processing the business logic it should show .war1 page
Existing .war2 will call the new application by clicking a link. The new application should just open a page (New mode). After submitting and processing the business logic it should take back to .war2 page
New application will call .war3 page by clicking a button. It will also send some data and after submitting from .war3 page, control should come back to the new application page. In this scenario there are more possiblities to exchange large amount of data.
Basically I am looking for the best way to integrate and pass bulk data between JSF 1.x and JSF 2.X application
If cookies can be used to pass the data that is the easiest approach. Otherwise, you can have a server side cache such as EHCache and send a cacheId with the inter-app requests to point to where the data is cached.

Resources