Set System Properties In Jboss

Firstly create a Dynamic Web Project (File->New->Dynamic Web Project) named "JBossTutorial" according to following screenshot

Set Properties in JBoss Set System Properties In Jboss

Here I am creating a filter and reading the uploaded folder from properties file as we set before. Here we are using JBoss 6.2, so we are adding properties file in standalone.xml

package com.test.filter;


import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;

@WebFilter("/*")
public class PropertiesFilter implements Filter {

   
@Override
   
public void destroy() {

    }

   
@Override
   
public void doFilter(ServletRequest request, ServletResponse response,
            FilterChain chain
) throws IOException, ServletException {
       
PrintWriter out = response.getWriter();
        out.write
(System.getProperty("upload.dir"));
   
}

   
@Override
   
public void init(FilterConfig fConfig) throws ServletException {

    }

}

Publishing JBoss Project

Run JBoss

Output

JBoss Output









Previous 1 2





Your email address will not be published. Required fields are marked *