How to access application resource file outside war file in struts2 application - struts2

Currently i am doing a project so that i need to access application resource file
outside from my war file.
So i that application resource file can be kept anywhere in my system and i can access it.

Resource bundle is searched in the following order:
ActionClass.properties
Interface.properties
BaseClass.properties
ModelDriven’s model
package.properties
Search up the i18n message key hierarchy itself
Global resource properties

Go to following link, which shows way to load resource bundle for languages.
http://theswarmintelligence.blogspot.com/2012/08/use-resource-bundle-messages-files-out.html

Related

Unrecognized property 'CommType' in connection string using Advantage Data Provider with Entity Framework

I'm trying to set CommType in connection string for Advantage DataBase Server using Entity Framework 5 and Advantage Data Provider in a .NET Web Application.
Connection string is in properties.config file.
I trie to use ads.ini but I don't know where to put it (I try in wwwroot/site/bin but nothing happened)
I need to set this parameters:
RETRY_ADS_CONNECTS = 5
PACKET_SIZE=512
USE_TCP_IP = 1
I can do this whiteout errors, but not using properties.config file.
AdsConnection conn = new AdsConnection("data source=\\\\SERVER1\\DATA; ServerType=remote;TableType=CDX;CommType = TCP_IP");
Any clue about how to solve this? Using ADS.INI or properties.config file, same for me.
Thank you!
Gaston Brave.
You can use the ADS.INI file for this purpose. Where it needs to be located (or how to tell Advantage where to find it) depends on the OS you're using.
From the Advantage Help file topic ADS.INI:
Windows
In order for the ads.ini file to be used, it must be located in the application directory, the Windows directory, the Windows System directory, or the client's search path.
In addition, if an environment variable exists with the name adsini_path, that path will be used to locate the ads.ini file. This can be helpful when you do not want to modify the application’s search path, but still need the ads.ini file to exist in a directory multiple users have rights to (for example on Windows Vista installations). An application can often set the environment variable at run-time before calling any Advantage functions, which avoids the need to set a per-workstation environment variable.
Linux
In order for the ads.ini file to be used, it must be located in the application directory, a directory specified in an environment variable named ADSPATH, in the users home directory, or in the /etc directory. If located in the users home directory the ads.ini file should be named .ads.ini (note the initial "dot").

Weird exception when using IISLocal (works on IISExpression) with ASP.NET MVC

I'm developing an ASP.NET MVC 5 application that use KendoUI . If I run the project under IIS Express everything works fine... if I use IIS Local I got the following exception when I try to load a view
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
Additional information: Invalid file name for file monitoring: 'C:\svn\Projects\xxx\trunk\xxx\Views\Shared\EditorTemplates'. Common reasons for failure include:
- The filename is not a valid Win32 file name.
- The filename is not an absolute path.
- The filename contains wildcard characters.
- The file specified is a directory.
- Access denied.
I've just searched on google and someone suggest to disable under Debug->Exception the throw exception checkbox but if I do so I wouldn't get the view displayed since the output is just javascript...
Anyone has found a solution to this problem?
Thanks
Some things you could try:
Directory Access
Check to ensure your 'C:\svn\Projects\xxx\trunk\xxx\Views\Shared\EditorTemplates' directory is available to the application.
First, determine what user account the IIS application pool assigned to the application.
Open Internet Information Services (IIS) Manager.
Expand the server name.
Expand Sites.
Click the node with the site in question.
Click the Basic Settings... link in the right pane.
Note the name of the application pool in the top right box, and click Cancel.
Click the Application Pools node in the left pane.
Find the application pool with the name from step 6, and check the value in the Identity field.
Now, the Identity could either be a built-in account (such as NetworkService, LocalSystem, LocalService, or ApplicationPoolIdentity), or it could be a local or domain user (if you are using Active Directory).
If it is a local or domain user, you just need to open the 'C:\svn\Projects\xxx\trunk\xxx\Views\Shared\EditorTemplates' directory in Windows Explorer, right-click on it, and choose Properties. Click the Security tab, and make sure the user is in the list. If not, click Edit..., then click Add..., and add the user to the list. Ensure it has enough permission to read the directory.
If using a built-in user, you could either switch it to a local user, or see this answer for the command to add permissions to the built-in account.
templateName Parameter
One thing in particular to check is the templateName parameter of #Html.Editor() or #Html.EditorFor() in all of your views (or anywhere else you may happen to be calling it). This parameter should correspond with one of the formats here.
The most common usage is to specify just the name of the template. For example, if you specify MyTemplate for this field, it will search several directories for the file (see the above document), ending up with ~/Views/Shared/EditorTemplates/MyTemplate.<extension>, where extension will be .cshtml, .vbhtml, .aspx, or .ascx. This is the directory in your error message, so you should check these references thoroughly.
Even if you are not specifying the parameter explicitly, MVC uses a convention that the file name matches your view model name.
File Format
This is a long shot, since your application is running under IIS Express it shouldn't be the case. But you could try searching to see if there is any code in your application specifying a file in the 'C:\svn\Projects\xxx\trunk\xxx\Views\Shared\EditorTemplates' directory.
If so, make sure that the file name
Doesn't contain invalid Windows filename characters.
Is an absolute path, or is calling Environment.MapPath or Server.MapPath to resolve to an absolute path.
Doesn't contain a ? or a *.
Doesn't have a directory specified where a file name should be.
Clear your Temporary ASP.NET Files
I found a potential answer here.
You could attempt to clear your ASP.NET temporary files pertaining to the current application. Note that there are a few different places where they can be lurking depending on your framework version and bitness.
<Drive>:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
<Drive>:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
<Drive>:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files
<Drive>:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files
If you have the project open in Visual Studio, it will not let you delete the relevant files. Ultimately, you should close Visual Studio before deleting the files, but I found that leaving it open on the first attempt is a good way to determine which of the folders contains the application in question because you will get a message that the files are locked. Knowing that location can be useful if you have additional problems.

Public folder permission in Rails project

In my Rails project, I noticed that when I put some files into my public folder, such as .html, .pdf, .jpg, they can be opened via a browser. But when I put other files, such as .txt or files with no file type, permission is denied.
Forbidden
You don't have permission to access /blog/public/test.txt on this server.
Where is this permission controlled?
Actually, it's interesting that the file robots.txt, which came automatically when the Rails project was set up, can be accessed! But test.txt, which I created, cannot be accessed.
Try restart the server and see if it works. It usually works in rails 3 like breeze, but you might be on an older version of rails.
I guess it is the asset pipeline which allows the html, css and js files only...

test a webworks blackberry app

I have four files (config.xml, index.html, scripts.js, and styles.css). The html has a canvas and a form for users input. I want to run on blackberry simulator (Torch version 6...). I create a zip file of all those files. Then create a bin folder. Now when I run the simulator and load the application, I have either blanc screen, either the following error: Resource does not exist.
Here is the config file code:
BlackberryTest
I had the same problem. You need to use local:/// prefix before the name of the local resource to access it.

Orbeon separate deployment

I followed http://wiki.orbeon.com/forms/doc/developer-guide/xforms-with-java-applications and successfully got separate deployments working.
I would like to create my own resources folder which will have some configuration files like properties-local.xml and custom XBL controls. I got this working by copying my resources under orbeon.war/WEB-INF/resources. I would like them to go under myapp.war/WEB-INF/resources. How can I achieve that?
How can I configure a resource manager to pickup my resources which are under myapp.war/WEB-INF/resources without modifying orbeon?
I have seen this http://wiki.orbeon.com/forms/doc/developer-guide/admin/overriding-adding-resources but not sure how this applies in the context of separate deployments.
Orbeon has a series of resource managers, able to load resources from:
classloader -> resources can be packaged in JAR files
webapp -> resources can be put e.g. under WEB-INF/resources
filesystem -> resources can be put anywhere on disk
What you want to do here it seems is having one WAR file access resources stored in another WAR file. I don't think that this is possible with the current resource managers, unless you setup the filesystem, in which case you need to specify an absolute path to the location of the resources on disk.
In theory, I think it should be possible to enhance the webapp resource manager to access other servlet contexts. So you could tell the Orbeon webapp to load resources from your own webapp.
BTW this would still mean that you would need to update the Orbeon WAR's web.xml to configure the resource manager.

Resources