Torna indietro   Hardware Upgrade Forum > Software > Programmazione

Sony Alpha 7 V, anteprima e novità della nuova 30fps, che tende la mano anche ai creator
Sony Alpha 7 V, anteprima e novità della nuova 30fps, che tende la mano anche ai creator
Dopo oltre 4 anni si rinnova la serie Sony Alpha 7 con la quinta generazione, che porta in dote veramente tante novità a partire dai 30fps e dal nuovo sensore partially stacked da 33Mpixel. L'abbiamo provata per un breve periodo, ecco come è andata dopo averla messa alle strette.
realme GT 8 Pro Dream Edition: prestazioni da flagship e anima racing da F1
realme GT 8 Pro Dream Edition: prestazioni da flagship e anima racing da F1
realme e Aston Martin Aramco F1 Team si sono (ri)unite dando alla vita un flagship con chip Snapdragon 8 Elite Gen 5 e design esclusivo ispirato alle monoposto di Formula 1. La Dream Edition introduce la nuova colorazione Lime Essence abbinata al tradizionale Aston Martin Racing Green, decorazioni intercambiabili personalizzate e una confezione a tema F1, intorno a uno smartphone dall'ottima dotazione tecnica con batteria da 7000mAh ricaricabile a 120W e isola fotografica intercambiabile
OVHcloud Summit 2025: le novità del cloud europeo tra sovranità, IA e quantum
OVHcloud Summit 2025: le novità del cloud europeo tra sovranità, IA e quantum
Abbiamo partecipato all'OVHcloud Summit 2025, conferenza annuale in cui l'azienda francese presenta le sue ultime novità. Abbiamo parlato di cloud pubblico e privato, d'intelligenza artificiale, di computer quantistici e di sovranità. Che forse, però, dovremmo chiamare solo "sicurezza"
Tutti gli articoli Tutte le news

Vai al Forum
Rispondi
 
Strumenti
Old 21-02-2006, 09:07   #1
Corvo80
Member
 
Iscritto dal: Dec 2004
Città: Treviso e Udine
Messaggi: 258
[Java Servlet] Problema coi cookies

Sono alle prime armi con la gestione dei cookies e ho provato a copiare da un libro questo semplice codice:

Codice:
package coreservlets;

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

/** Sets six cookies: three that apply only to the current
* session (regardless of how long that session lasts)
* and three that persist for an hour (regardless of
* whether the browser is restarted).
*/

public class SetCookies extends HttpServlet {

    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	for(int i=0; i<3; i++) {

	    // Default maxAge is -1, indicating cookie
	    // applies only to current browsing session.
	    Cookie cookie = new Cookie("Session-Cookie " + i, "Cookie-Value-S" + i);
	    response.addCookie(cookie);
	    cookie = new Cookie("Persistent-Cookie " + i, "Cookie-Value-P" + i);

	    // Cookie is valid for an hour, regardless of whether
	    // user quits browser, reboots computer, or whatever.
	    cookie.setMaxAge(3600);
	    response.addCookie(cookie);
	}
	response.setContentType("text/html");
	PrintWriter out = response.getWriter();
	String title = "Setting Cookies";
	out.println(ServletUtilities.headWithTitle(title) +
		"<BODY BGCOLOR=\"#FDF5E6\">\n" +
		"<H1 ALIGN=\"CENTER\">" + title + "</H1>\n" +
		"There are six cookies associated with this page.\n" +
		"To see them, visit the\n" +
		"<A HREF=\"/servlet/coreservlets.ShowCookies\">\n" +
		"<CODE>ShowCookies</CODE> servlet</A>.\n" +
		"<P>\n" +
		"Three of the cookies are associated only with the\n" +
		"current session, while three are persistent.\n" +
		"Quit the browser, restart, and return to the\n" +
		"<CODE>ShowCookies</CODE> servlet to verify that\n" +
		"the three long-lived ones persist across sessions.\n" +
		"</BODY></HTML>");
    }
}
Il problema, è che mi dà il seguente errore, quando cerco di aprire la servlet da browser:

Codice:
type Exception report

message 

description The server encountered an internal error () that prevented it from fulfilling this request.

exception 

java.lang.IllegalArgumentException: Cookie name "Session-Cookie 0" is a reserved token
	javax.servlet.http.Cookie.<init>(Cookie.java:140)
	coreservlets.SetCookies.doGet(SetCookies.java:19)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:419)
	org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:133)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.15 logs.
Help plz!
Corvo80 è offline   Rispondi citando il messaggio o parte di esso
Old 21-02-2006, 09:29   #2
Corvo80
Member
 
Iscritto dal: Dec 2004
Città: Treviso e Udine
Messaggi: 258
Uff! Scusate, ho risolto (c'era uno spazio)...

che pignolo però!!
Corvo80 è offline   Rispondi citando il messaggio o parte di esso
 Rispondi


Sony Alpha 7 V, anteprima e novità della nuova 30fps, che tende la mano anche ai creator Sony Alpha 7 V, anteprima e novità della ...
realme GT 8 Pro Dream Edition: prestazioni da flagship e anima racing da F1 realme GT 8 Pro Dream Edition: prestazioni da fl...
OVHcloud Summit 2025: le novità del cloud europeo tra sovranità, IA e quantum OVHcloud Summit 2025: le novità del cloud...
Un mostro da MSI: QD-OLED WQHD a 500 Hz con AI Care e DisplayPort 2.1a Un mostro da MSI: QD-OLED WQHD a 500 Hz con AI C...
DJI Neo 2 in prova: il drone da 160 grammi guadagna il gimbal e molto altro DJI Neo 2 in prova: il drone da 160 grammi guada...
realme GT 8 Pro in promo lancio con 100€...
Autostrade, dal 2026 arrivano i rimborsi...
Carenza di memoria flash NAND e prezzi a...
EA Sports FC 26 fa felici i fan: tornano...
Anthropic studia i suoi ingegneri: l'IA ...
Kioxia Exceria Plus G4: l'SSD PCIe 5.0 p...
HBO Max debutta in Italia: data, contenu...
Qual è lo smartphone Android pi&u...
Il camion elettrico Semi è davver...
Instagram limita gli hashtag a tre per p...
Le migliori offerte Amazon del momento: ...
RTI e Medusa denunciano Perplexity AI: p...
Avviatori, compressori e accessori auto:...
Samsung Galaxy S26: un leak anticipa le ...
Windows 11, KB5070311 sistema e rompe la...
Chromium
GPU-Z
OCCT
LibreOffice Portable
Opera One Portable
Opera One 106
CCleaner Portable
CCleaner Standard
Cpu-Z
Driver NVIDIA GeForce 546.65 WHQL
SmartFTP
Trillian
Google Chrome Portable
Google Chrome 120
VirtualBox
Tutti gli articoli Tutte le news Tutti i download

Strumenti

Regole
Non Puoi aprire nuove discussioni
Non Puoi rispondere ai messaggi
Non Puoi allegare file
Non Puoi modificare i tuoi messaggi

Il codice vB è On
Le Faccine sono On
Il codice [IMG] è On
Il codice HTML è Off
Vai al Forum


Tutti gli orari sono GMT +1. Ora sono le: 15:10.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Served by www3v