Redirect all HTTP traffic to HTTPS in tomcat by default

Just a quick tip, here is how you force your webapp to be served in HTTPS only. Open your web.xml file and add this security constraint <security-constraint> <web-resource-collection> <web-resource-name>MyApp</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user-data-constraint> </security-constraint> Follow me on twitter @rasensio

By Rodrigo Asensio, ago

Como adaptar el tamaño de una imagen a un JLabel

Facilmente podemos hacer resize de una imágen para un JLabel ImageIcon image = new ImageIcon("c:/image.png"); int scale = 3; int width = image.getIconWidth(); int height = image.getIconHeight(); BufferedImage buffer = new BufferedImage(scale * width, scale * height, BufferedImage.TYPE_INT_ARGB); Graphics2D graphics = buffer.createGraphics(); graphics.scale(scale,scale); image.paintIcon(null, graphics, 0, 0); graphics.dispose(); JLabel label Read more…

By Rodrigo Asensio, ago