当前位置:网站首页>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 .
边栏推荐
- Precautions for use of Jerry's SPI slave [chapter]
- Unity technical manual - lifecycle rotation rotationoverlifetime speed rotation rotationbyspeed external forces
- CGI connects to database through ODBC
- Mobx learning path - powerful "state management tool"
- HMS core machine learning service realizes simultaneous interpretation, supports Chinese-English translation and multiple voice broadcast
- TLV decoding
- 十大龙头券商 办理开户安全吗
- Introduction to the container of() function
- 汇编语言(5)寄存器(内存访问)
- 杰理之定时器捕获(timer_cap.c)使用注意事项【篇】
猜你喜欢

解决nvprof 报错ERR_NVGPUCTRPERM - The user does not have permission to profile on the target device.

About Equilibrium - Simplified bottleneck model

Virtual machine class loading mechanism

How high does UART baud rate require for clock accuracy?

Use diskgenius to expand the capacity of system disk C

WARNING: Unsupported upgrade request.

HMS core machine learning service realizes simultaneous interpretation, supports Chinese-English translation and multiple voice broadcast
沁恒CH583 USB 自定义HID调试记录

Unity technical manual - size over lifetime and size by speed

智能对话01-redis的安装
随机推荐
CONDA modifying a mirror source
Swagger实现后台接口自动化文档
golang sort slice int
Jerry's system clock setting is reset or invalid [chapter]
ACY100油烟浓度在线监控仪针对饮食业厨房油烟排放
杰理之定时器使用注意事项【篇】
How about qiniu's Zhangle TenPay? Is it safe
A simple and easy-to-use graph visualization tool developed recently
[UVM practice== > episode_2] ~ VIP, VIP development, VIP release
启牛的涨乐财付通如何?安全靠谱吗
Which of the top ten securities companies has the lowest commission? Is it safe to open an account
Bert's summary of me
SDN系统方法 | 10. SDN的未来
golang sort slice int
What is public chain development? What are the public chain development projects?
Recursion and divide and conquer
C语言中%含义
SDN系统方法 | 9. 接入网
20 provinces and cities announce the road map of the meta universe
使用DiskGenius拓展系统盘C盘的容量