All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.jackpanz.spring.beetl.PageUtils Maven / Gradle / Ivy

The newest version!
package com.github.jackpanz.spring.beetl;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.jackpanz.spring.util.HTMLUtil;
import org.springframework.beans.factory.annotation.Autowired;

public class PageUtils {

    @Autowired
    ObjectMapper objectMapper;

    public String toJson(Object obj) {
        try {
            return objectMapper.writeValueAsString(obj);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
            return null;
        }
    }

    public String encodeURI(String str) {
        return HTMLUtil.encodeURIComponent(str);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy