کدهای خود را به اشتراک بگذارید

vata2999
nginx centos
ایجاد شده 3 هفته پیش
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
yum groupinstall "Development Tools"

$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz
$ tar -zxf pcre-8.41.tar.gz
$ cd pcre-8.41
$ ./configure
$ make
$ sudo make install

$ wget http://zlib.net/zlib-1.2.11.tar.gz
$ tar -zxf zlib-1.2.11.tar.gz
vata2999
Hibernate Event Listener
ایجاد شده 1 ماه پیش
1
2
3
4
5
6
7
8
9
import javax.annotation.PostConstruct;
import javax.persistence.EntityManagerFactory;

import org.apache.commons.lang.ArrayUtils;
import org.hibernate.event.service.spi.EventListenerRegistry;
import org.hibernate.event.spi.EventType;
import org.hibernate.event.spi.PreInsertEvent;
import org.hibernate.event.spi.PreInsertEventListener;
import org.hibernate.event.spi.PreUpdateEvent;
vata2999
ThreadLocal TenantContext
ایجاد شده 1 ماه پیش
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
public class TenantContext
{

    private static final Logger logger = Logger.getLogger(TenantContext.class.getName());

    private static ThreadLocal<String> currentTenant = new ThreadLocal<>();

    public static void setCurrentTenant(String tenant)
    {
        logger.info("Setting tenant to " + tenant);
        currentTenant.set(tenant);
vata2999
Api integration test
ایجاد شده 1 ماه پیش
1
2
3
4
5
6
7
8
9
import javax.sql.DataSource;

import org.json.JSONException;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.TestConfiguration;
vata2999
Webservice Security soaphandler
ایجاد شده 4 ماه پیش
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.handler.Handler;
import javax.xml.ws.handler.HandlerResolver;
import javax.xml.ws.handler.MessageContext;
import javax.xml.ws.handler.PortInfo;
import javax.xml.ws.handler.soap.SOAPHandler;
import javax.xml.ws.handler.soap.SOAPMessageContext;

import org.apache.wss4j.dom.WSConstants;
import org.apache.wss4j.dom.message.WSSecHeader;
vata2999
Webservice passwordcallback handler
ایجاد شده 4 ماه پیش
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
import java.io.IOException;

import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;

import org.apache.wss4j.common.ext.WSPasswordCallback;

public class PasswordCallbackHandler implements CallbackHandler
{
    public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException
vata2999
Spring boot interceptor
ایجاد شده 5 ماه پیش
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
@Component
public class MediaListener implements PostInsertEventListener
{

    @Autowired
    private EntityManagerFactory entityManagerFactory;

    @PostConstruct
    private void init()
    {
        SessionFactoryImpl sessionFactory = entityManagerFactory.unwrap(SessionFactoryImpl.class);
vata2999
Java Self Reference Enum
ایجاد شده 5 ماه پیش
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
public enum DayRange
    {
        ONEDAY, TWODAY, THREEMOREDAY;

        private DayRange next;

        static
        {
            ONEDAY.next = DayRange.TWODAY;
            TWODAY.next = THREEMOREDAY;
            THREEMOREDAY.next = ONEDAY;
vata2999
Spring BasicAuthenticationFilter RequestWrapper
ایجاد شده 8 ماه پیش
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
import java.io.UnsupportedEncodingException;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;

import org.apache.commons.codec.binary.Base64;
import org.springframework.util.StringUtils;
vata2999
SoapParser
ایجاد شده 8 ماه پیش
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
import java.io.ByteArrayInputStream;
import java.io.IOException;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.MimeHeaders;
import javax.xml.soap.SOAPConstants;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
لطفا منتظر بمانید