|
Struts example source code file (PortletHttpSession.java)
The Struts PortletHttpSession.java source code/* * $Id: PortletHttpSession.java 651946 2008-04-27 13:41:38Z apetrelli $ * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.struts2.portlet.servlet; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; import javax.portlet.PortletSession; import javax.servlet.ServletContext; import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSessionContext; /** * Wrapper object exposing a {@link PortletSession} as a {@link HttpSession} instance. * Clients accessing this session object will in fact operate on the * {@link PortletSession} object wrapped by this session object. */ public class PortletHttpSession implements HttpSession { private PortletSession portletSession; public PortletHttpSession(PortletSession portletSession) { this.portletSession = portletSession; } /* * (non-Javadoc) * * @see javax.servlet.http.HttpSession#getAttribute(java.lang.String) */ public Object getAttribute(String name) { return portletSession.getAttribute(name); } /* * (non-Javadoc) * * @see javax.servlet.http.HttpSession#getAttributeNames() */ public Enumeration getAttributeNames() { return portletSession.getAttributeNames(); } /* * (non-Javadoc) * * @see javax.servlet.http.HttpSession#getCreationTime() */ public long getCreationTime() { return portletSession.getCreationTime(); } /* * (non-Javadoc) * * @see javax.servlet.http.HttpSession#getId() */ public String getId() { return portletSession.getId(); } /* * (non-Javadoc) * * @see javax.servlet.http.HttpSession#getLastAccessedTime() */ public long getLastAccessedTime() { return portletSession.getLastAccessedTime(); } /* * (non-Javadoc) * * @see javax.servlet.http.HttpSession#getMaxInactiveInterval() */ public int getMaxInactiveInterval() { return portletSession.getMaxInactiveInterval(); } /* * (non-Javadoc) * * @see javax.servlet.http.HttpSession#getServletContext() */ public ServletContext getServletContext() { return new PortletServletContext(portletSession.getPortletContext()); } /** * @see javax.servlet.http.HttpSession#getSessionContext() * @throws IllegalStateException * Not supported in a portlet. */ public HttpSessionContext getSessionContext() { throw new IllegalStateException("Not supported in a portlet"); } /* * (non-Javadoc) * * @see javax.servlet.http.HttpSession#getValue(java.lang.String) */ public Object getValue(String name) { return getAttribute(name); } /* * (non-Javadoc) * * @see javax.servlet.http.HttpSession#getValueNames() */ public String[] getValueNames() { List<String> names = new ArrayList Other Struts examples (source code examples)Here is a short list of links related to this Struts PortletHttpSession.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.