// Path: src/main/java/com/sivalabs/jblogger/config/ApplicationProperties.java
// @ConfigurationProperties(prefix="application")
// @ConstructorBinding
// @AllArgsConstructor
// @Getter
// public class ApplicationProperties
// {
// 	private int postsPerPage;
// 	private String supportEmail;
// 	private String twitterShareUrl;
// 	private String facebookShareUrl;
// 	private String linkedinShareUrl;
// 
// }
// 
// Path: src/main/java/com/sivalabs/jblogger/domain/PostDTO.java
// @Data
// @Builder
// public class PostDTO {
//     private Long id;
//     private String title;
//     private String url;
//     private String content;
//     private String shortDescription;
//     private String createdByUserName;
//     private LocalDateTime createdOn;
//     private LocalDateTime updatedOn;
//     private Long viewCount;
//     private List<String> tags;
//     private List<CommentDTO> comments;
// 
//     private String twitterShareLink;
//     private String facebookShareLink;
//     private String linkedInShareLink;
// }


import com.sivalabs.jblogger.config.ApplicationProperties;
import com.sivalabs.jblogger.domain.PostDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
package com.sivalabs.jblogger.web;



@Component
@Slf4j
public class WebUtils
{
	private static ApplicationProperties applicationProperties;

	@Autowired
	WebUtils(ApplicationProperties config) {
		WebUtils.applicationProperties = config;
	}
	
	public static String getTwitterShareLink(PostDTO post)
	{
		return applicationProperties.getTwitterShareUrl() +encode(post.getTitle())+" "+getURLWithContextPath()+"/"+post.getUrl();
	}
	
// Path: src/main/java/com/sivalabs/jblogger/config/ApplicationProperties.java
// @ConfigurationProperties(prefix="application")
// @ConstructorBinding
// @AllArgsConstructor
// @Getter
// public class ApplicationProperties
// {
// 	private int postsPerPage;
// 	private String supportEmail;
// 	private String twitterShareUrl;
// 	private String facebookShareUrl;
// 	private String linkedinShareUrl;
// 
// }
// 
// Path: src/main/java/com/sivalabs/jblogger/domain/PostDTO.java
// @Data
// @Builder
// public class PostDTO {
//     private Long id;
//     private String title;
//     private String url;
//     private String content;
//     private String shortDescription;
//     private String createdByUserName;
//     private LocalDateTime createdOn;
//     private LocalDateTime updatedOn;
//     private Long viewCount;
//     private List<String> tags;
//     private List<CommentDTO> comments;
// 
//     private String twitterShareLink;
//     private String facebookShareLink;
//     private String linkedInShareLink;
// }


// Path: src/main/java/com/sivalabs/jblogger/web/WebUtils.java
import com.sivalabs.jblogger.config.ApplicationProperties;
import com.sivalabs.jblogger.domain.PostDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

package com.sivalabs.jblogger.web;



@Component
@Slf4j
public class WebUtils
{
	private static ApplicationProperties applicationProperties;

	@Autowired
	WebUtils(ApplicationProperties config) {
		WebUtils.applicationProperties = config;
	}
	
	public static String getTwitterShareLink(PostDTO post)
	{
		return applicationProperties.getTwitterShareUrl() +encode(post.getTitle())+" "+getURLWithContextPath()+"/"+post.getUrl();
	}
	
	public static String getFacebookShareLink(PostDTO post)