我常用的eclipse十个技巧

1、自动生成getter和setter、toString、重载父类方法、根据成员生成构造方法, Alt+shift+S 弹出的菜单,选择相应的菜单项,剩下的你懂的 2、格式化 重排Import 在文件中 或者选择多个文件,多个package 执行 Ctrl+shift+o 格式化代码 选中代码 Ctrl+shift+F 3、重构名 选中一个单词,Ctrl+Shift+R 重命名 选中一条语句,Ctrl+Shift+L 赋值给一个新变量 选中一段代码,Ctrl+Shift+M 重构出一个方法 选中一个文件,按住左键拖动鼠标,可以移动到任何包下。 4、查看拓扑图 选中类名, Ctrl+T 查看继承关系 选中一个方法名 Ctrl+T 查看该方法的继承关系 5、移动代码 选中代码 按住Alt配合上下方向键,可以整体移动代码 6、切换编辑 不选中状态,按住Alt配合左右方向键,可以在之前不同的文件不同编辑处之间切换 7、复制全路径 选中一个类名、一个方法名或者一个文件 点右键 选中 Copy Qulified name 可以复制全路径 8、提示补全 一个是手动补全: Alt+/ 一个是自动补全: window-Preferences-java-Editor-ContentAssist里 在 Auto activation triggers for java里输入任意字母,假设为.abc 表示当你输入.,a,b,c任意一个的时候,就会弹出补全提示。 9、注释、大小写 选中代码 Ctrl+/ 注释掉 选中单词 Ctrl+Shift+X 变大写 Ctrl+Shift+Y 变小写 10、查询 Ctrl+Shift+T 查类型 Ctrl+Shift+S 查文件 Ctrl+H 全文检索 选中方法名 点右键 选open call hierarchy 查询哪里被调用 按住ctrl键,点击变量名,类名,方法名,跳转到他们的声明处。

2014年5月19日 · 1 分钟

TOMCAT配置HTTPS和SSL并HTTP请求强转为HTTPS请求【绝对有效】

1、生成keystore文件 keytool -v -genkey -alias tomcat -keyalg RSA -keystore /home/test/my.keystore 在生成keystore的过程中,要输入一些站点信息和密码,并要求再次核对密码 2、编辑tomcat/conf/server.xml 找到对应的connector,取消注释,并且写入keystore文件路径和密码 <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" keystoreFile="/home/test/my.keystore" keystorePass="123456"/> 3、强制HTTP转HTTPS 对工程的web.xml进行修改,加入: <security-constraint> <web-resource-collection> <web-resource-name>OPENSSL</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user-data-constraint> </security-constraint> 4、禁用不安全的http方法 在tomcat/conf/web.xml最后加上一个节点 <security-constraint> <web-resource-collection> <url-pattern>/*</url-pattern> <http-method>PUT</http-method> <http-method>DELETE</http-method> <http-method>HEAD</http-method> <http-method>OPTIONS</http-method> <http-method>TRACE</http-method> </web-resource-collection> <auth-constraint></auth-constraint> </security-constraint>

2014年1月8日 · 1 分钟