&Directorio.Source = 'C:\Tomcat7webapps\miaplicacion\WEB-INF\classes'
msg('Directorio ' + &Directorio)
if &Directorio.exists()
msg("Este directorio si EXISTE!")
else
msg("ESTE DIRECTORIO NO EXISTE !")
endif
&i = dfwopen("miweb.xml"," ",'')
&i = dfwptxt("----------------")
&i = dfwnext()
for &auxFile in &directorio.GetFiles('class')
&i = dfwptxt("<servlet>")
&i = dfwnext()
&pos = StrSearch(&auxFile.GetName(),'.class',1)
&pos = &pos - 1
&cadena = Substr(&auxFile.GetName(),1,&pos)
&cadena = "<servlet-name>" + trim(&cadena) + "</servlet-name>"
&i = dfwptxt(&cadena.Trim())
&i = dfwnext()
&cadena = Substr(&auxFile.GetName(),1,&pos)
&cadena = "<servlet-class>" + trim(&cadena ) + "</servlet-class>"
&i = dfwptxt(&cadena.Trim())
&i = dfwnext()
&i = dfwptxt("</servlet>")
&i = dfwnext()
endfor
&i = dfwptxt("----------------")
&i = dfwnext()
for &auxFile in &directorio.GetFiles('class')
&i = dfwptxt("<servlet-mapping>")
&i = dfwnext()
&pos = StrSearch(&auxFile.GetName(),'.class',1)
&pos = &pos - 1
&cadena = Substr(&auxFile.GetName(),1,&pos)
&cadena = "<servlet-name>" + trim(&cadena ) + "</servlet-name>"
&i = dfwptxt(&cadena.Trim() )
&i = dfwnext()
&cadena = Substr(&auxFile.GetName(),1,&pos)
&cadena = "<url-pattern>/servlet/" + trim(&cadena ) + "</url-pattern>"
&i = dfwptxt(&cadena.Trim() )
&i = dfwnext()
&i = dfwptxt("</servlet-mapping>")
&i = dfwnext()
endfor
&i = dfwclose()
Return
No hay comentarios:
Publicar un comentario