How do I configure a filter in my web-app - wildfly

I have a server which is serving an index.html and bundle.js file (Server:JBoss-EAP/7, X-Powered-By:Undertow/1). I wish to turn off caching for the bundle.js file for my dev environment so that I can update it without having to clear the cache.
I understand that I do this by adding a filter to my web.xml file but I don't know what tilter-class I should be using. How can I learn more?

I think you don't need to configure filter in this case. There is the buffer cache is used to cache static resources in JBoss EAP undertow subsystem. The default size of a buffer cache is 10MB.
<subsystem xmlns="urn:jboss:domain:undertow:3.1">
<buffer-cache name="default"/>
....
</subsystem>
I think you can use this and change cache buffer size to zero like below or remove buffer-cache even though I didn't verify yet.
/subsystem=undertow/buffer-cache=default/:write-attribute(name=buffer-size,value=0)
:reload
You can refer details in the following docs:
https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.0/html/configuration_guide/configuring_the_web_server_undertow#undertow-configure-buffer-caches
https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.0/html/configuration_guide/reference_material#undertow-attribute-refs
Note that you can also refer this on clearing the browser cache.

Related

Wildfly does not update MBean session attributes (JMX)

I am accessing WildFly (22) via JMX to access one of its MBeans. It is the session information of an web application. This is generally working however I can only see one attribute changing over time which is the activeSessions attribute. All other attributes like expiredSessions, highestSessionCount, maxActiveSessions, rejectedSessions, sessionsCreated etc always remain 0.
Does anybody know the reason for this? Is some special activation for those values necessary?
Ok I found it. In order to gather statistics about HTTP sessions, you need to enable statistics on undertow subsystem. One possibility is to use the CLI as follows:
/subsystem=undertow:write-attribute(name=statistics-enabled,value=true)
or directly in the standalone.xml:
<subsystem xmlns="urn:jboss:domain:undertow:XX.0" default-server="default-server" statistics-enabled="true">

CLI to check thread count in WildFly domain mode

<subsystem xmlns="urn:jboss:domain:io:1.1">
<worker name="default" io-threads="100" task-max-threads="200"/>
<buffer-pool name="default"/>
</subsystem>
I have set IO threads like this in WildFly-8.2 domain mode. What is the exact command to view this thread count during runtime?
When you say that you added this config to wildfly domain mode, I presume that you have modified a certain profile. The cli commands in domain mode are the same as in standalone operation, they just need to be prefixed with /profile=<NAME_OF_YOUR_PROFILE>. So if you have updated the full-ha profile for example you can use the following /profile=full-ha/subsystem=io/worker=default:read-resource

414 URI too long with Apache Tomcat Eclipse

I have a long uri when i launch my query.
I use apache tomcat 7.0.42 as server. I know my request is long but i want to increase the uri's length limit to do my requests. Because i always have a
414 error : request too long.
How can i do that ?
I've already tried with maxHttpHeader in server.xml but there was no effects. It appears that : when i restart my server with eclispe, the 'maxHttpHeader' disappears ... why ?
<Connector URIEncoding="UTF-8" maxHttpHeaderSize="65536" connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
Is any files to configure or to modify to handle this error ? I really need to.
My request is to fill a dataTable.
Thank's in advanced.
i just pass my request in POST. Now it works !
when i restart my server with eclispe, the 'maxHttpHeader' disappears
Using eclipse WTP your tomcat's server config is not (only) stored in the conf folder of the tomcat installation.
Go to the Servers view and double-click on your server, under General Information you will find a Configuration path field that points to the configuration directory. Usually this is a folder in a separate eclipse project (called Servers).
After editing the server.xml there you can synchronize your server (in the Servers view) and the changes should not vanish anymore.
Edit: As for maxHttpHeader: just saw you are defining the maxHttpHeader setting for your 8080 connector and using a redirect to 8443. The setting will not take effect for https connections. Try adding the same setting to your 8443connector.

ZF 2 System configuration and config cache

I have some things that I can not understand.
It is config_cache from system configuration.
Whether or not to enable a configuration cache.
If enabled, the merged configuration will be cached and used in subsequent requests.
'config_cache_enabled' => $booleanValue
Now i cant understand on waht configuration he thoughts.
System Configuration
or
Application Configuration
What configuration will be cached? System or Application?
I believe this would be an Application Configuration. Such files like Module.php and autoload/* would all be cached. However if you have any type of Closures in these files then you will not be able to cache these files as it will return an error (due to closures).
I personally have a few closures in my configurations so I need to do:
'config_cache_enabled' => false

using old port after chaging domain.xml

I am using Glassfish V3 which comes with netbeans only , as there are few servers running on my pc , i have changed the port from 8080 to 8787 of glassfish v3 by altering domain.xml
<http-listener id="http-listener-1" port="8787" address="0.0.0.0" default-virtual-server="server" server-name="" />
<http-listener id="http-listener-2" port="8181" enabled="false" address="0.0.0.0" security-enabled="true" default-virtual-server="server" server-name="">
Now when i deploy the restful webservies over server or click on Test Restful Webservice in netbeans
i am getting a page in a browser which still uses the old port and even there is not webservice option get displayed on it the page is blank. here is the screen shot
note: i tried restarting it may times but still using the old port
In your Netbeans project node there must be a sub node like "Generated sources (rest-test)" or similar (I don't have Netbeans in english).
If you expand this node, there must be a file named test-resbeans.html. Open this file and check the following entry:
var baseURL = "http://localhost:8080/MyFirstWebService/||/resources";
The term MyFirstWebservice needs to be replaced by your services's name.
Change the port there if necessary.
There was an open issue for something similar. I fixed it a while back, but the change will be in NB 7.0. I do not think anybody will backport the change into 6.7... but you never know.