This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"crypto/aes" | |
"crypto/cipher" | |
"fmt" | |
) | |
func main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Resp struct { | |
status string // http status | |
response []byte // http response | |
err error // err | |
} | |
func get(u string, param map[string]string) *Resp { | |
queryValues := url.Values{} | |
for k, v := range param { | |
queryValues[k] = []string{v} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.liuxey.uitl; | |
import javax.crypto.Cipher; | |
import javax.crypto.KeyGenerator; | |
import javax.crypto.SecretKey; | |
import javax.crypto.spec.SecretKeySpec; | |
import java.io.UnsupportedEncodingException; | |
import java.net.URLDecoder; | |
import java.net.URLEncoder; | |
import java.security.MessageDigest; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 插入一条记录 | |
* | |
* @param columns | |
* @param values | |
* @return | |
*/ | |
public long insert(String[] columns, Object[] values) { | |
String sql = insertSql(columns); | |
KeyHolder keyHolder = new GeneratedKeyHolder(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.util.zip.ZipEntry; | |
import java.util.zip.ZipOutputStream; | |
/** | |
* Created by ShaoJin on 2014/4/15 0015. | |
*/ | |
public class ZipUtil { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 下载文件 | |
* @param httpClient | |
* @param url | |
*/ | |
public boolean httpGetFile(CloseableHttpClient httpClient, String url, java.io.File file) throws IOException { | |
HttpGet httpGet = createHttpGet(url); | |
httpGet.setHeader(HttpHeaders.USER_AGENT, Constant.USER_AGENT); | |
CloseableHttpResponse response = httpClient.execute(httpGet); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.servlet.http.HttpServletRequest; | |
import javax.servlet.http.HttpServletRequestWrapper; | |
import java.util.Map; | |
/** | |
* Anti XSS RequestWraper | |
* | |
* <p> | |
* | |
* Usage: write {chain.doFilter(new XssHttpServletRequestWrapper((HttpServletRequest) request), response);} |