当前位置:网站首页>The icon is missing. What does the URL come from with the jesssionid?
The icon is missing. What does the URL come from with the jesssionid?
2022-06-25 17:48:00 【Small hair】
Recently, I was tossing about an old system , from IE Browser moved to Google browser . Of course, you can't move it directly , It mainly relies on a Google plug-in IETab, Partially incompatible Struts2/JSP The page menu adopts IETab open , A strange thing happened , Some icons on the page don't show up , The main positioning process and cause analysis are recorded below .
At the beginning , I noticed that some of the icons in the menus can't be implemented , But it is not necessary , Some menus are OK , So I didn't pay attention to this problem . Later others found out , Only in IETab Open some menus to .
Let's see the path of the request , The discovery icon is 404, The call path is a.gif;jessionid=xxxxx The format of . Indeed, this path will be in the current nginx Blocked under configuration , But I click to check , It is normal to brush the icon on the page . Fortunately, I did JSP/Servlet Of , I realize that this mechanism uses URL Override to pass the session id , stay Cookie This happens when the session ID does not exist .
Understand this , The whole process was quickly sorted out later . The outer path of this system is /a, adopt iframe Open the real menu path /b, First /b What opens here is a JSP page , This icon is in a JSP Generated on the tag , Generate URL It's time to call response.encodeURL, This could happen URL Rewriting . in addition ,IEtab The free version does not support opening IE Time transfer Cookie Information , Although we use certain means to Cookie Pass on to /a 了 , however /b Your conversation didn't come , So open /b When generating icon paths at the same time , And that's what happened URL rewrite .
In the past, there was no problem that the conversation could not be carried over , This also explains , Why IETab Then the problem became obvious .
This is an old application , Conversation is a must , The configuration cannot be moved casually , Finally, I made a small patch : In the open /a When , First visit the page in advance /b A simple path to , such /b The session ID of has , Open the menu again and the icon will be displayed normally .
Although it is not popular now JSP 了 , but JSP Still quite powerful . The positioning process turned smoothly encodeURL stay tomcat The concrete realization of , Suddenly, I miss it again .
Source code tracking record
The main source code is org.apache.catalina.connector.Response.
@Override
public String encodeURL(String url) {
...
if (isEncodeable(absolute)) {
...
return toEncoded(url, request.getSessionInternal().getIdInternal());
}
...
}
The core method logic is in these two paragraphs ,isEncodeable Judge whether it is right URL code ,toEncoded Yes URL Encoding .
protected boolean isEncodeable(final String location) {
...
// Are we in a valid session that is not using cookies?
final Request hreq = request;
final Session session = hreq.getSessionInternal(false);
if (session == null) {
return false;
}
if (hreq.isRequestedSessionIdFromCookie()) {
return false;
}
// Is URL encoding permitted
if (!hreq.getServletContext().getEffectiveSessionTrackingModes().
contains(SessionTrackingMode.URL)) {
return false;
}
...
}
It's easy to decide whether to code or not , Determine if there is a conversation , If there is a conversation judgment in Cookie Is there a conversation in ID. If there is no conversation ID, Look, I don't support URL Conversation tracking , Only if you support this feature should you consider URL code .
Introduction to session tracking features :
https://stackoverflow.com/questions/16262285/set-tracking-mode-to-cookie-to-remove-appended-session-id-without-using-web-xml https://www.logicbig.com/tutorials/java-ee-tutorial/java-servlet/session-tracking-mode.html
protected String toEncoded(String url, String sessionId) {
...
StringBuilder sb = new StringBuilder(path);
if( sb.length() > 0 ) { // jsessionid can't be first.
sb.append(';');
sb.append(SessionConfig.getSessionUriParamName(
request.getContext()));
sb.append('=');
sb.append(sessionId);
}
...
}
The way to encode is to add after the path ;jessionid=xxxx The path of .
边栏推荐
- 股票开户怎么办理 办理开户安全吗
- Can I open an account? Is it safe to open an account
- Utilisation de diskgenius pour augmenter la capacité du disque système C
- 相同wifi下,笔记本连接台式机上的虚拟机
- 一些常用的知识点积累
- 20 provinces and cities announce the road map of the meta universe
- conda安装的py3.6和py3.7
- 汇编语言(6)使用JCC指令构造分支与循环
- 怎么判断自己是否适合转行软件测试
- [matlab] data statistical analysis
猜你喜欢

喜报|海泰方圆通过CMMI-3资质认证,研发能力获国际认可

Unity technical manual - size over lifetime and size by speed
![How Jerry used to output a clock source to the outside world [chapter]](/img/ea/161be6416726bcd80bb2823a5f6389.png)
How Jerry used to output a clock source to the outside world [chapter]

Recursion and divide and conquer

Utilisation de diskgenius pour augmenter la capacité du disque système C

Unity technical manual - interference / noise sub module
![[UVM practice== > episode_1] ~ MCDF design update, AMBA standard interface, UVM verification environment update](/img/22/0c13e98e634a99d1680dd4bb12eaef.png)
[UVM practice== > episode_1] ~ MCDF design update, AMBA standard interface, UVM verification environment update

How to judge whether you are suitable for software testing

智能对话01-redis的安装

观察者模式之通用消息发布与订阅
随机推荐
杰理之定时器使用注意事项【篇】
Vscode automatically generates ifndef define ENDIF of header file
【 NLP 】 in this year's English college entrance examination, CMU delivered 134 high scores with reconstruction pre training, significantly surpassing gpt3
汇编语言(5)寄存器(内存访问)
Unity technical manual - interference / noise sub module
微博评论的计算架构
How Jerry used to output a clock source to the outside world [chapter]
Bert's summary of me
Garbage collector and memory allocation strategy
力扣每日一题-第27天-561.数组拆分Ⅰ
杰理之增加加密文件播放功能【篇】
杰理之定时器使用注意事项【篇】
Swagger implements background interface automation document
Getting started with kotlin (20) several common dialog boxes
conda安装的py3.6和py3.7
相同wifi下,笔记本连接台式机上的虚拟机
华为云GaussDB(for Redis)揭秘第19期:GaussDB(for Redis)全面对比Codis
What is public chain development? What are the public chain development projects?
Introduction to the container of() function
TLV decoding