Hi all,

I want to restrict users directly accessing the html and pdf files(as URL) from my application server. When an user requests for this content, it should ask for login credentials. Please share your ideas for this.

My application has LoginFilter and so I added <url-pattern>*.pdf</url-pattern> in the web.xml. But still the pdf and html files are accessible without logging in.

Use the SecurityManager class located in the java.lang package and set up a security policy for the files.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.