Torna indietro   Hardware Upgrade Forum > Software > Programmazione

iPhone 17 Pro: più di uno smartphone. È uno studio di produzione in formato tascabile
iPhone 17 Pro: più di uno smartphone. È uno studio di produzione in formato tascabile
C'è tanta sostanza nel nuovo smartphone della Mela dedicato ai creator digitali. Nuovo telaio in alluminio, sistema di raffreddamento vapor chamber e tre fotocamere da 48 megapixel: non è un semplice smartphone, ma uno studio di produzione digitale on-the-go
Intel Panther Lake: i processori per i notebook del 2026
Intel Panther Lake: i processori per i notebook del 2026
Panther Lake è il nome in codice della prossima generazione di processori Intel Core Ultra, che vedremo al debutto da inizio 2026 nei notebook e nei sistemi desktop più compatti. Nuovi core, nuove GPU e soprattutto una struttura a tile che vede per la prima volta l'utilizzo della tecnologia produttiva Intel 18A: tanta potenza in più, ma senza perdere in efficienza
Intel Xeon 6+: è tempo di Clearwater Forest
Intel Xeon 6+: è tempo di Clearwater Forest
Intel ha annunciato la prossima generazione di processori Xeon dotati di E-Core, quelli per la massima efficienza energetica e densità di elaborazione. Grazie al processo produttivo Intel 18A, i core passano a un massimo di 288 per ogni socket, con aumento della potenza di calcolo e dell'efficienza complessiva.
Tutti gli articoli Tutte le news

Vai al Forum
Rispondi
 
Strumenti
Old 21-02-2006, 08: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, 08: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


iPhone 17 Pro: più di uno smartphone. È uno studio di produzione in formato tascabile iPhone 17 Pro: più di uno smartphone. &Eg...
Intel Panther Lake: i processori per i notebook del 2026 Intel Panther Lake: i processori per i notebook ...
Intel Xeon 6+: è tempo di Clearwater Forest Intel Xeon 6+: è tempo di Clearwater Fore...
4K a 160Hz o Full HD a 320Hz? Titan Army P2712V, a un prezzo molto basso 4K a 160Hz o Full HD a 320Hz? Titan Army P2712V,...
Recensione Google Pixel Watch 4: basta sollevarlo e si ha Gemini sempre al polso Recensione Google Pixel Watch 4: basta sollevarl...
Samsung è sempre più prota...
ChatGPT ha pregiudizi politici? Ecco cos...
Un solo iPhone rubato ha portato alla sc...
Xiaomi 17 Ultra sta arrivando: ecco come...
Il Motorola Edge 70 non ha più se...
Alcuni Galaxy S26 utilizzeranno il chip ...
Amazon, ecco i super sconti del weekend:...
Scovare un bug di sicurezza sui disposit...
Offerta Amazon su NordVPN: proteggi 10 d...
ECOVACS DEEBOT X8 PRO OMNI in offerta su...
Scope elettriche Tineco in offerta su Am...
Offerta Amazon sui robot EUREKA J15 Ultr...
Chrome disattiverà automaticament...
Tornano tutti e 4 i colori disponibili p...
Super sconto su iPhone 16: Amazon abbass...
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: 00:46.


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