Codota Logo
FastJson.getJson
Code IndexAdd Codota to your IDE (free)

How to use
getJson
method
in
com.jfinal.json.FastJson

Best Java code snippets using com.jfinal.json.FastJson.getJson (Showing top 3 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Point p =
  • Codota Iconnew Point(x, y)
  • Codota Iconnew Point()
  • Codota IconMouseEvent e;e.getPoint()
  • Smart code suggestions by Codota
}
origin: yangfuhai/jboot

public String createJwtToken(Map map) {
  SecretKey secretKey = generalKey();
  SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256;
  long nowMillis = System.currentTimeMillis();
  Date now = new Date(nowMillis);
  map.put("isuuedAt", nowMillis);
  String subject = FastJson.getJson().toJson(map);
  JwtBuilder builder = Jwts.builder()
      .setIssuedAt(now)
      .setSubject(subject)
      .signWith(signatureAlgorithm, secretKey);
  if (jwtConfig.getValidityPeriod() > 0) {
    long expMillis = nowMillis + jwtConfig.getValidityPeriod();
    builder.setExpiration(new Date(expMillis));
  }
  return builder.compact();
}
origin: com.jfinal/jfinal-weixin

/**
 * 将 json字符串 转为Object
 * @param jsonString json字符串
 * @param valueType 结果类型
 * @param <T> 泛型标记
 * @return T 结果
 */
public static <T> T parse(String jsonString, Class<T> valueType) {
  if (jsonFactory == null) {
    // return Json.getJson().parse(jsonString, valueType);
      
      Json json = Json.getJson();
      // JFinalJson 不支持 parse
      if (json instanceof com.jfinal.json.JFinalJson) {
        return FastJson.getJson().parse(jsonString, valueType);
      } else {
        return json.parse(jsonString, valueType);
      }
  }
  return jsonFactory.getJson().parse(jsonString, valueType);
}
origin: yangfuhai/jboot

public Map parseJwtToken(String token) {
  SecretKey secretKey = generalKey();
  try {
    Claims claims = Jwts.parser()
        .setSigningKey(secretKey)
        .parseClaimsJws(token).getBody();
    String subject = claims.getSubject();
    if (StrUtils.isBlank(subject)) {
      return null;
    }
    return FastJson.getJson().parse(subject, HashMap.class);
  } catch (SignatureException | MalformedJwtException e) {
    // don't trust the JWT!
    // jwt 签名错误或解析错误,可能是伪造的,不能相信
  } catch (ExpiredJwtException e) {
    // jwt 已经过期
  } catch (Throwable ex) {
    //其他错误
  }
  return null;
}
com.jfinal.jsonFastJsongetJson

Popular methods of FastJson

  • parse
  • <init>
  • getDefaultDatePattern
  • toJson

Popular in Java

  • Finding current android device location
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • notifyDataSetChanged (ArrayAdapter)
  • FileInputStream (java.io)
    A FileInputStream obtains input bytes from a file in a file system. What files are available depends
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • Logger (org.slf4j)
    The main user interface to logging. It is expected that logging takes place through concrete impleme
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now