I use the folder on the disk to store user pictures (tmp / usr1 /) (tmp / usr2 /) I can not find the settings for WildFly, which will open this folder for use.

In the Base I store the link to the image, but the file by the stored link can be opened as file:///... Tell file:///... how to set up the server via joss-web.xml or standalone.xml or other display methods via JSF

I am writing a learning project - I just understand Java EE

    1 answer 1

    Add a location / images, which is displayed on / tmp
    Accordingly, the url of the pictures will be of this type http: // server: port / images / usr1 / image1.png

    Added the <location name="/images" handler="images-content"/> and the corresponding handler <file name="images-content" path="/tmp"/> standalone.xml

      <subsystem xmlns="urn:jboss:domain:undertow:2.0"> <buffer-cache name="default"/> <server name="default-server"> <http-listener name="default" socket-binding="http" redirect-socket="https"/> <host name="default-host" alias="localhost"> <location name="/" handler="welcome-content"/> <location name="/images" handler="images-content"/> <filter-ref name="server-header"/> <filter-ref name="x-powered-by-header"/> </host> </server> <servlet-container name="default"> <jsp-config/> <websockets/> </servlet-container> <handlers> <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/> <file name="images-content" path="/tmp"/> </handlers> <filters> <response-header name="server-header" header-name="Server" header-value="WildFly/9"/> <response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/> </filters> </subsystem> 

    Important. Such pictures will be available to all. Those. usr1 can spy on usr2 pictures and vice versa.
    If you need to hide from each other, then you need a completely different solution - Servlet.

    • Sergey Educational project - social network but through a servlet, apparently correct ... Can I link to an example? - Eugene
    • Such a servlet is not difficult to do. Just like copying a file. This topic has also been raised many times, at least in the Aglitsky steakoverflow. There are some sketches you can find. - Sergey
    • @Eugene will more correctly use the rights assigned to users - Vadim
    • Thanks gentlemen, I did it. Thanks to the tips - Eugene