• 关于

    HTTP_VIA

    的搜索结果

回答

function isMobile(){// 如果有查看HTTP_X_WAP_PROFILE中的全部文章则一定是移动设备 if(isset ($_SERVER['HTTP_X_WAP_PROFILE'])) { returntrue; } // 如果via信息含有wap则一定是移动设备,部分服务商会屏蔽该信息 if(isset ($_SERVER['HTTP_VIA'])) { // 找不到为flase,否则为true returnstristr($_SERVER['HTTP_VIA'], "wap") ? true : false; } // 脑残法,判断手机发送的客户端标志,兼容性有待提高 if(isset ($_SERVER['HTTP_USER_AGENT'])) { $clientkeywords= array('nokia', 'sony', 'ericsson', 'mot', 'samsung', 'htc', 'sgh', 'lg', 'sharp', 'sie-', 'philips', 'panasonic', 'alcatel', 'lenovo', 'iphone', 'ipod', 'blackberry', 'meizu', 'android', 'netfront', 'symbian', 'ucweb', 'windowsce', 'palm', 'operamini', 'operamobi', 'openwave', 'nexusone', 'cldc', 'midp', 'wap', 'mobile' ); // 从HTTP_USER_AGENT中查找手机浏览器的关键字 if(preg_match("/(". implode('|', $clientkeywords) . ")/i", strtolower($_SERVER['HTTP_USER_AGENT']))) { returntrue; } } // 协议法,因为有可能不准确,放到最后判断 if(isset ($_SERVER['HTTP_ACCEPT'])) { // 如果只支持wml并且不支持html那一定是移动设备 // 如果支持wml和html但是wml在html之前则是移动设备 if((strpos($_SERVER['HTTP_ACCEPT'], 'vnd.wap.wml') !== false) && (strpos($_SERVER['HTTP_ACCEPT'], 'text/html') === false || (strpos($_SERVER['HTTP_ACCEPT'], 'vnd.wap.wml') < strpos($_SERVER['HTTP_ACCEPT'], 'text/html')))) { returntrue; } } returnfalse;}
我的中国 2019-12-02 01:33:23 0 浏览量 回答数 0

问题

关于tomcat+Nginx https配置问题

最近,由于项目要实现登录和注册页面使用https方式访问,其他页面用http方式访问,环境就是tomcat+nginx,于是了解关于nginx的相关配置,1.配置tomcat增加支持SSL;2.配置nginx反向代理(但存在问题)],主要问...
落地花开啦 2019-12-01 19:30:20 1979 浏览量 回答数 1

回答

HTTP请求中,会带上客户端IP的。PHP代码: 第一种: //php获取ip的算法 $iipp=$_SERVER["REMOTE_ADDR"]; echo $iipp; 第二种: //php获取ip的算法 $user_IP = ($_SERVER["HTTP_VIA"]) ? $_SERVER["HTTP_X_FORWARDED_FOR"] : $_SERVER["REMOTE_ADDR"]; $user_IP = ($user_IP) ? $user_IP : $_SERVER["REMOTE_ADDR"]; echo $user_IP;
落地花开啦 2019-12-02 02:43:45 0 浏览量 回答数 0

问题

相关tomcat+nginx登录页https访问证书问题

使用OpenSSL工具生成自签名证书后在本机Tomcat配置,发布程序访问https,浏览器提示证书错误,将附件中的boot.cer根证书安装到本机再次访问,浏览器正常,但使用其他机器访问,浏览器报证书错误,求解决方法。具体证书生成请参考页...
落地花开啦 2019-12-01 19:31:54 1137 浏览量 回答数 1

问题

nginx+tomcat 数字无法提交的问题

碰到一个很诡异的问题,表单若干数据,但是value=“数字”的数据无法提交到服务器。服务器nginx+tomcat 代理给tomcat处理诡异的是什么呢, 比如hidden为1无法提交、改为1.0就可以了有时候name=xxx.bbb v...
落地花开啦 2019-12-01 19:25:38 1101 浏览量 回答数 1

问题

squid 不能hit:报错

@皮总 你好,想跟你请教个问题: @皮总 你好,想跟你请教个问题: squid 3.5.4版本,没有命中hit,日志中总是...
kun坤 2020-06-14 13:40:13 0 浏览量 回答数 1

问题

Nginx配置及Rewrite规则

Nginx Rewrite 规则相关指令 相关指令有if,rewrite,set,return,break等,其中最关键的就是rewrite.一个简单的Nginx Rewrite规则语法如下:rewrite ^/...
thisisdong 2019-12-01 21:14:25 38367 浏览量 回答数 5

回答

我们的浏览器自己不会使用代理,除非你指定 一般代理会在HTTP头都加上x-remote-addr,服务器可以根据这个来检测 ###### I mean,如果我在浏览器上没有指定代理,在整个请求发送的过程中会不会有中间代理? 例如,如果我在浏览器输入google,正常情况下经过层层路由转到google的服务器,其中是一个什么样的机制让它被拒绝然后返回了由于政策原因无法访问此网站呢? ######代理是我们指定的,你要说中间可能有代理的话那大概就是经过了CDN google地址被DNS污染了###### 代理分好多种,一种是你的浏览器直接指定。 还有一种,是在你的路由网关上,强制进行web代理,对浏览器是透明的。一般有危险的是这种,譬如你手机wifi连上一个上网的网关,这个网关就可以对你的http请求数据做各种监视、替换等等。(除非启用https协议,中间网关就无法侵入了) 另外,所有你访问目标站点经过的路由器,都可以进行类似的http内容过滤和替换。 ######回复 @阿采 : 你自己架一个wifi服务器,通过这个wifi上网的所有人就是以你的服务器为网关了,所以不要连接不明信息的wifi。 另外,还有黑客这个角色,他可能会攻破并掌控这些你说的网关。######那是表示中间人攻击必须劫持网关,或者某些公网里的路由器?这种不是一般都是核心网的基础设施么,安全性如何?######我也是来学习下的###### 分很多种情况,普通访问、透明代理、匿名代理、高度匿名代理,有几个http头不一样,达到的效果不一样。以下是直接拷贝的,你参考下,基本也就这几种情况,想做坏事的话,最好选择高级匿名代理。但是实际上,只要是别人的代理服务器,管理员都可以获取到你的所有进出信息,所以不要传输代理一些私人数据,不然被拦截的可能性很大。 获取用户IP地址的三个属性的区别(HTTP_X_FORWARDED_FOR,HTTP_VIA,REMOTE_ADDR) 一、没有使用代理服务器的情况:       REMOTE_ADDR = 您的 IP       HTTP_VIA = 没数值或不显示       HTTP_X_FORWARDED_FOR = 没数值或不显示 二、使用透明代理服务器的情况:Transparent Proxies       REMOTE_ADDR = 最后一个代理服务器 IP        HTTP_VIA = 代理服务器 IP       HTTP_X_FORWARDED_FOR = 您的真实 IP ,经过多个代理服务器时,这个值类似如下:203.98.182.163, 203.98.182.163, 203.129.72.215。    这类代理服务器还是将您的信息转发给您的访问对象,无法达到隐藏真实身份的目的。 三、使用普通匿名代理服务器的情况:Anonymous Proxies       REMOTE_ADDR = 最后一个代理服务器 IP        HTTP_VIA = 代理服务器 IP       HTTP_X_FORWARDED_FOR = 代理服务器 IP ,经过多个代理服务器时,这个值类似如下:203.98.182.163, 203.98.182.163, 203.129.72.215。    隐藏了您的真实IP,但是向访问对象透露了您是使用代理服务器访问他们的。 四、使用欺骗性代理服务器的情况:Distorting Proxies       REMOTE_ADDR = 代理服务器 IP        HTTP_VIA = 代理服务器 IP        HTTP_X_FORWARDED_FOR = 随机的 IP ,经过多个代理服务器时,这个值类似如下:203.98.182.163, 203.98.182.163, 203.129.72.215。    告诉了访问对象您使用了代理服务器,但编造了一个虚假的随机IP代替您的真实IP欺骗它。 五、使用高匿名代理服务器的情况:High Anonymity Proxies (Elite proxies)       REMOTE_ADDR = 代理服务器 IP       HTTP_VIA = 没数值或不显示       HTTP_X_FORWARDED_FOR = 没数值或不显示 ,经过多个代理服务器时,这个值类似如下:203.98.182.163, 203.98.182.163, 203.129.72.215。    完全用代理服务器的信息替代了您的所有信息,就象您就是完全使用那台代理服务器直接访问对象。 ######谢谢您的回复,不过您这说的是如何使用代理,我想了解的是中间人劫持里的代理到底在具体网络中是怎么运作的?
kun坤 2020-05-31 13:05:50 0 浏览量 回答数 0

问题

请求alipay.trade.app.pay时302错误?

var alipaySdk = new AlipaySdk(...)后 alisdk.exec('alipay.trade.app.pay', ...) 发生了302错误,返回详情: ...
首席奥术师 2020-04-12 02:32:59 335 浏览量 回答数 1

问题

[必现]特定文件特定设备中上传OSS必定失败

环境 海思3599A,物联网卡定向流量,使用C语言SDK liboss_c_sdk.so.3.0.0 libcurl.so.4.7.0 问题说明 上传一张图片 [2020-11-18 11:55:50.92...
1647141405909324 2020-11-30 11:43:04 9 浏览量 回答数 0

问题

ubuntu下安装 hexo失败

执行 sudo npm install hexo -g时 报错贴上报错 npm WARN This failure might be due to the use of legacy binary "node" npm WARN For ...
杨冬芳 2019-12-01 20:26:07 1949 浏览量 回答数 1

问题

通过Nginx请求到api服务器(Golang)失败并返回404错误

I'm setting up nginx in docker environment. When I try to access to api server via nginx port, request returns 404 e...
刘刚_ 2020-05-23 21:07:06 170 浏览量 回答数 1

问题

linux下让apache2.2.9支持中文URL路径(mod_encoding) :报错

多的不说了,就是在linux下通过apache访问中文(据测试,日文也可以)的url路径的模块.日本人开发的,用不用随你. 我的环境:centos5,httpd 2.2.9 测试通过. Url:http://webdav.todo.g...
kun坤 2020-06-14 07:59:24 0 浏览量 回答数 1

问题

linux下让apache2.2.9支持中文URL路径(mod_encoding)-linux报错

" 多的不说了,就是在linux下通过apache访问中文(据测试,日文也可以)的url路径的模块.日本人开发的,用不用随你. 我的环境:centos5,httpd 2.2.9 测试通过. Url:http://web...
montos 2020-06-03 13:07:58 4 浏览量 回答数 1

问题

修改了php.ini各种重启依旧无效:配置报错 

nginx, 再web页面输出phpinfo()如下所示,但是修改了php.ini后无论是重启nginx还是php-fpm配置文件都无效,希望大家帮帮忙 ubuntu系统,下图是我的配...
kun坤 2020-06-04 10:23:30 4 浏览量 回答数 1

问题

idea maven多模块 tomcat启动报错?报错

公司项目, 使用的maven搭建的多module, 把bean,service,dao.... 打包成jar, 引入项目里面 启动tomcat 报错,  报错信息显示的是 , 找不到 bean.xml   这是什么问题?  什么原因导...
爱吃鱼的程序员 2020-06-08 15:19:51 0 浏览量 回答数 1

回答

<?php function get_title($url){ $str = file_get_contents($url); if(strlen($str)>0){ $str = trim(preg_replace('/\s+/', ' ', $str)); // supports line breaks inside <title> preg_match("/\<title\>(.*)\<\/title\>/i",$str,$title); // ignore case return $title[1]; } } //Example: echo get_title("http://www.baidu.com/"); ?> 请参考:http://stackoverflow.com/questions/4348912/get-title-of-website-via-link 以上php例子,运行结果如下图:
dongshan8 2019-12-02 01:35:16 0 浏览量 回答数 0

问题

现金红包alipay.fund.trans.app.pay调用问题

沙箱环境和真实环境问题一致.net和java版本SDK问题现象以下是基于JAVA沙箱环境代码请求时候均为302条转导致catch,并没有实际返回.调用其他API都可以返回,比如没权限之类的最起码不是302重定向.跟踪步骤发现302跳转无法正...
米子丁 2019-12-01 21:49:52 1717 浏览量 回答数 4

问题

Hadoop-2.7.1运行wordcount报错(mapreduce已经执行完?报错

如题,Hadoop-2.7.1运行wordcount报错(mapreduce已经执行完成并结果正确) bash: [wukong@bd01 mapreduce]$ hadoop jar h...
爱吃鱼的程序员 2020-06-12 15:27:04 0 浏览量 回答数 1

问题

Linux Apache支持中文图片、文件名的访问终极解决

1、下载安装包 :安装包 ftp://ftp.aconus.com/fc5/mod_encoding/mod_encoding-2.2.0-1.i386.tar.gz 源码包 ftp://ftp.aconus.com/fc5...
wujian8150 2019-12-01 20:06:06 8409 浏览量 回答数 4

回答

Reftp客户端连接不上ftp服务器? 端口21是打开的。 ------------ netstat -na命令,输出如下: login as: root root@182.92.197.238's password: Last login: Thu Dec 10 14:10:08 2015 from 111.113.22.138 Welcome to aliyun Elastic Compute Service! [root@iZ25p3ad0ffZ ~]# netstat -na Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address               Foreign Address             Stat                                                                                        e tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LIST                                                                                        EN tcp        0      0 0.0.0.0:21                  0.0.0.0:*                   LIST                                                                                        EN tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LIST                                                                                        EN tcp        0      0 0.0.0.0:8888                0.0.0.0:*                   LIST                                                                                        EN tcp        0      0 127.0.0.1:8005              0.0.0.0:*                   LIST                                                                                        EN ………… [root@iZ25p3ad0ffZ ~]#   ------------------------- 回 2楼龙吟风的帖子 服务器内是可以登录的。 ------------------- [root@iZ25p3ad0ffZ ~]# lftp gzh:gzh1208@localhost lftp gzh@localhost:~> ------------------------- 回 4楼龙吟风的帖子 1、端口21,已经是打开的,提问帖子里就已经列出来的。 vsftpd服务也已经启动。 2、都说要看vsftpd配置文件啥的,请问要配置啥? 我只是创建一个用户访问ftp服务器而已,还需要配置什么? ---------------- 完整的配置文件如下: # Example config file /etc/vsftpd/vsftpd.conf # # The default compiled in settings are fairly paranoid. This sample file # loosens things up a bit, to make the ftp daemon more usable. # Please see vsftpd.conf.5 for all compiled in defaults. # # READ THIS: This example file is NOT an exhaustive list of vsftpd options. # Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's # capabilities. # # Allow anonymous FTP? (Beware - allowed by default if you comment this out). anonymous_enable=NO # # Uncomment this to allow local users to log in. local_enable=YES # # Uncomment this to enable any form of FTP write command. write_enable=YES # # Default umask for local users is 077. You may wish to change this to 022, # if your users expect that (022 is used by most other ftpd's) local_umask=022 # # Uncomment this to allow the anonymous FTP user to upload files. This only # has an effect if the above global write enable is activated. Also, you will # obviously need to create a directory writable by the FTP user. anon_upload_enable=NO # # Uncomment this if you want the anonymous FTP user to be able to create # new directories. anon_mkdir_write_enable=NO # # Activate directory messages - messages given to remote users when they # go into a certain directory. dirmessage_enable=YES # # Activate logging of uploads/downloads. xferlog_enable=YES # # Make sure PORT transfer connections originate from port 20 (ftp-data). connect_from_port_20=YES # # If you want, you can arrange for uploaded anonymous files to be owned by # a different user. Note! Using "root" for uploaded files is not # recommended! #chown_uploads=YES #chown_username=whoever # # You may override where the log file goes if you like. The default is shown # below. xferlog_file=/var/log/vsftpd.log # # If you want, you can have your log file in standard ftpd xferlog format. # Note that the default log file location is /var/log/xferlog in this case. #xferlog_std_format=YES # # You may change the default value for timing out an idle session. #idle_session_timeout=600 # # You may change the default value for timing out a data connection. #data_connection_timeout=120 # # It is recommended that you define on your system a unique user which the # ftp server can use as a totally isolated and unprivileged user. #nopriv_user=ftpsecure # # Enable this and the server will recognise asynchronous ABOR requests. Not # recommended for security (the code is non-trivial). Not enabling it, # however, may confuse older FTP clients. #async_abor_enable=YES # # By default the server will pretend to allow ASCII mode but in fact ignore # the request. Turn on the below options to have the server actually do ASCII # mangling on files when in ASCII mode. # Beware that on some FTP servers, ASCII support allows a denial of service # attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd # predicted this attack and has always been safe, reporting the size of the # raw file. # ASCII mangling is a horrible feature of the protocol. ascii_upload_enable=YES ascii_download_enable=YES # # You may fully customise the login banner string: #ftpd_banner=Welcome to blah FTP service. # # You may specify a file of disallowed anonymous e-mail addresses. Apparently # useful for combatting certain DoS attacks. #deny_email_enable=YES # (default follows) #banned_email_file=/etc/vsftpd/banned_emails # # You may specify an explicit list of local users to chroot() to their home # directory. If chroot_local_user is YES, then this list becomes a list of # users to NOT chroot(). # (Warning! chroot'ing can be very dan gerous. If using chroot, make sure that # the user does not have write access to the top level directory within the # chroot) #chroot_local_user=YES #chroot_list_enable=YES # (default follows) #chroot_list_file=/etc/vsftpd/chroot_list # # You may activate the "-R" option to the builtin ls. This is disabled by # default to avoid remote users being able to cause excessive I/O on large # sites. However, some broken FTP clients such as "ncftp" and "mirror" assume # the presence of the "-R" option, so there is a strong case for enabling it. #ls_recurse_enable=YES # # When "listen" directive is enabled, vsftpd runs in standalone mode and # listens on IPv4 sockets. This directive cannot be used in conjunction # with the listen_ipv6 directive. listen=YES # # This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6 # sockets, you must run two copies of vsftpd with two configuration files. # Make sure, that one of the listen options is commented !! #listen_ipv6=YES pam_service_name=vsftpd userlist_enable=YES tcp_wrappers=YES convert_charset_enable=1 local_charset=UTF8 remote_charset=WIN1251 double_377=0 #pasv_addr_rules=/etc/vsftpd/vsftpd.pasv_rules anti_bruteforce=1 anti_bruteforce_banner=Bruteforce detected. Server in safe mode. http_enable=no ftp_enable=yes http_browse=no http_browse_tpl=/etc/vsftpd/vsftpd-browse.html http_browse_line_tpl=/etc/vsftpd/vsftpd-browse_line.html http_error_403_server_tpl=/etc/vsftpd/vsftpd-403-serv.html http_error_403_tpl=/etc/vsftpd/vsftpd-403.html http_error_404_tpl=/etc/vsftpd/vsftpd-404.html one_process_model=no
内向 2019-12-02 01:09:29 0 浏览量 回答数 0

问题

在Debian 8 系统里为 postfix 配置外部smtp服务器发邮件

有不少 网友 在使用阿里云ECS实例时,发现无法发出邮件,因为新近创建的ECS实例默认禁止连接外网TCP 25端口,避免滥发邮件。 环境:Debian 8,postf...
dongshan8 2019-12-01 21:01:26 3645 浏览量 回答数 1

回答

1、Vim打开Nginx配置文件?1vim /usr/local/nginx/conf/nginx.conf2、找到如下一段,进行修改gzip on;gzip_min_length 1k;gzip_buffers 4 16k;gzip_http_version 1.0;gzip_comp_level 2;gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;gzip_vary off;gzip_disable "MSIE [1-6].";3、解释一下第1行:开启Gzip第2行:不压缩临界值,大于1K的才压缩,一般不用改第3行:buffer,就是,嗯,算了不解释了,不用改第4行:用了反向代理的话,末端通信是HTTP/1.0,有需求的应该也不用看我这科普文了;有这句的话注释了就行了,默认是HTTP/1.1第5行:压缩级别,1-10,数字越大压缩的越好,时间也越长,看心情随便改吧第6行:进行压缩的文件类型,缺啥补啥就行了,JavaScript有两种写法,最好都写上吧,总有人抱怨js文件没有压缩,其实多写一种格式就行了第7行:跟Squid等缓存服务有关,on的话会在Header里增加"Vary: Accept-Encoding",我不需要这玩意,自己对照情况看着办吧第8行:IE6对Gzip不怎么友好,不给它Gzip了这里再讲一下gzip_proxied的相关配置参数:?123syntax: gzip_proxied off |expired | no-cache |no-store | private |no_last_modified | no_etag |auth | any ...;default: gzip_proxied off;Nginx作为反向代理的时候启用,开启或者关闭后端服务器返回的结果,匹配的前提是后端服务器必须要返回包含"Via"的 header头。off关闭所有的代理结果数据的压缩expired启用压缩,如果header头中包含 "Expires" 头信息no-cache启用压缩,如果header头中包含 "Cache-Control:no-cache" 头信息no-store启用压缩,如果header头中包含 "Cache-Control:no-store" 头信息private启用压缩,如果header头中包含 "Cache-Control:private" 头信息no_last_modified启用压缩,如果header头中不包含 "Last-Modified" 头信息no_etag启用压缩 ,如果header头中不包含 "ETag" 头信息auth用压缩 , 如果header头中包含 "Authorization" 头信息any无条件启用压缩4、:wq保存退出,重新加载Nginx?1/usr/local/nginx/sbin/nginx -s reload5、用curl测试Gzip是否成功开启curl -I -H "Accept-Encoding: gzip, deflate" "//www.xxx.com/blog/"HTTP/1.1 200 OKServer: nginx/1.0.15Date: Sun, 26 Aug 2012 18:13:09 GMTContent-Type: text/html; charset=UTF-8Connection: keep-aliveX-Powered-By: PHP/5.2.17p1X-Pingback: //www.xxx.com/blog/xmlrpc.phpContent-Encoding: gzip页面成功压缩curl -I -H "Accept-Encoding: gzip, deflate" "//www.xx.net/blog/wp-content/plugins/photonic/include/css/photonic.css"HTTP/1.1 200 OKServer: nginx/1.0.15Date: Sun, 26 Aug 2012 18:21:25 GMTContent-Type: text/cssLast-Modified: Sun, 26 Aug 2012 15:17:07 GMTConnection: keep-aliveExpires: Mon, 27 Aug 2012 06:21:25 GMTCache-Control: max-age=43200Content-Encoding: gzipcss文件成功压缩curl -I -H "Accept-Encoding: gzip, deflate" "//www.slyar.com/blog/wp-includes/js/jquery/jquery.js"HTTP/1.1 200 OKServer: nginx/1.0.15Date: Sun, 26 Aug 2012 18:21:38 GMTContent-Type: application/x-javascriptLast-Modified: Thu, 12 Jul 2012 17:42:45 GMTConnection: keep-aliveExpires: Mon, 27 Aug 2012 06:21:38 GMTCache-Control: max-age=43200Content-Encoding: gzipjs文件成功压缩curl -I -H "Accept-Encoding: gzip, deflate" "//www.xx.net/blog/wp-content/uploads/2012/08/2012-08-23_203542.png"HTTP/1.1 200 OKServer: nginx/1.0.15Date: Sun, 26 Aug 2012 18:22:45 GMTContent-Type: image/pngLast-Modified: Thu, 23 Aug 2012 13:50:53 GMTConnection: keep-aliveExpires: Tue, 25 Sep 2012 18:22:45 GMTCache-Control: max-age=2592000Content-Encoding: gzip图片成功压缩curl -I -H "Accept-Encoding: gzip, deflate" "//www.xxx.com/blog/wp-content/plugins/wp-multicollinks/wp-multicollinks.css"HTTP/1.1 200 OKServer: nginx/1.0.15Date: Sun, 26 Aug 2012 18:23:27 GMTContent-Type: text/cssContent-Length: 180Last-Modified: Sat, 02 May 2009 08:46:15 GMTConnection: keep-aliveExpires: Mon, 27 Aug 2012 06:23:27 GMTCache-Control: max-age=43200Accept-Ranges: bytes
我的中国 2019-12-02 01:33:27 0 浏览量 回答数 0

问题

在无GUI环境下使用 python + selenium + headless chrome

感谢昵昵。 环境:Debian 9 过程: 1.python -v # 查看默认的python版本,本例是 python2.7 2.pip install -U selenium...
dongshan8 2019-12-01 21:38:22 2192 浏览量 回答数 2

问题

Varnish 域名访问没命中?IP可以命中

这是我的配置 vcl 4.0; # Default backend definition. Set this to point to your content server. backend default { .host = "...
hulingjie 2019-12-01 19:44:51 1429 浏览量 回答数 1

问题

关于Joomla更改.htaccess发生500错误的问题

不开SEF一切正常,开了SEF子菜单不能访问,显示access denied;开了apache重写,子菜单显示not found;改了.htaccess,前...
knonline 2019-12-01 21:12:12 4751 浏览量 回答数 3

问题

FTP新增用户后无法登陆

我新增FTP登陆用户后,登陆时报530 Login incorrect vsftpd.conf  配置信息如下 cat /etc/vsftpd/vsftpd.conf # Example config fil...
harryguo 2019-12-01 19:27:52 65 浏览量 回答数 0

问题

为什么云虚拟主机总是500

HTTP 错误 500.0 - Internal Server Error 无法在<fastCGI>应用程序配置中找到<handler> scriptProcessor 模块FastCgiMod...
创新 2019-12-01 21:03:15 4002 浏览量 回答数 1

回答

1. [文件] VelocityLayoutView.java ~ 5KB 下载(22) package com.my.velocity; import java.io.StringWriter; import java.util.Locale; import javax.servlet.http.HttpServletResponse; import org.apache.velocity.Template; import org.apache.velocity.context.Context; import org.apache.velocity.exception.ResourceNotFoundException; import org.springframework.core.NestedIOException; import org.springframework.web.servlet.view.velocity.VelocityToolboxView; public class VelocityLayoutView extends VelocityToolboxView { /** * The default {@link #setLayoutUrl(String) layout url}. */ public static final String DEFAULT_LAYOUT_URL = "layout.vm"; public static final String DEFAULT_LAYOUT_DIR = "/"; /** * The default {@link #setLayoutKey(String) layout key}. */ public static final String DEFAULT_LAYOUT_KEY = "layout"; /** * The default {@link #setScreenContentKey(String) screen content key}. */ public static final String DEFAULT_SCREEN_CONTENT_KEY = "screen_content"; private String layoutUrl = DEFAULT_LAYOUT_URL; private String layoutKey = DEFAULT_LAYOUT_KEY; private String screenContentKey = DEFAULT_SCREEN_CONTENT_KEY; private String layoutDir = DEFAULT_LAYOUT_DIR; /** * Set the layout template to use. Default is {@link #DEFAULT_LAYOUT_URL "layout.vm"}. * @param layoutUrl the template location (relative to the template * root directory) */ public void setLayoutUrl(String layoutUrl) { this.layoutUrl = layoutUrl; } public String getLayoutDir() { return layoutDir; } public void setLayoutDir(String layoutDir) { this.layoutDir = layoutDir; } /** * Set the context key used to specify an alternate layout to be used instead * of the default layout. Screen content templates can override the layout * template that they wish to be wrapped with by setting this value in the * template, for example:<br> * <code>#set( $layout = "MyLayout.vm" )</code> * <p>Default key is {@link #DEFAULT_LAYOUT_KEY "layout"}, as illustrated above. * @param layoutKey the name of the key you wish to use in your * screen content templates to override the layout template */ public void setLayoutKey(String layoutKey) { this.layoutKey = layoutKey; } /** * Set the name of the context key that will hold the content of * the screen within the layout template. This key must be present * in the layout template for the current screen to be rendered. * <p>Default is {@link #DEFAULT_SCREEN_CONTENT_KEY "screen_content"}: * accessed in VTL as <code>$screen_content</code>. * @param screenContentKey the name of the screen content key to use */ public void setScreenContentKey(String screenContentKey) { this.screenContentKey = screenContentKey; } /** * Overrides <code>VelocityView.checkTemplate()</code> to additionally check * that both the layout template and the screen content template can be loaded. * Note that during rendering of the screen content, the layout template * can be changed which may invalidate any early checking done here. */ @Override public boolean checkResource(Locale locale) throws Exception { if (!super.checkResource(locale)) { return false; } try { // Check that we can get the template, even if we might subsequently get it again. getTemplate(this.layoutUrl); return true; } catch (ResourceNotFoundException ex) { throw new NestedIOException("Cannot find Velocity template for URL [" + this.layoutUrl + "]: Did you specify the correct resource loader path?", ex); } catch (Exception ex) { throw new NestedIOException( "Could not load Velocity template for URL [" + this.layoutUrl + "]", ex); } } /** * Overrides the normal rendering process in order to pre-process the Context, * merging it with the screen template into a single value (identified by the * value of screenContentKey). The layout template is then merged with the * modified Context in the super class. */ @Override protected void doRender(Context context, HttpServletResponse response) throws Exception { renderScreenContent(context); // Velocity context now includes any mappings that were defined // (via #set) in screen content template. // The screen template can overrule the layout by doing // #set( $layout = "MyLayout.vm" ) String layoutUrlToUse = (String) context.get(this.layoutKey); if (layoutUrlToUse != null) { if (logger.isDebugEnabled()) { logger.debug("Screen content template has requested layout [" + layoutUrlToUse + "]"); } if(this.layoutDir != null){ layoutUrlToUse = this.layoutDir + layoutUrlToUse; } } else { // No explicit layout URL given -> use default layout of this view. layoutUrlToUse = this.layoutUrl; } mergeTemplate(getTemplate(layoutUrlToUse), context, response); } /** * The resulting context contains any mappings from render, plus screen content. */ private void renderScreenContent(Context velocityContext) throws Exception { if (logger.isDebugEnabled()) { logger.debug("Rendering screen content template [" + getUrl() + "]"); } StringWriter sw = new StringWriter(); Template screenContentTemplate = getTemplate(getUrl()); screenContentTemplate.merge(velocityContext, sw); // Put rendered content into Velocity context. velocityContext.put(this.screenContentKey, sw.toString()); } } 2. [文件] VelocityResolver.java ~ 3KB 下载(15) package com.my.velocity; import org.springframework.web.servlet.view.AbstractUrlBasedView; import org.springframework.web.servlet.view.velocity.VelocityViewResolver; public class VelocityResolver extends VelocityViewResolver { private String layoutUrl; private String layoutKey; private String screenContentKey; private String layoutDir; public String getLayoutDir() { return layoutDir; } public void setLayoutDir(String layoutDir) { this.layoutDir = layoutDir; } /** * Set the layout template to use. Default is "layout.vm". * @param layoutUrl the template location (relative to the template * root directory) * @see VelocityLayoutView#setLayoutUrl */ public void setLayoutUrl(String layoutUrl) { this.layoutUrl = layoutUrl; } /** * Set the context key used to specify an alternate layout to be used instead * of the default layout. Screen content templates can override the layout * template that they wish to be wrapped with by setting this value in the * template, for example:<br> * <code>#set( $layout = "MyLayout.vm" )</code> * <p>The default key is "layout", as illustrated above. * @param layoutKey the name of the key you wish to use in your * screen content templates to override the layout template * @see VelocityLayoutView#setLayoutKey */ public void setLayoutKey(String layoutKey) { this.layoutKey = layoutKey; } /** * Set the name of the context key that will hold the content of * the screen within the layout template. This key must be present * in the layout template for the current screen to be rendered. * <p>Default is "screen_content": accessed in VTL as * <code>$screen_content</code>. * @param screenContentKey the name of the screen content key to use * @see VelocityLayoutView#setScreenContentKey */ public void setScreenContentKey(String screenContentKey) { this.screenContentKey = screenContentKey; } /** * Requires VelocityLayoutView. * @see VelocityLayoutView */ protected Class requiredViewClass() { return VelocityLayoutView.class; } protected AbstractUrlBasedView buildView(String viewName) throws Exception { VelocityLayoutView view = (VelocityLayoutView) super.buildView(viewName); //设置模版文件(layout)的根目录 if(this.layoutDir != null){ view.setLayoutDir(this.layoutDir); } if (this.layoutUrl != null) { view.setLayoutUrl(this.layoutUrl); } if (this.layoutKey != null) { view.setLayoutKey(this.layoutKey); } if (this.screenContentKey != null) { view.setScreenContentKey(this.screenContentKey); } return view; } }
a123456678 2019-12-02 02:07:47 0 浏览量 回答数 0

问题

gitlab CI / CD在构建之前失败

我是gitlab的新手,在尝试构建时遇到问题。 这是我到gitlab的网址:http:// localhost / root / mytest,我在Linux虚拟机中安装了gitla...
垚tutu 2019-12-26 21:17:03 16 浏览量 回答数 1

云产品推荐

上海奇点人才服务相关的云产品 小程序定制 上海微企信息技术相关的云产品 国内短信套餐包 ECS云服务器安全配置相关的云产品 开发者问答 阿里云建站 自然场景识别相关的云产品 万网 小程序开发制作 视频内容分析 视频集锦 代理记账服务