Serve static content(Single page application) using Wildfly - wildfly

I need to serve static content outside of WAR using the Wildfly application server.
I setup
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
<filter-ref name="server-header"/>
<filter-ref name="x-powered-by-header"/>
</host>
<handlers>
<file name="welcome-content" path="c:/Users/admin/web" directory-listing="true"/>
</handlers>
Everything worked okay but I faced with the routing problem.
The application has a html5 history support.
When I go to the Url: localhost:8080 everything is okay, my app redirects to /home
But when I refresh the page it returns 404 error.
Is there a possibility to define location name as wildcard e.g. /*
or how can i solve the problem with single page application?

Related

Jboss AS 7.2 - Serve static content

Can I create a static directory in JBoss AS 7.2, like WildFly?
I know the WildFly server can be configured to serve static content by undertow subsystem. For instance:
<server name="default-server">
<http-listener name="default" socket-binding="http"/>
<host name="default-host" alias="localhost">
<location name="/mycontent" handler="content"/>
</host>
</server>
<handlers>
<file name="content" path="${jboss.home.dir}/content" directory-listing="true"/>
</handlers>
According to my requirement, user will upload the static content in the static directory.
I have found the solution.
JBoss AS 7.2 does not support to serve static content's directory as WildFly. I know, not everybody has luxury to use WildFly.
I created a war directory with extension (mycontent.war) instead of war file and created dodeployed.war file also. Inside the mycontent.war directory, I created WEB-INF directory and web.xml file. The web.xml file contains only display name tag. That is it. You can upload the static content in the directory and the contents can be served also.

How To update JSP/JS in jboss EAP -6.2 without restarting or redeploying build

I am looking for a way so that I can update My Javascript/JSP in my Jboss EAP server. I know alternative for JS. I can update directly in temp folder. But Is there any way for JSP.
Any help appreciated.
Thanks you
To update JSP pages at runtime you have to enable development-mode in web system,like as:
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">
<configuration>
<jsp-configuration development="true"/>
</configuration>

Exclude folder in my Site for Enterprise Single Sign-On

I have a site under Microsoft Enterprise Single Sign-On. In a folder located in the site I have a Web Service (WSDL) that I want to exclude from ESSO validation for consume from other application without ESSO.
Can I do it?
My site
https://example.com
To Exclude:
https://example.com/services
Finaly I found the solution.
You can especify in web.config the folder to exclude:
<location path="ExcludedFolder">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>

Decreasing log level in Eclipse WTP with Tomcat 7

I am running Tomcat 7 from within Eclipse WTP (Juno) and I cannot seem to tune down the logging level. It logs everything from debug which is too verbose to be of any use (I want it log from INFO). The logging.properties file is as follows:
handlers = java.util.logging.ConsoleHandler
.handlers = java.util.logging.ConsoleHandler
.level=INFO
############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################
java.util.logging.ConsoleHandler.level = INFO
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
Adding both of these per the FAQ that Tom Chatt cites:
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file="${workspace_loc}/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/conf/logging.properties"
to the arguments to the server's launch configuration will get you what you want.
${workspace_loc} is literal; Eclipse will substitute it with your workspace directory.
tmp0 may be tmp1 or such instead; use the same path that's in the server's configuration.
Assumes that you've placed the logging.properties file there, of course.
That way you'll see the file in the Project Explorer window under Servers.
You should start by copying the one from the Tomcat conf directory.
This all assumes that you're intent on using JULI.
Works for me with Tomcat 8.0 and Eclipse Mars.
No idea why it didn't work for Tom.
I did see ClassNotFounds, for the obvious reason, when I used the wrong class name from someone's post.
I'd advise against the approach of Tom Chatt, since that will affect all of the other uses of that JVM.
I had this same issue, wanting to configure the logging levels of Tomcat 7 in Eclipse WTP. I tried putting a logging.properties in the /src directory of my web app. No effect. I tried modifying the logging.properties file in the /conf directory of my Tomcat installation, but no effect there either. I discovered Eclipse WTP's "shadow" Tomcat area, under my workspace directory, in .metadata/.plugins/org.eclipse.wst.server.core/tmp0, and put a logging.properties file in the /conf directory under there. No effect.
I discovered a number of articles (e.g., this FAQ at eclipse.org) noting that while Tomcat in "real life" automatically runs with a logging manager called "JULI", for some reason the Tomcat running inside Eclipse WTP does not run with JULI. I tried adding
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
to the VM args in my Tomcat run config, but that just got me ClassNotFound errors. (And yes, I did have tomcat-juli.jar in my classpath, so no idea why it wasn't finding it.)
Finally, it occurred to me to try modifying the logging.properties instance in my jdk jre/lib. Jackpot! It turns out that's the one that does have an effect on the logging done by Tomcat-in-Eclipse. So, the moral of this long tale is that if all you want to do is just simply configure the logging while you're running in Eclipse, with a simple little statement like:
myapp.mypackage.level=FINE
Then $JAVAHOME/lib/logging.properties is the place to put it.
To solve this I followed the tomcat log4j guide at http://tomcat.apache.org/tomcat-7.0-doc/logging.html. This will make tomcat use log4j.
Next set up a log4j config in $CATALINA_HOME/lib.
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="null" class="org.apache.log4j.varia.NullAppender" />
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p [%c] %m%n" />
</layout>
</appender>
<category name="org.package.domain">
<priority value="INFO" />
<appender-ref ref="console" />
</category>
</log4j:configuration>

Change GWT application behavior between deployed and debug environment

I would like to have my GWT application use different constants when debugging or developing vs when deployed. What is the right way to do this? My web searches turn up a lot of pages about debugging GWT applications, which isn't what I'm looking for.
This looks like a job for deferred binding! ;)
It would look something like this (put this in your module XML file, I haven't actually tested it, but you should get the gist of it):
<define-property name="debug" values="true,false" />
<set-property name="debug" value="true" />
<replace-with class="package.Constants">
<when-type-is class="package.Constants"/>
</replace-with>
<replace-with class="package.ConstantsDebug">
<when-type-is class="package.Constants" />
<when-property-is name="debug" value="true"/>
</replace-with>
See the docs for more information on available parameters, rules and whatnot.