Posted
Filed under C#
//IDownloadHandler 의 구현체를 만들어서  DownloadHandler 를 등록 해주면된다.
// 아래소스는 updated에서 다운로드되는 상황을 체크 할 수 있으며
// downloadItem.IsComplete 다운로드가 완료되었을 때 파일을 실행하도록 구현함
// 상황에 따라서 확장자에 맞게 처리 하면됨.

 chromebrowser.DownloadHandler = new DownloadHandler();
==========================================================
internal class DownloadHandler : IDownloadHandler
    {
        public object OnDownloadUpdatedFired { get; private set; }
        public void OnBeforeDownload(IWebBrowser chromiumWebBrowser, IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
        {
            if (!callback.IsDisposed) {
                using (callback) {
                    callback.Continue(@"C:\Users\" +
                             System.Security.Principal.WindowsIdentity.GetCurrent().Name +
                             @"\Downloads\" +
                             downloadItem.SuggestedFileName,
                         showDialog: true);
                }
            } 
            
        }
        public void OnDownloadUpdated(IWebBrowser chromiumWebBrowser, IBrowser browser, DownloadItem downloadItem, IDownloadItemCallback callback)
        {
            if (downloadItem.IsComplete)
            {
                if (@downloadItem.FullPath != "")
                {
                    Process.Start(@downloadItem.FullPath);
                }
            }
        }
    }
2020/04/13 15:18 2020/04/13 15:18
Posted
Filed under JSP, JAVA
[참고]https://jistol.github.io/java/2017/08/30/tomcat8-invalid-domain/
--------------------------
java.lang.IllegalArgumentException: An invalid domain [.xxxx.com] was specified for this cookie
과 같이 서브도메인 쿠키 생성시 아래와 같이 처리 해줘야 함.

tomcat context.xml에 다음과 같이 추가
<CookieProcessor className="org.apache.tomcat.util.http.LegacyCookieProcessor"/>

spring boot embead 일경우
@Bean
public EmbeddedServletContainerCustomizer tomcatCustomizer() {
    return container -> {
        if (container instanceof TomcatEmbeddedServletContainerFactory) {
            TomcatEmbeddedServletContainerFactory tomcat = (TomcatEmbeddedServletContainerFactory) container;
            tomcat.addContextCustomizers(context -> context.setCookieProcessor(new LegacyCookieProcessor()));
        }
    };
}

2020/04/06 10:02 2020/04/06 10:02
Posted
Filed under PHP

error_reporting(E_ALL);
ini_set("display_errors", 1);

php 상단에 위와 같이 선언
오류 출력 해줌

2019/11/06 14:44 2019/11/06 14:44
Posted
Filed under Htm&Javascript

https://jsfiddle.net/0z56f24f/2/

 var delay = 0;
    var offset = 125;
    document.addEventListener('invalid', function(e){
        $(e.target).addClass("invalid");
        $('html, body').animate({scrollTop: $($(".invalid")[0]).offset().top - offset }, delay);
    }, true);
    document.addEventListener('change', function(e){
        $(e.target).removeClass("invalid")
    }, true);

 

 

2019/08/22 00:35 2019/08/22 00:35
Posted
Filed under centos7
Edit your
/etc/yum.conf file and add
http_caching=packages

yum clean all
yum makecache
yum update

2019/07/11 17:45 2019/07/11 17:45
Posted
Filed under PHP
.htaccess 파일에 아래와 같이 막을 폴더 경로를 설정 한다.
RedirectMatch 403 ^/data/*

2019/05/16 23:41 2019/05/16 23:41
Posted
Filed under nginx
location = /robots.txt {
  add_header  Content-Type  text/plain;
  return 200 "User-agent: *\nDisallow: /\n";
}

[원문]https://alan.ivey.dev/posts/2017/robots.txt-disallow-all-with-nginx/
[참고]https://serverfault.com/questions/549332/how-to-set-robots-txt-globally-in-nginx-for-all-virtual-hosts
[참고]https://edykim.com/ko/post/overwrite-robots.txt-with-nginx-settings/
2019/04/23 18:29 2019/04/23 18:29
Posted
Filed under JSP, JAVA
[참고]https://github.com/naver/lucy-xss-servlet-filter
pom.xml 추가
<dependency>
<groupId>com.navercorp.lucy</groupId>
<artifactId>lucy-xss-servlet</artifactId>
<version>2.0.0</version>
</dependency>

 

[web.xml]
filter 순서 UTF-8 인코딩 필터가 있다면 그 다음으로
multipartFilter  추가 후 XSS filter 추가 한다.
이유) 게시판 파일 업로드  enctype="multipart/form-data"
일떄 multipartFilter 필터 타지 않을 수 있음 그래서 필터 순서를 맞춰줘야 함

<!-- multipartFilter -->
<filter>
<filter-name>multipartFilter</filter-name>
<filter-class>
org.springframework.web.multipart.support.MultipartFilter
</filter-class>
</filter>

<filter-mapping>
<filter-name>multipartFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<!-- xss filter -->
<filter>
<filter-name>xssEscapeServletFilter</filter-name>
<filter-class>com.navercorp.lucy.security.xss.servletfilter.XssEscapeServletFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>xssEscapeServletFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

[root-context.xml]에  multipartResolver   bean설정시 아이디를
multipartResolver --> filterMultipartResolver 변경 해줌
그래야 xss 필터가 정상적으로 동작

<!-- multipartResolver -->
<!--<beans:bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver" />-->
<beans:bean id="filterMultipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver" />

2019/01/30 18:55 2019/01/30 18:55
Posted
Filed under JSP, JAVA
xml설정
xmlns:task="http://www.springframework.org/schema/task"

xsi:schemaLocation 부분에 
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task-4.0.xsd

추가
<task:annotation-driven /> 추가



==================================================

1초마다 한번식 실행

@Service
public class VisitorConfig {
@Scheduled(fixedDelay = 1000)
public void visitor(){
System.out.println("test:");
}
}
2019/01/28 11:17 2019/01/28 11:17
Posted
Filed under JSP, JAVA
[원문]
http://krams915.blogspot.com/2010/12/spring-security-mvc-querying.html @Resource(name="sessionRegistry") private SessionRegistryImpl sessionRegistry; for (Object username: sessionRegistry.getAllPrincipals()) { logger.debug(username); }
2019/01/14 12:08 2019/01/14 12:08