Сеансы HTTP не работают на iOS для всех браузеров

Мой веб-сайт отлично работает во всех браузерах для устройств Windows и Android. Но когда речь идет об устройствах iOS для всех браузеров, сеансы java возвращают нулевые значения на страницах JSP.

testinput.jsp:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action="testing" method="post">
    <input type="text" name="pdf1">
    <input type="text" name="pdf2">
    <button type="submit">click me</button>
</form>
</body>
</html>

testing.java (сервлет):

import java.io.IOException; 
import javax.servlet.ServletException; 
import javax.servlet.annotation.WebServlet; 
import javax.servlet.http.Cookie; 
import javax.servlet.http.HttpServlet; 
import javax.servlet.http.HttpServletRequest; 
import javax.servlet.http.HttpServletResponse; 
import javax.servlet.http.HttpSession;

/**  * Servlet implementation class testing  */ @WebServlet("/testing") 

public class testing extends HttpServlet {  
private static final long serialVersionUID = 1L;

    /**
     * @see HttpServlet#HttpServlet()
     */
    public testing() {
        super();
        // TODO Auto-generated constructor stub
    }

    /**      
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)   
*/  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {       
// TODO Auto-generated method stub      
response.getWriter().append("Served at: ").append(request.getContextPath());    }


/**      * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)     */     
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {      
String abc = request.getParameter("pdf1").toString();       
String def = request.getParameter("pdf2").toString();

HttpSession sess = request.getSession();        
sess.setAttribute("pdf1", abc);         
sess.setAttribute("pdf2", def);         
if(sess.getAttribute("pdf1")!=null){            
Cookie cook = new Cookie("login", sess.getAttribute("pdf1").toString());             

response.addCookie(cook);       
}       
response.sendRedirect("test.jsp");      
return;     
}
}

test.jsp:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
    <%try{ %>
    <% Cookie cook[] = request.getCookies();

    for(Cookie c :cook){
        if(c.getName().equals("pdf1")){
            String str = c.getValue();%>
            <p><%=str%></p> 
        <%}
    }%>     
    <p><%=session.getAttribute("pdf1").toString() %></p>
    <p><%=session.getAttribute("pdf2").toString() %></p>
    <%}catch (Exception e){ 
        e.printStackTrace();
        log("erroristhis"+e);
        }%>
</body>
</html>

Apache:

Я добавил следующие строки в свой https.conf. virtualHost*:80 файлов на моем vps-сервере linux для доступа к переменным сеанса.

<VirtualHost *:80>
ServerName example.com
ServerAlias mail.example.com www.example.com
#  DocumentRoot /home/example1/public_html
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
JkMount  /* example
<Proxy *>
    Order deny,allow
    Allow from all
  </Proxy>
  ProxyRequests Off
  ProxyPreserveHost On
  ProxyPass               /       http://localhost:8080/example/
  ProxyPassReverse        /       http://localhost:8080/example/
  ProxyPassReverseCookiePath        /   domine/
</VirtualHost>

person Ravi varma    schedule 28.05.2018    source источник
comment
почему бы вам не отладить свой doPost метод и не посмотреть, что происходит   -  person Scary Wombat    schedule 28.05.2018
comment
Я сделал session.getAttribute (pdf1), возвращая нулевое значение на страницах jsp, он отлично работает на сервлете.   -  person Ravi varma    schedule 28.05.2018
comment
проверьте stackoverflow.com/questions/2138245/   -  person Scary Wombat    schedule 28.05.2018
comment
привет, #Scary Wombat, я ценю, что вы помогаете нам в этом. мои сеансы работают нормально на моем локальном сервере tomcat. и во всех браузерах приложений Windows и Android. проблема в том, что когда дело доходит до IOS, сеансы возвращают нулевые значения, и только на страницах jsp они отлично работают и с сервлетами. я смущен! Я подумал, может быть, я неправильно настроил httpd.conf на моем Linux VPS сервере. поправьте меня, если я ошибаюсь. Спасибо.   -  person Ravi varma    schedule 29.05.2018