private File createFileNameFromRequest(HttpServletRequest pRequest) {
        //System.out.println("ServletPath" + pRequest.getServletPath());
        String path = pRequest.getServletPath();

        // Find last '/'
        int splitIndex = path.lastIndexOf("/");

        // Split -> path + name
        String name = path.substring(splitIndex + 1);
        path = path.substring(0, splitIndex);

        // Replace special chars in name with '_'
        name = name.replace('.', '_');
        String param = parameterName.replace('.', '_');
        param = param.replace('/', '_');
        param = param.replace('\\', '_');
        param = param.replace(':', '_');

        // tempfile = realPath(path) + name + "_oparam_" + number + ".jsp"
        int count = getOparamCountFromRequest(pRequest);

        // Hmm.. Would be great, but seems like I can't serve pages from within the temp dir
        //File temp = (File) getServletContext().getAttribute("javax.servlet.context.tempdir");
        //return new File(new File(temp, path), name + "_oparam_" + count + "_" + param + ".jsp");

        return new File(new File(pageContext.getServletContext().getRealPath(path)), name + "_oparam_" + count + "_" + param + ".jsp");
    }
private File createFileNameFromRequest ( HttpServletRequest pRequest ) { String path = pRequest . getServletPath ( ) ; int splitIndex = path . lastIndexOf ( "/" ) ; String name = path . substring ( splitIndex + 1 ) ; path = path . substring ( 0 , splitIndex ) ; name = name . replace ( '.' , '_' ) ; String param = parameterName . replace ( '.' , '_' ) ; param = param . replace ( '/' , '_' ) ; param = param . replace ( '\\' , '_' ) ; param = param . replace ( ':' , '_' ) ; int count = getOparamCountFromRequest ( pRequest ) ; return new File ( new File ( pageContext . getServletContext ( ) . getRealPath ( path ) ) , name + "_oparam_" + count + "_" + param + ".jsp" ) ; }
Creates a unique filename for each (nested) oparam