How to allow log4j-2.17.2 to download configuarion via HTTP? - http

We have a similar problem to that of the asker of this question -- after upgrading from log4j-2.17.1 to 2.17.2, the application, though otherwise working, is not logging anything.
Having read the release notes, I see the following part:
By default, the only remote protocol allowed for loading configuration files is HTTPS.
Users can specify a system property to allow others or prevent remote loading entirely.
Indeed, in our case the log4j2.xml is downloaded via regular (non-encrypted) HTTP, and that likely explains our problem (as well as that of the other guy). However, try as I might, I cannot find, how to (re)enable the ability to use HTTP -- which system property is it, that now controls the capability?
Thanks!

The system property you are looking for is called log4j2.Configuration.allowedProtocols (cf. documentation) and should contained a comma separated list of URL schemes (e.g. "http,https").
You can set it using any available property source (e.g. a log4j.component.properties file or a Java system property).

Related

h5ai use on a CDN?

Is it possible to use the h5ai "pretty" index UI on a CDN? I'm using Dreamhosts' DreamObjects and have it installed correctly (I've used it before on standard hosting sites). Am only getting an XML parse of the data back.
See it here: https://randassets.objects.cdn.dream.io/
Any thoughts? Thanks!
I guess what you would like to see is a pretty-looking list of files and directories on a web page, like a file browser to explore the content of your DreamObjects bucket. If that's the case, hi5ai would not work because from what I understand, hi5ai doesn't natively speak neither the S3 API nor the OpenStack Swift ones. hi5ai relies on a web server and a php interpreter, which are not provided by DreamObjects.
Maybe if you expand on your use case I can suggest you other tools you could use to browse your collection of files, something like ownCloud (and more specifically how to configure DreamObjects with ownCloud) or others.

How to actually use JAWR with a library from a CDN

We use JAWR to serve content, but would like to also make use of a CDN to distribute scripts. For instance, to use jQuery, we have:
jawr.js.bundle.jquery.id=/bundles/jquery.js
jawr.js.bundle.jquery.mappings=/js/lib/.license,/js/lib/jquery-1.8.2.js
jawr.js.bundle.jquery.productionURL=http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js
That works great. We get the local library in debug mode, and the one from CDN in production mode. However, let’s add:
jawr.js.bundle.bootstrap.id=/bundles/bootstrap.js
jawr.js.bundle.bootstrap.mappings=/js/lib/bootstrap-2.1.0/js/.license,/js/lib/bootstrap-2.1.0/js/bootstrap.js
jawr.js.bundle.bootstrap.dependencies=jquery
Now, upon access (not upon startup) of a page using /bundles/bootstrap.js, JAWR throws a nasty exception:
java.lang.IllegalStateException: The bundleDataHashCode must be set before accessing the url prefix.
at net.jawr.web.resource.bundle.JoinableResourceBundleImpl.getURLPrefix(JoinableResourceBundleImpl.java:560)
...
at net.jawr.web.taglib.AbstractResourceBundleTag.doStartTag(AbstractResourceBundleTag.java:68)
...
Does that mean I cannot depend on a bundle with a productionURL?
There is an open issue on JAWR about this and a thread (without any answers) in the forum. The answer (from myself) for now is:
You can use productionURL, but do not depend on these bundles. All that is broken
is the dependency mechanism. Manually adding all the necessary <jawr:.../> tags works.

How to detect if ASP.NET is enabled in IIS 7

The challenge is to determine whether ASP.NET is enabled within IIS7 in a reliable and correct way.
Enabling/Disabling is done in this case by going into:
Server Manager ->
Roles ->
Web Server (IIS) ->
Remove Role Services ->
Remove ASP.NET
The natural place to determine this should be within the applicationHost.config file. However, with ASP.NET enabled or disabled, we still have the "ManagedEngine" module available, and we still have the isapi filter record in the tag.
The best I can find at the moment is to check if the <isapiCgiRestriction> tag includes the aspnet_isapi.dll, or that the ASPNET trace provider is available.
However these aren't detecting the presence of the ASP.NET config directly, just a side effect that could conceivably be reconfigured by the user.
I'd rather do this by examining the IIS configuration/setup rather than the OS itself, if possible, although enumerating the Roles & Services on the server might be acceptable if we can guarantee that this technique will always work whenever IIS7 is used.
Update
Thanks for the responses. Clarifying exactly what I want to do, I'm pulling settings from a variety of places in the server's configuration into a single (readonly) view to show what the user needs to have configured to allow the software to work.
One of the settings I need to bring in is this one:
The one highlighted in red.
I don't need to manipulate the setting, just reproduce it. I want to see whether the user checked the ASP.NET box when they added the IIS role to the server, as in this example they clearly didn't.
I'd like to do this by looking at something reliable in IIS rather than enumerating the role services because I don't want to add any platform specific dependencies on the check that I don't need. I don't know if it will ever be possible to install IIS7 on a server that doesn't have the Roles/Services infrastructure, but in preference, I'd rather not worry about it. I also have a load of libraries for scrubbing around IIS already.
However, I'm also having trouble finding out how to enumerate the Roles/Services at all, so if there's a solution that involves doing that, it would certainly be useful, and much better than checking the side effect of having the ASPNET trace provider lying around.
Unfortunately, if you don't check the ASP.NET button, you can still get the ManagedEngine module in the IIS applicationHost.config file, so it's not a reliable check. You can also have ASP.NET mapped as an isapi filter, so checking them isn't enough. These things are especially problematic in the case where ASP.NET was installed but has been removed.
It looks like the best solution would be to examine the Role Services. However, API information on this is looking pretty rare, hence the cry for help.
The absolute way to know if they checked that or not is to search the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp\Components
In there you should see two values set to 1, ASPNET and NetFxEnvironment and NetFxExtensibility. This registry key is the IIS Setup key that contains all the components that have been enabled in IIS.
Determining if asp.net is even an installed feature (prerequisite for enabling it) can be done through PowerShell, which implies there is .net api out there for it if you dig hard enough. The PowerShell methods:
Import-Module servermanager
Get-WindowsFeature web-asp-net
Which will return an object of type Microsoft.Windows.ServerManager.Commands.Feature. The installed property is boolean and indicates whether or not the feature is installed.
So do you want the easy way? Make a nice pretty .aspx page that displays as HTML with an error block in a div in a placeholder saying "You need to install ASP.NET" and have it change on ASP.NET being installed to instead say "ASP.NET is installed" and then just have the tool launch this webpage in the default browser after copying it to the directory identified in IIS as the *:80 site (or create the directory mapping in IIS programmatically by altering the XML and then removing it later)
May not be the most elegant but it does ensure that testing shows what features are truly installed versus what's in an XML file.
Because that will scream "do it the lazy ignorant way" I'll remind you that the only way for me to know in javascript what features I can use is to test them before I try to use them, or assume they're there and watch it blow up. My point is, it doesn't matter what gets reported in a file, it matters what you can actually use. Just because C:\Windows\Micrsoft.Net\Framework\v3.xxxxxxxx exists and has files doesn't mean the dll's are registered in the GAC, does it?

How does one create Channels at runtime using BlazeDS?

So as you may or may not know, BlazeDS (open source version of LiveCycle Data Services) is a nice way to get your server-side Java and client-side Flex application to play together. Unfortunately, it does have several pitfalls that need to be corrected. I'll try to explain one of them here.
All of BlazeDS's configuration is written via XML files in the flex/ folder of your webapp. The default names are separated for clarity, such as services-config.xml, remoting-config.xml, messaging-config.xml, etc. In these configuration files (particularly services-config.xml), Channels are defined; these setup URIs and objects used to capture and send information between the server and the client. In these config files, it is quite common to use a syntax like so:
<channel-definition id="my-secure-amf" class="mx.messaging.channels.SecureAMFChannel">
<endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/>
<properties>
<add-no-cache-headers>false</add-no-cache-headers>
</properties>
</channel-definition>
Unfortunately, what they don't tell you is that some of these key-in replacements (ie: {context.root}) are not replaced dynamically upon execution but upon compilation of the WAR file you intend to distribute. Obviously not a good idea when switching domains.
So, instead I seek to dynamically define these channels. According to the documentation, that's all good and fine, but it only works if the channel already exists when the webapp is launched. I feel like that sort of defeats the point.
So my question is, how do you truly create channels dynamically so that both the client and the server recognize their existence?
Read this blog post; I believe it is what you're after.
I believe these xml config files have no direct relation to the server at all. They are used to tell the SWF how to find the server.
During Compile time of your Flex App; the services-config information is, in essence, hard coded into the SWF.

Setting network options in a RCP Application

We have a RCP application that does sometimes get some data from URLs in the internet. Our customer uses a Proxy-Server, and we can't get to the information we need unless the network-settings are correct (Setting IP of Proxy and the Port-Number).
In Eclipse (the IDE), there is the Preferences->General->Network Connections Dialog to set those settings. I managed to include the Preferences Dialog( menu.add(new OpenPreferencesAction(window));, and even to get an option "Network Connections" (By adding a dependency to org.eclipse.ui.net in the plugin-settings.) But when I open the dialog, it says "The currently displayed page contains invalid values." and I can't set any values there.
the log files says: (thanks to VonC)
!ENTRY org.eclipse.jface 4 2 2009-11-09 21:51:39.798
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jface".
!STACK 0
java.lang.NoClassDefFoundError: org/eclipse/core/internal/net/ProxySelector
at org.eclipse.ui.internal.net.ProxyEntriesComposite.initializeValues(ProxyEntriesComposite.java:248)
at org.eclipse.ui.internal.net.ProxyEntriesComposite.createWidgets(ProxyEntriesComposite.java:130)
at org.eclipse.ui.internal.net.ProxyEntriesComposite.(ProxyEntriesComposite.java:57)
at org.eclipse.ui.internal.net.ProxyPreferencePage.createProxyEntriesComposite(ProxyPreferencePage.java:81)
at org.eclipse.ui.internal.net.ProxyPreferencePage.createContents(ProxyPreferencePage.java:54)
at org.eclipse.jface.preference.PreferencePage.createControl(PreferencePage.java:235)
Does someone know a way to tell an eclipse-RCP application what network settings to use, either by using the preference page, by manual coding, or by using some configuration files?
Looks like I finally got it:
How to make setting the network configuration by the preference page possible in an RCP-Application in windows 32 bit:
Put the packages org.eclipse.ui.net, org.eclipse.core.net and org.eclipse.core.net.win32.x86 into your target plattform and add dependencies to the first two of these in your Manfifest.MF
Make sure you have compatible versions (That was my mistake, I had an old version of org.eclipse.net.win32.x86). For example, get the all three files from your Galileo Eclipse IDE
In your ActionBarAdvisor class, add: menu.add(new OpenPreferencesAction(getActionBarConfigurer().getWindowConfigurer()
.getWindow()));
Putting some DLL-files somewhere on the harddrive is not nessesary!
Howto use eclipse network options in your own plug-in (tested win32):
add jars: org.eclipse.core.net and org.eclipse.ui.net
add jWinHttp-1.0.0.dll (extraced from org.eclipse.core.net.win32.x86) to a directory
that is on the windows path (e.g. c:\windows).
Maybe it is also possible to pass a system property to search the dll at a specific location.
Now you can use the net api.

Resources