Maintain the HTTP session
I am building a small J2ME application that opens a HTTP connection to the server. The application requires user authentication.
But, each time I open a HTTP connection to the server, the server creates a new HTTP session.
Is there any way to maintain the session between server calls?
Thanks
[ssljivic],
Perhaps you may want to post parts of your code that is doing the HttpConnection calls before any of us on the forum can advise or share our experiences.
Session management should be done by the webserver that your J2ME application is making HttpConnection to. The CLDC/MIDP APIs provides the RMS javax.microedition.rms package that offers a developer a way to persistently stored data on the device. Data from the RMS store can be compared with the data by the session manager on the webserver to identify the J2ME client and thus obtaining back the previous sessions' state, very much like the concepts of cookies in a normal HTTP browser.
My 2 cents worth, HTH.
~Allen Lai
Developer Technical Support
SUN Microsystems
http://www.sun.com/developers/support/
Similar Messages
-
Maintaining an HTTP session in SOAP
Is it possible to maintain an HTTP session when using RPC style SOAP services?
If not, how do people maintain conversational state between a client and a SOAP
server?All is not lost though!!! Apache's SOAP implementation supports Stateful session.
Maybe u should take a look at it...
"Kumar Mettu" <[email protected]> wrote:
Naresh,
BEA's webservices implementation is at Stateless Session Bean level .
And
hence you are never working at servlet/jsp level. So there is no way
you can
use HTTP Session.
Also BEA's webservices doesn't support Header Element.
Kumar.
"Naresh Bhatia" <[email protected]> wrote in message
news:3bc72918$[email protected]..
Well, if that is the case, we could maintain state manually by "inventing"our
own session objects. All we would have to do is to maintain a map atthe
server
end that maps a sessionId to a session. The sessionId would have tobe
passed
as a parameter to every method. (Yuck. Or can it be put into the soapheader somehow
- so as to keep the method signatures clean?) Do you see any holeswith
this approach?
"Mullai Murugan" <[email protected]> wrote:
It looks like maintaining state is not possible in the current release.
The documentation
says clearly that only stateless beans are supported.
"Naresh Bhatia" <[email protected]> wrote:
Is it possible to maintain an HTTP session when using RPC style SOAP
services?
If not, how do people maintain conversational state between a client
and a SOAP
server? -
Hi ihave maintained the http connection to enable proxy but still?
hi ihave maintained the http connection and also in sxmb_adm i have added the
entriees for specific configuration to enable proxy but still i m getting the error
->no connection to the integration builder
->on going to the connection test
i get the error SPROX_IFR_ADDRESS
and unable to get the data exchange profile
and in exchange profile i can see all the relavavt data w.r.to xi serer in connections section.
->do we also have to maintain anything relate to r3 in exchange profile><i>do we also have to maintain anything relate to r3 in exchange profile</i>
Not needed.
Just follow Vijaya's blog on what needs to be done step by step and if still no success let us know what the error is
/people/vijaya.kumari2/blog/2006/01/26/how-do-you-activate-abap-proxies
Regards
Bhavesh -
Maintain HTTP Session in Webservice
Hi,
I configured a Webservice as an External Resource, just for consume it.
It works OK for a single method invocation in this webservice, but I need to maintain a HTTP session between more than one invocation to this webservice. How I can configure a Webservice External resource to maintain HTTP session between methods invocations?The option that you mentioned is just for WebServices that needs HTTP Authentication.
Is not my case.
http://twitpic.com/i2f3h
Image: !http://web7.twitpic.com/img/30345965-80ad8fb7ebd3282957694547d6e3cda0.4ab27651-full.gif! -
Coding for maintain the multip[le sessions
i have 1,00,000 records in a flat file how to maintain the multiple sessions
each session having 10000 records i want coding for how these multiple sessionssee the example program and the selection screen you can maintain how many records per session.
Report : ZMPPC015
Type : Data upload
Author : Seshu Maramreddy
Date : 05/26/2005
Transport : DV3K920025
Transaction: ??
Description: This ABAP/4 Program to Create Planned Independent
Requirement for SMI plants using MD61 Transaction.
It accepts tab-delimited spreadsheet input and
creates BDC sessions.
report zmppc015 no standard page heading
line-size 120
line-count 55
message-id zz.
Constants
constants : c_x type c value 'X'," Dynbegin
c_tcode type tstc-tcode value 'MD61'." Transaction Code
Variables
data : v_lines_in_xcel like sy-tabix,
l_tabix like sy-tabix,
v_trans_in_ssn type i,
v_ssnnr(4) type n," Counter
v_ssnname like apqi-groupid,
v_matnr(18) type c. " Material Number
Internal Tables
Internal table for file
data : begin of t_file occurs 0,
matnr(18) type c, " Material Number
berid(10) type c, " MRP Area
PLNMG01(17) type n, " Forecast Month -01
PLNMG02(17) type n, " Forecast Month -02
PLNMG03(17) type n, " Forecast Month -03
PLNMG04(17) type n, " Forecast Month -04
PLNMG05(17) type n, " Forecast Month -05
PLNMG06(17) type n, " Forecast Month -06
PLNMG07(17) type n, " Forecast Month -07
PLNMG08(17) type n, " Forecast Month -08
PLNMG09(17) type n, " Forecast Month -09
PLNMG10(17) type n, " Forecast Month -10
PLNMG11(17) type n, " Forecast Month -11
PLNMG12(17) type n, " Forecast Month -12
WERKS(4) TYPE C, " Plant
end of t_file.
Internal table for BDCDATA Structure
data : begin of itab_bdc_tab occurs 0.
include structure bdcdata.
data : end of itab_bdc_tab.
Selection-screen
selection-screen: skip 3.
selection-screen: begin of block id1 with frame.
parameters: p_name like rlgrap-filename
default 'C:\My Documents\InputFile.txt'
obligatory,
bdc session name prefix
p_bdcpfx(6) default 'ZPIRCT'
obligatory,
number for transction per BDC session
p_trnssn type i
default 2000 obligatory,
retain the BDC session after successfull execution
p_keep like apqi-qerase
default c_x,
user who will be executing BDC session
p_uname like apqi-userid
default sy-uname
obligatory.
selection-screen : skip 1.
Requirement type
parameters : p_bedae like t459u-bedae,
From Date
p_date like sy-datum default sy-datum obligatory.
selection-screen: end of block id1.
at selection-screen on value-request for p_name.
F4 value for Input file
perform filename_get.
main processing
start-of-selection.
To get the data from file to Internal table
perform getdata_fromfile.
loop at t_file.
hang on to xcel line num
l_tabix = sy-tabix.
if num-of-trnas-in-session = 0, create new BDC session
if v_trans_in_ssn is initial.
perform bdc_session_open.
endif.
begin new bdc script for rtg create trans
fill in bdc-data for prod.version maintenance screens
perform bdc_build_script.
insert the bdc script as a BDC transaction
perform bdc_submit_transaction.
keep track of how many BDC transactions were inserted in the BDC
session
add 1 to v_trans_in_ssn.
if the user-specified num of trans in BDC session is reached OR
if end of input file is reached, close the BDC session
if v_trans_in_ssn = p_trnssn or
l_tabix = v_lines_in_xcel.
perform bdc_session_close.
clear v_trans_in_ssn.
endif.
clear t_file.
endloop.
top-of-page.
call function 'Z_HEADER'
EXPORTING
FLEX_TEXT1 =
FLEX_TEXT2 =
FLEX_TEXT3 =
*& Form filename_get
F4 Value for input file
FORM filename_get.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_PATH = 'C:\Temp\ '
MASK = ',.,..'
MODE = 'O'
TITLE = 'Select File '(007)
IMPORTING
FILENAME = p_name
EXCEPTIONS
INV_WINSYS = 1
NO_BATCH = 2
SELECTION_CANCEL = 3
SELECTION_ERROR = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " filename_get
*& Form getdata_fromfile
Upload the data from file to Internal table
FORM getdata_fromfile.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = p_name
FILETYPE = 'DAT'
TABLES
DATA_TAB = t_file
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10.
if sy-subrc eq 0.
sort t_file by matnr .
delete t_file where matnr = ''.
clear v_lines_in_xcel.
describe table t_file lines v_lines_in_xcel.
if v_lines_in_xcel is initial.
write: / 'No data in input file'.
stop.
endif.
else.
write:/ 'Error reading input file'.
stop.
endif.
ENDFORM. " getdata_fromfile
*& Form bdc_session_open
BDC_OPEN_GROUP
FORM bdc_session_open.
create bdc session name = prefix-from-selectn-screen + nnnn
add 1 to v_ssnnr.
concatenate p_bdcpfx v_ssnnr into v_ssnname.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = v_ssnname
KEEP = p_keep
USER = p_uname
EXCEPTIONS
CLIENT_INVALID = 1
DESTINATION_INVALID = 2
GROUP_INVALID = 3
GROUP_IS_LOCKED = 4
HOLDDATE_INVALID = 5
INTERNAL_ERROR = 6
QUEUE_ERROR = 7
RUNNING = 8
SYSTEM_LOCK_ERROR = 9
USER_INVALID = 10
OTHERS = 11.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " bdc_session_open
*& Form bdc_build_script
BDC Script
FORM bdc_build_script.
Local Variables
DATA : l_frdat(8) type c, " From Date
l_todat(8) type c, " To Date
l_frdat1(4) type c, " Year
l_frdat2(2) type c, " Month
l_frdat3(2) type c, " Day
l_tdate like sy-datum, " Subtract date(1)
l_todat1(4) type c, " Year
l_todat2(2) type c, " Month
l_todat3(3) type c. " Day
Get the material number from tables ZMSMI_FERR_RAW,
ZMSMI_SNAP_RAW and ZMSMI_SIMP_RAW
perform get_matnr.
Screen 0100.
perform bdc_screen using 'SAPMM60X' '0100'.
perform bdc_field using 'BDC_OKCODE' '/EBDPT'.
perform bdc_field using 'AM60X-MATAW' 'X'.
perform bdc_field using 'AM60X-MATNR' T_FILE-MATNR.
perform bdc_field using 'AM60X-PRGRP' SPACE.
perform bdc_field using 'AM60X-PBDNR' SPACE.
perform bdc_field using 'RM60X-BERID' T_FILE-BERID.
perform bdc_field using 'AM60X-WERKS' SPACE.
perform bdc_field using 'RM60X-VERSB' '00'.
Converted the date as per MD61 Transaction.
From date
l_frdat1 = p_date+0(4).
l_frdat2 = p_date+4(2).
l_frdat3 = p_date+6(2).
concatenate l_frdat2 l_frdat3 l_frdat1 into l_frdat.
To Date
l_tdate = p_date - 1.
l_todat1 = l_tdate+0(4) + 1.
l_todat2 = l_tdate+4(2).
l_todat3 = l_tdate+6(2).
concatenate l_todat2 l_todat3 l_todat1 into l_todat.
perform bdc_field using 'RM60X-DATVE' l_frdat.
perform bdc_field using 'RM60X-DATBE' l_todat.
perform bdc_field using 'RM60X-ENTLU' 'M'.
Screen 0127
perform bdc_screen using 'SAPMM60X' '0127'.
perform bdc_field using 'BDC_OKCODE' '=WEIT'.
if p_bedae is initial.
perform bdc_field using 'T459U-BEDAE' space.
else.
perform bdc_field using 'T459U-BEDAE' P_BEDAE.
endif.
Screen 0100.
perform bdc_screen using 'SAPMM60X' '0100'.
perform bdc_field using 'BDC_OKCODE' '/00'.
perform bdc_field using 'AM60X-MATAW' 'X'.
perform bdc_field using 'AM60X-MATNR' T_FILE-MATNR.
perform bdc_field using 'AM60X-PRGRP' SPACE.
perform bdc_field using 'AM60X-PBDNR' SPACE.
perform bdc_field using 'RM60X-BERID' T_FILE-BERID.
perform bdc_field using 'AM60X-WERKS' SPACE.
perform bdc_field using 'RM60X-VERSB' '00'.
perform bdc_field using 'RM60X-DATVE' l_frdat.
perform bdc_field using 'RM60X-DATBE' l_todat.
perform bdc_field using 'RM60X-ENTLU' 'M'.
Screen 0200
perform bdc_screen using 'SAPLM60E' '0200'.
perform bdc_field using 'BDC_OKCODE' '=S+'.
perform bdc_field using 'RM60X-PLN01(01)' T_FILE-PLNMG01.
perform bdc_screen using 'SAPLM60E' '0200'.
perform bdc_field using 'BDC_OKCODE' '=S+'.
perform bdc_field using 'RM60X-PLN01(01)' T_FILE-PLNMG02.
perform bdc_screen using 'SAPLM60E' '0200'.
perform bdc_field using 'BDC_OKCODE' '=S+'.
perform bdc_field using 'RM60X-PLN01(01)' T_FILE-PLNMG03.
perform bdc_screen using 'SAPLM60E' '0200'.
perform bdc_field using 'BDC_OKCODE' '=S+'.
perform bdc_field using 'RM60X-PLN01(01)' T_FILE-PLNMG04.
perform bdc_screen using 'SAPLM60E' '0200'.
perform bdc_field using 'BDC_OKCODE' '=S+'.
perform bdc_field using 'RM60X-PLN01(01)' T_FILE-PLNMG05.
perform bdc_screen using 'SAPLM60E' '0200'.
perform bdc_field using 'BDC_OKCODE' '=S+'.
perform bdc_field using 'RM60X-PLN01(01)' T_FILE-PLNMG06.
perform bdc_screen using 'SAPLM60E' '0200'.
perform bdc_field using 'BDC_OKCODE' '=S+'.
perform bdc_field using 'RM60X-PLN01(01)' T_FILE-PLNMG07.
perform bdc_screen using 'SAPLM60E' '0200'.
perform bdc_field using 'BDC_OKCODE' '=S+'.
perform bdc_field using 'RM60X-PLN01(01)' T_FILE-PLNMG08.
perform bdc_screen using 'SAPLM60E' '0200'.
perform bdc_field using 'BDC_OKCODE' '=S+'.
perform bdc_field using 'RM60X-PLN01(01)' T_FILE-PLNMG09.
perform bdc_screen using 'SAPLM60E' '0200'.
perform bdc_field using 'BDC_OKCODE' '=S+'.
perform bdc_field using 'RM60X-PLN01(01)' T_FILE-PLNMG10.
perform bdc_screen using 'SAPLM60E' '0200'.
perform bdc_field using 'BDC_OKCODE' '=S+'.
perform bdc_field using 'RM60X-PLN01(01)' T_FILE-PLNMG11.
perform bdc_screen using 'SAPLM60E' '0200'.
perform bdc_field using 'BDC_OKCODE' '=SICH'.
perform bdc_field using 'RM60X-PLN01(01)' T_FILE-PLNMG12.
ENDFORM. " bdc_build_script
*& Form get_matnr
Get the material number from tables ZMSMI_FERR_RAW,
ZMSMI_SNAP_RAW and ZMSMI_SIMP_RAW
FORM get_matnr.
clear v_matnr.
case t_file-werks.
when '0101'.
select single cmatnr from zmsmi_simp_raw
into v_matnr where matnr = t_file-matnr.
if sy-subrc eq 0.
clear t_file-matnr.
t_file-matnr = v_matnr.
endif.
when '0103'.
select single cmatnr from zmsmi_ferr_raw
into v_matnr where matnr = t_file-matnr.
if sy-subrc eq 0.
clear t_file-matnr.
t_file-matnr = v_matnr.
endif.
when '0102' or '0110' or '0111' or '0112' or '0113'
or '0114' or '0115' or '0116' or '0117'.
select single cmatnr from zmsmi_snap_raw
into v_matnr where matnr = t_file-matnr.
if sy-subrc eq 0.
clear t_file-matnr.
t_file-matnr = v_matnr.
endif.
endcase.
ENDFORM. " get_matnr
*& Form bdc_screen
BDC Script for Screen fields
-->P_PROG Program name
-->P_SCRN Screen Number
FORM bdc_screen USING p_prog
p_scrn.
clear itab_bdc_tab.
itab_bdc_tab-program = p_prog.
itab_bdc_tab-dynpro = p_scrn.
itab_bdc_tab-dynbegin = c_x.
append itab_bdc_tab.
ENDFORM. " bdc_screen
*& Form bdc_field
BDC Script for Screen fileds
-->P_NAM Field name
-->P_VAL Field value
FORM bdc_field USING p_nam
p_val.
clear itab_bdc_tab.
itab_bdc_tab-fnam = p_nam.
itab_bdc_tab-fval = p_val.
append itab_bdc_tab.
ENDFORM. " bdc_screen
*& Form bdc_submit_transaction
BDC_INSERT Function Module
FORM bdc_submit_transaction.
Load BDC script as a trqansction in BDC session
call function 'BDC_INSERT'
EXPORTING
tcode = c_tcode
TABLES
dynprotab = itab_bdc_tab
EXCEPTIONS
internal_error = 01
not_open = 02
queue_error = 03
tcode_invalid = 04.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
refresh itab_bdc_tab.
ENDFORM. " bdc_submit_transaction
*& Form bdc_session_close
text
FORM bdc_session_close.
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
NOT_OPEN = 1
QUEUE_ERROR = 2
OTHERS = 3
skip 2.
if sy-subrc ne 0.
write: / 'Error Closing BDC Session ' , 'RETURN CODE: ', sy-subrc.
else.
write : / 'Session created:', v_ssnname,
50 '# of transactions:', v_trans_in_ssn.
endif.
ENDFORM. " bdc_session_close
Reward Points if it is helpful
Thanks
Seshu -
Redirect service from http to https, session is lost
I have setup two web sites using NT 4.0 IIS so that both
"http://nossl/mybeanbeans" and "https://ssltest/mybeanbeans"
can execute the commerce server mybuybeans example.
Then I modify the shoppingCartDetail.jsp and commandAssembler.jsp
(files attached) hoping that when I click the "Checkout" button
on the Shopping Cart screen, it will redirect the service from
http to https.
The URL is redirected to "https" but it depicts the welcome page
instead of showing the Order Check Out page.
Previous session information is lost.
Can anyone help me?
Thanks
<!-- Copyright (c) 2000 by BEA Systems, Inc. All Rights Reserved. -->
<%@ page errorPage="../error.jsp" %>
<%@ page import="java.lang.reflect.*" %>
<%@ page import="theory.smartx.command.*" %>
<%@ page import="examples.buybeans.client.*" %>
<%@ page extends="com.beasys.commerce.portal.admin.PortalJspBase" %>
<%@ page implements="BuyBeansJspConstants" %>
<pt:monitorsession />
<%@ include file="monitorSessionTracker.jsp" %>
<%
// Get the Command class name to instantiate
String commandClassName = request.getParameter(COMMAND_CLASS_NAME_PARAM);
System.out.println("COMMAND_CLASS_NAME_PARAM : " + commandClassName);
if (commandClassName != null) {
// Get the BuyBeansSessionTracker
BuyBeansSessionTracker sessionTracker = (BuyBeansSessionTracker)session.getValue(com.beasys.commerce.portal.admin.PortalAdminHelper.qualifiedName(BUYBEANS_SESSION_TRACKER_KEY ,request));
// Construct an array of 1 element to hold the BuyBeansSessionTracker
// parameter type that the constructor takes.
Class constructorParamTypes[] = new Class[1];
constructorParamTypes[0] = sessionTracker.getClass();
try {
// Get the Class for the concrete Command
Class commandClass = Class.forName(commandClassName);
// Get constructor that takes the BuyBeansSessionTracker as argument
Constructor commandClassCtor = commandClass.getConstructor(constructorParamTypes);
// Set the BuyBeansSessionTracker argument for the constructor
Object ctorParams[] = new Object[1];
ctorParams[0] = sessionTracker;
// Create the instance of the concrete Command
Command command = (Command) commandClassCtor.newInstance(ctorParams);
// Pass the HttpRequest to the command so that it can
// read the parameter and then execute it.
command.assemble(request);
// Store the outstanding command in the session tracker so that
// the main portal page can execute it.
sessionTracker.setCommand(command);
setOverrideDestination(request, getHomePage(request));
%>
<%-- Added by Warren --%>
<%
String queryString = request.getQueryString();
String encodeURL=response.encodeURL(getTrafficURI(request));
String redirectURL=response.encodeRedirectURL("https://ssltest"+encodeURL);
System.out.println("====================");
System.out.println("queryString:" + queryString);
System.out.println("encodeURL:" + encodeURL);
System.out.println("redirectURL:" + redirectURL);
System.out.println("========before sendRedirect============");
response.sendRedirect(redirectURL);
System.out.println("========after sendRedirect============");
%>
<%
System.out.println("======== end commandAssemblerSSL ============");
catch (ClassNotFoundException cnfe) {
throw new ApplicationException(BUYBEANS_CATALOG_NAME, 600, cnfe);
catch (NoSuchMethodException nsme) {
throw new ApplicationException(BUYBEANS_CATALOG_NAME, 600, nsme);
catch (IllegalAccessException illegalAccessEx) {
throw new ApplicationException(BUYBEANS_CATALOG_NAME, 600, illegalAccessEx);
catch (IllegalArgumentException illegalArgEx) {
throw new ApplicationException(BUYBEANS_CATALOG_NAME, 600, illegalArgEx);
catch (InstantiationException ie) {
throw new ApplicationException(BUYBEANS_CATALOG_NAME, 600, ie);
catch (InvocationTargetException ite) {
throw new ApplicationException(BUYBEANS_CATALOG_NAME, 600, ite);
%>
<!-- Copyright (c) 2000 by BEA Systems, Inc. All Rights Reserved. -->
<%@ taglib uri="lib/wljsp.jar" prefix="wl" %>
<%@ taglib uri="lib/esportal.jar" prefix="pt" %>
<%@ page errorPage="../error.jsp" %>
<%@ page import="com.beasys.commerce.portal.Portlet" %>
<%@ page import="examples.buybeans.client.*" %>
<%@ page import="theory.smart.ebusiness.item.*" %>
<%@ page import="theory.smart.ebusiness.order.*" %>
<%@ page import="theory.smart.axiom.units.*" %>
<%@ page import="com.beasys.commerce.portal.tags.PortalTagConstants" %>
<%@ page extends="com.beasys.commerce.portal.admin.PortalJspBase"%>
<%@ page implements="BuyBeansJspConstants"%>
<pt:monitorsession />
<%@ include file="monitorSessionTracker.jsp" %>
<SCRIPT LANGUAGE="JavaScript">
<!--
function submitShoppingCartDetailsForm(commandClassName, bbContent)
document.ShoppingCartDetailForm.<%= COMMAND_CLASS_NAME_PARAM %>.value = commandClassName;
document.ShoppingCartDetailForm.<%= BUYBEANS_CONTENT_PARAM %>.value = bbContent;
document.ShoppingCartDetailForm.submit();
//-->
</SCRIPT>
<%
BuyBeansSessionTracker sessionTracker = (BuyBeansSessionTracker)getSessionValue( BUYBEANS_SESSION_TRACKER_KEY, request );
// Get the current Order
Order currOrder = sessionTracker.getEBusinessSession().getOrder();
// Get all the items in the cart as a Vector of orderlines from the session tracker
java.util.Vector orderLines = sessionTracker.getCartOrderLines();
%>
<!-- Display the items from the shopping cart -->
<table width="99%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr bgcolor=FFFFFF>
<td> </td>
<tr bgcolor="#FFFFFF">
<td>
<table width="95%" border="0" cellspacing="0" cellpadding="3" align="center" dwcopytype="CopyTableRow">
<tr>
<td colspan="6"><font face="Arial, Helvetica, Verdana, sans-serif"><%@ include file="contentMessages.jsp" %></font></td>
</tr>
<tr>
<td colspan="6"> <%= JspHelperBase.formatAsTitle("Shopping Cart - SSL*** ") %> </td>
</tr>
<tr>
<td><font face="Arial,Helvetica,sans-serif" color="#666600" size="2"><b>Product ID</b></font></td>
<td><font face="Arial,Helvetica,sans-serif" color="#666600" size="2"><b>Description</b></font></td>
<td><font face="Arial,Helvetica,sans-serif" color="#666600" size="2"><b>Quantity</b></font></td>
<td align="right"><font face="Arial,Helvetica,sans-serif" color="#666600" size="2"><b>Price</b></font></td>
<td align="right"><font face="Arial,Helvetica,sans-serif" color="#666600" size="2"><b>Subtotal</b></font></td>
<td></td>
</tr>
<form method="get" name="ShoppingCartDetailForm" action="<%= response.encodeURL(getTrafficURI(request)) %>" >
<%
// Declare a currency format type
Quantity one = QuantityHome.create();
one.setCount(1);
// Print out all the items in the cart
for(int i = 0; i<orderLines.size(); i++ ) {
OrderLine currOrderLine = (OrderLine)orderLines.elementAt(i);
Item myItem = currOrderLine.getItem();
ItemValue iv = myItem.getItemByValue();
String desc = iv.description;
String id = iv.identifier;
// Specify the color of the row
String rowColor = (i%2 == 0) ? ROW_BACKGROUND_COLOR_1 : ROW_BACKGROUND_COLOR_2 ;
// Specify the name of the quantity text field - name it as qty+i
String qtyInputName = ORDER_QUANTITY + i;
// Specify the name of the remove checkbox
String removeInputName = REMOVE_CHECKED + i;
%>
<!-- print out the details of each item -->
<tr bgcolor="<%= rowColor %>">
<td><%= id %></td>
<td><%= desc %></td>
<td>
<input type="text" name="<%= qtyInputName %>" size=3 maxlength=3 value= "<%= JspHelperBase.formatQuantityAsInteger(currOrderLine.getQuantity()) %>" >
</td>
<td align="right"><%= JspHelperBase.formatPriceAsCurrency(myItem.calculatePrice(one, null)) %></td>
<td align="right"><%= JspHelperBase.formatPriceAsCurrency(currOrderLine.getLinePrice(null)) %></td>
<td><input type="checkbox" name="<%= removeInputName %>" value="<%=REMOVE_CHECKED %>" > Remove </td>
</tr>
<%
%>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td align="right"> <font face="Arial,Helvetica,sans-serif" size="3" color="#666600"><b>Total:</b></font></td>
<td>
<div align="right"><font face="Arial, Helvetica, sans-serif" size="3" color="#990000"><b><%= JspHelperBase.formatPriceAsCurrency(currOrder.getTotalPrice()) %>
</b> </font> </div>
</td>
<td>
<input type="button" name="<%=UPDATE_CART_BUTTON %>"
onClick="submitShoppingCartDetailsForm('examples.buybeans.client.UpdateShoppingCartCommand', '<%= SHOPPING_CART_DETAILS_JSP %>')"
value="Update">
</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td>
<input type="button" name="<%=CHECKOUT_BUTTON %>"
onClick="submitShoppingCartDetailsForm('examples.buybeans.client.CheckOutCommand', '<%= CHECKOUT_JSP %>')"
value="Checkout">
</td>
</tr>
<tr colspan="6">
<td> </td>
</tr>
<%-- DESTINATION_TAG is required because the form action goes to getTrafficURI() --%>
<%-- In this case, the destination is the command assembler --%>
<%-- <input type=hidden name="<%= DESTINATION_TAG %>" value="<%= COMMAND_ASSEMBLER_JSP %>"> --%>
<%-- The following line is used for testing SSL redirect --%>
<input type=hidden name="<%= DESTINATION_TAG %>" value="/portals/buybeans/portlets/commandAssemblerSSL.jsp" >
<%-- The following two parameters are set by the JavaScript function based --%>
<%-- on the button that the user presses (default value are provided ) --%>
<input type=hidden name="<%= BUYBEANS_CONTENT_PARAM %>" value="<%= SHOPPING_CART_DETAILS_JSP %>">
<input type=hidden name="<%= COMMAND_CLASS_NAME_PARAM %>" value="examples.buybeans.client.UpdateShoppingCartCommand">
</form>
</table>
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
the problem is when the cookie is exchanged between the browser
and the app server IE treats request coming from http://bc.com:7001
and http://bc.com:7002 as one and the same : so the browser maintains
the same session but netscape treats this as responses coming from two
different servers and hence u lost the session.
I assume u are having this problem with netscape and not IE.
the solution is set this property in the weblogic.properties file
weblogic.httpd.session.cookie.domain=.bc.com
-Sumanth
"senthil ramiah" <[email protected]> wrote in message
news:[email protected]...
>
> Hi,
> Did you receive any replies for this question.
> thanx
> senthil
>
> Warren Li <[email protected]> wrote:
> >
> >I have setup two web sites using NT 4.0 IIS so that both
> > "http://nossl/mybeanbeans" and "https://ssltest/mybeanbeans"
> >can execute the commerce server mybuybeans example.
> >
> > Then I modify the shoppingCartDetail.jsp and commandAssembler.jsp
> > (files attached) hoping that when I click the "Checkout" button
> > on the Shopping Cart screen, it will redirect the service from
> > http to https.
> >
> >The URL is redirected to "https" but it depicts the welcome page
> > instead of showing the Order Check Out page.
> > Previous session information is lost.
> >
> >Can anyone help me?
> >
> >Thanks
> >
> >
> >
> ><!-- Copyright (c) 2000 by BEA Systems, Inc. All Rights Reserved. -->
> >
> ><%@ page errorPage="../error.jsp" %>
> ><%@ page import="java.lang.reflect.*" %>
> ><%@ page import="theory.smartx.command.*" %>
> ><%@ page import="examples.buybeans.client.*" %>
> >
> ><%@ page extends="com.beasys.commerce.portal.admin.PortalJspBase" %>
> ><%@ page implements="BuyBeansJspConstants" %>
> >
> ><pt:monitorsession />
> >
> ><%@ include file="monitorSessionTracker.jsp" %>
> >
> ><%
> > // Get the Command class name to instantiate
> > String commandClassName =
request.getParameter(COMMAND_CLASS_NAME_PARAM);
> > System.out.println("COMMAND_CLASS_NAME_PARAM : " + commandClassName);
> > if (commandClassName != null) {
> >
> > // Get the BuyBeansSessionTracker
> > BuyBeansSessionTracker sessionTracker =
(BuyBeansSessionTracker)session.getValue(com.beasys.commerce.portal.admin.Po
rtalAdminHelper.qualifiedName(BUYBEANS_SESSION_TRACKER_KEY ,request));
> >
> > // Construct an array of 1 element to hold the
BuyBeansSessionTracker
> > // parameter type that the constructor takes.
> > Class constructorParamTypes[] = new Class[1];
> > constructorParamTypes[0] = sessionTracker.getClass();
> >
> > try {
> > // Get the Class for the concrete Command
> > Class commandClass = Class.forName(commandClassName);
> >
> > // Get constructor that takes the BuyBeansSessionTracker as
argument
> > Constructor commandClassCtor =
commandClass.getConstructor(constructorParamTypes);
> >
> > // Set the BuyBeansSessionTracker argument for the constructor
> > Object ctorParams[] = new Object[1];
> > ctorParams[0] = sessionTracker;
> >
> > // Create the instance of the concrete Command
> > Command command = (Command)
commandClassCtor.newInstance(ctorParams);
> >
> > // Pass the HttpRequest to the command so that it can
> > // read the parameter and then execute it.
> > command.assemble(request);
> >
> > // Store the outstanding command in the session tracker so that
> > // the main portal page can execute it.
> > sessionTracker.setCommand(command);
> > setOverrideDestination(request, getHomePage(request));
> >%>
> >
> ><%-- Added by Warren --%>
> ><%
> > String queryString = request.getQueryString();
> > String encodeURL=response.encodeURL(getTrafficURI(request));
> > String
redirectURL=response.encodeRedirectURL("https://ssltest"+encodeURL);
> > System.out.println("====================");
> > System.out.println("queryString:" + queryString);
> > System.out.println("encodeURL:" + encodeURL);
> > System.out.println("redirectURL:" + redirectURL);
> > System.out.println("========before sendRedirect============");
> > response.sendRedirect(redirectURL);
> > System.out.println("========after sendRedirect============");
> >%>
> >
> ><%
> > System.out.println("======== end commandAssemblerSSL ============");
> > }
> > catch (ClassNotFoundException cnfe) {
> > throw new ApplicationException(BUYBEANS_CATALOG_NAME, 600, cnfe);
> > }
> > catch (NoSuchMethodException nsme) {
> > throw new ApplicationException(BUYBEANS_CATALOG_NAME, 600, nsme);
> > }
> > catch (IllegalAccessException illegalAccessEx) {
> > throw new ApplicationException(BUYBEANS_CATALOG_NAME, 600,
illegalAccessEx);
> > }
> > catch (IllegalArgumentException illegalArgEx) {
> > throw new ApplicationException(BUYBEANS_CATALOG_NAME, 600,
illegalArgEx);
> > }
> > catch (InstantiationException ie) {
> > throw new ApplicationException(BUYBEANS_CATALOG_NAME, 600, ie);
> > }
> > catch (InvocationTargetException ite) {
> > throw new ApplicationException(BUYBEANS_CATALOG_NAME, 600, ite);
> > }
> > }
> >
> >%>
> >
> >
> ><!-- Copyright (c) 2000 by BEA Systems, Inc. All Rights Reserved. -->
> >
> ><%@ taglib uri="lib/wljsp.jar" prefix="wl" %>
> ><%@ taglib uri="lib/esportal.jar" prefix="pt" %>
> >
> ><%@ page errorPage="../error.jsp" %>
> ><%@ page import="com.beasys.commerce.portal.Portlet" %>
> ><%@ page import="examples.buybeans.client.*" %>
> ><%@ page import="theory.smart.ebusiness.item.*" %>
> ><%@ page import="theory.smart.ebusiness.order.*" %>
> ><%@ page import="theory.smart.axiom.units.*" %>
> ><%@ page import="com.beasys.commerce.portal.tags.PortalTagConstants" %>
> >
> ><%@ page extends="com.beasys.commerce.portal.admin.PortalJspBase"%>
> ><%@ page implements="BuyBeansJspConstants"%>
> >
> >
> ><pt:monitorsession />
> >
> ><%@ include file="monitorSessionTracker.jsp" %>
> >
> ><SCRIPT LANGUAGE="JavaScript">
> ><!--
> >function submitShoppingCartDetailsForm(commandClassName, bbContent)
> >{
> > document.ShoppingCartDetailForm.<%= COMMAND_CLASS_NAME_PARAM %>.value
= commandClassName;
> > document.ShoppingCartDetailForm.<%= BUYBEANS_CONTENT_PARAM %>.value =
bbContent;
> > document.ShoppingCartDetailForm.submit();
> >}
> >//-->
> ></SCRIPT>
> >
> ><%
> > BuyBeansSessionTracker sessionTracker =
(BuyBeansSessionTracker)getSessionValue( BUYBEANS_SESSION_TRACKER_KEY,
request );
> >
> > // Get the current Order
> > Order currOrder = sessionTracker.getEBusinessSession().getOrder();
> >
> > // Get all the items in the cart as a Vector of orderlines from the
session tracker
> > java.util.Vector orderLines = sessionTracker.getCartOrderLines();
> >%>
> >
> >
> ><!-- Display the items from the shopping cart -->
> > <table width="99%" border="0" cellspacing="0" cellpadding="0"
align="center">
> > <tr bgcolor=FFFFFF>
> > <td> </td>
> > <tr bgcolor="#FFFFFF">
> > <td>
> > <table width="95%" border="0" cellspacing="0" cellpadding="3"
align="center" dwcopytype="CopyTableRow">
> > <tr>
> > <td colspan="6"><font face="Arial, Helvetica, Verdana,
sans-serif"><%@ include file="contentMessages.jsp" %></font></td>
> > </tr>
> > <tr>
> > <td colspan="6"> <%= JspHelperBase.formatAsTitle("Shopping
Cart - SSL*** ") %> </td>
> > </tr>
> > <tr>
> > <td><font face="Arial,Helvetica,sans-serif" color="#666600"
size="2"><b>Product ID</b></font></td>
> > <td><font face="Arial,Helvetica,sans-serif" color="#666600"
size="2"><b>Description</b></font></td>
> > <td><font face="Arial,Helvetica,sans-serif" color="#666600"
size="2"><b>Quantity</b></font></td>
> > <td align="right"><font face="Arial,Helvetica,sans-serif"
color="#666600" size="2"><b>Price</b></font></td>
> > <td align="right"><font face="Arial,Helvetica,sans-serif"
color="#666600" size="2"><b>Subtotal</b></font></td>
> > <td></td>
> > </tr>
> >
> > <form method="get" name="ShoppingCartDetailForm" action="<%=
response.encodeURL(getTrafficURI(request)) %>" >
> > <%
> > // Declare a currency format type
> > Quantity one = QuantityHome.create();
> > one.setCount(1);
> >
> > // Print out all the items in the cart
> > for(int i = 0; i<orderLines.size(); i++ ) {
> > OrderLine currOrderLine =
(OrderLine)orderLines.elementAt(i);
> > Item myItem = currOrderLine.getItem();
> > ItemValue iv = myItem.getItemByValue();
> > String desc = iv.description;
> > String id = iv.identifier;
> >
> > // Specify the color of the row
> > String rowColor = (i%2 == 0) ? ROW_BACKGROUND_COLOR_1 :
ROW_BACKGROUND_COLOR_2 ;
> >
> > // Specify the name of the quantity text field - name
it as qty+i
> > String qtyInputName = ORDER_QUANTITY + i;
> >
> > // Specify the name of the remove checkbox
> > String removeInputName = REMOVE_CHECKED + i;
> >
> >
> > %>
> > <!-- print out the details of each item -->
> > <tr bgcolor="<%= rowColor %>">
> > <td><%= id %></td>
> > <td><%= desc %></td>
> > <td>
> > <input type="text" name="<%= qtyInputName %>" size=3
maxlength=3 value= "<%=
JspHelperBase.formatQuantityAsInteger(currOrderLine.getQuantity()) %>" >
> > </td>
> > <td align="right"><%=
JspHelperBase.formatPriceAsCurrency(myItem.calculatePrice(one, null))
%></td>
> > <td align="right"><%=
JspHelperBase.formatPriceAsCurrency(currOrderLine.getLinePrice(null))
%></td>
> > <td><input type="checkbox" name="<%= removeInputName %>"
value="<%=REMOVE_CHECKED %>" > Remove </td>
> > </tr>
> > <%
> > }
> > %>
> > <tr>
> > <td> </td>
> > <td> </td>
> > <td> </td>
> > <td align="right"> <font face="Arial,Helvetica,sans-serif"
size="3" color="#666600"><b>Total:</b></font></td>
> > <td>
> > <div align="right"><font face="Arial, Helvetica,
sans-serif" size="3" color="#990000"><b><%=
JspHelperBase.formatPriceAsCurrency(currOrder.getTotalPrice()) %>
> > </b> </font> </div>
> > </td>
> > <td>
> > <input type="button" name="<%=UPDATE_CART_BUTTON %>"
> >
onClick="submitShoppingCartDetailsForm('examples.buybeans.client.UpdateShopp
ingCartCommand', '<%= SHOPPING_CART_DETAILS_JSP %>')"
> > value="Update">
> > </td>
> > </tr>
> > <tr>
> > <td> </td>
> > <td> </td>
> > <td> </td>
> > <td> </td>
> > <td> </td>
> > <td>
> > <input type="button" name="<%=CHECKOUT_BUTTON %>"
> >
onClick="submitShoppingCartDetailsForm('examples.buybeans.client.CheckOutCom
mand', '<%= CHECKOUT_JSP %>')"
> > value="Checkout">
> > </td>
> > </tr>
> > <tr colspan="6">
> > <td> </td>
> > </tr>
> >
> > <%-- DESTINATION_TAG is required because the form action goes
to getTrafficURI() --%>
> > <%-- In this case, the destination is the command
--%>
> ><%-- <input type=hidden name="<%= DESTINATION_TAG %>" value="<%=
COMMAND_ASSEMBLER_JSP %>"> --%>
> >
> > <%-- The following line is used for testing SSL redirect --%>
> > <input type=hidden name="<%= DESTINATION_TAG %>"
value="/portals/buybeans/portlets/commandAssemblerSSL.jsp" >
> >
> > <%-- The following two parameters are set by the JavaScript
function based --%>
> > <%-- on the button that the user presses (default value are
provided ) --%>
> > <input type=hidden name="<%= BUYBEANS_CONTENT_PARAM %>"
value="<%= SHOPPING_CART_DETAILS_JSP %>">
> > <input type=hidden name="<%= COMMAND_CLASS_NAME_PARAM %>"
value="examples.buybeans.client.UpdateShoppingCartCommand">
> >
> > </form>
> > </table>
> > </td>
> > </tr>
> > <tr>
> > <td> </td>
> > </tr>
> ></table>
> >
>
-
How to view and change HTTP Session Size
For the SAP Web AS Java, how can i check what size is set for the http session object?
Thanks,
HarisHey Vincert,
Is that parameter maintained on the ABAP stack or the Java stack.
Specifically i would like to know if the HTTP session object size is viewable/modifiable for Portal (hence standalone Java stack). I believe Portal does not have ICM.
Thanks,
Haris -
In-memory replication of http session is not working in BEA7 cluster
Hi everyone,
I have 3 managed servers in Bea7.0 SP4 in a cluster. The client requests are sent
through apache web server. I have given cluster address as URL in httpd.conf of
apache server which sends the client requests for dynamic pages such as JSPs and
servlets to the weblogic cluster.
Load balancing is working fine. I ensured this from the log files of all the 3
servers. All the 3 servers are getting different client requests and thus load
balancing is working.
Now, I wanted to achieve Fail-over. I do not think that i should use proxy plug-in
for this. I feel the cluster itself will handle fail-over provided i make the
http session as memory replicated.
I updated the weblogic.xml with the following entry :
<session-descriptor>
<param-name>PersistentStoreType</param-name>
<param-value>replicated</param-value>
</session-param>
</session-descriptor>
I guess this is sufficient to make the http session as cluster aware.
But when I shutdown server1, the user connected to server1 will be kicked out
of the session and come to login page through server2 or server3 which are running
fine.
Could anyone help me to achieve http session as cluster aware. Does it indicate
that I have to go for WLS proxy – HttpClusterServlet to achieve fail over for
http session ?
BTW, for your info, i am using setAttribute() and getAttribute() while manipulating
the session.
thanks in advance.
Hi Ryan,
Thanks for ur valuable input.
I can see failover working.
But, I can not continue with the same session in my application.
I printed session Ids before and after failover, I found both are different.
I guess session replication is a responsibility of weblogic/apache plugin.
If not please let me know which all settings I should do to make failover working?
Thanks again.
Plad
"ryan upton" <ryanjupton at learningvoyage dot com> wrote:
>Plad,
>
>Are you trying to gracefully shut down the server? If you are then the
>problem that you say you can't identify is simply the server's default
>behavior which is to wait for all non-replicated sessions to be dropped
>or
>timed out before killing the process. Try forcing the shutdown: kill
>-9 the
>PID or CTRL-C if you started the server from the command line. You can
>also
>check the ``Ignore Sessions During Shutdown" checkbox under the server's
>control tab in the admin console, this should allow you to shut down
>gracefully without waiting for session timeout. BTW your sequence is
>off
>in #5 below, the replication doesn't occur upon failure, the replication
>has
>already happened once you created the session object on the first server,
>I
>think maybe you're confusing replication with failover.
>
>~RU
>
>"Plad" <[email protected]> wrote in message
>news:[email protected]...
>>
>> Hi,
>> I have 2 managed servers in a cluster.
>>
>> 1. I have got a DNS name configured which maps to these 2 managed server's
>IP
>> addresses.
>> 2. I can browse my site using this DNS name.
>> In HTTPD.conf I have :
>>
>> ServerName dev.a.b.net
>>
>> <IfModule mod_weblogic.c>
>> WebLogicCluster 10.1.38.232:7023,10.1.34.51:7023
>> MatchExpression *.*
>> </IfModule>
>>
>> LoadModule weblogic_module modules/mod_wl_20.so
>>
>> 3. I have adeded session descriptor in weblogic.xml , also enabled
>proxy
>plugin
>> in weblogic console.
>>
>> 4. I tested accessing my application using DNS url after shutting down
>alternatively
>> each manaed server. I can access application.
>>
>> 5. Now, problem comes when I access a managed server1 , keeping server2
>down.
>> I am able to access my application.
>> Now, I start the server2.
>> (Here I am supposing that replication should occur)
>> Then I am shutting down server1.
>> But, this time the server log shows me following:
>>
>>
>> 9:58:51 AM GMT+05:30 NOTICE Web application(s) chlist still have
>non-replicated
>> sessions after 2 minutes of initiating SUSPEND. Waiting for non-replicated
>sessions
>> to finish.
>> 10:00:51 AM GMT+05:30 NOTICE Web application(s) chlist still have
>non-replicated
>> sessions after 4 minutes of initiating SUSPEND. Waiting for non-replicated
>sessions
>> to finish.
>>
>> I am unable to make out where the problem is?
>> Can it be a problem of Liecense? Is there any specialcluster liecense
>for
>weblogic8?
>>
>> Hoping to get replies.
>> Thanx.
>> Plad
>>
>> "ryan upton" <ryanjupton at learningvoyage dot com> wrote:
>> >See my reply to your first post, but I've also added a few comments
>here.
>> >
>> >"jyothi" <[email protected]> wrote in message
>> >news:[email protected]...
>> >>
>> >> I guess someone from bea support team only can answer both your
>question
>> >and mine.
>> >> As per my knowledge, we do not need to do any setup at Apache
>side
>> >regarding
>> >> cluster other than mentioning cluster address as URL while
>contacting
>> >WLS
>> >> from apache.
>> >>
>> >> I hope someone from Bea, will help us. I do not think that we
>> >go for
>> >WLS
>> >> proxy plug-in using HttpClusterServlet for making session replication.
>> > I
>> >strongly
>> >> feel that the cluster itself be able to manage the fail-over of
>> >http
>> >sessions
>> >> provided we put the entry "PersistentStoreType" in weblogic.xml
>> >regarding
>> >> the session replication.
>> >>
>> >
>> >The cluster does handle the management of Sessions. The clustered
>> >applications still create the Session objects and the cluster manages
>> >them
>> >as per your deployment descriptor settings (replicated, JDBC, File)
>however
>> >the proxy has to be aware of which server the client has an affinity
>> >for
>> >(only with replicated sessions) and it does that by reading a cookie
>> >passed
>> >back from the server that handled the initial request and created
>the
>> >primary session object. The proxy has a list of both the primary
>and
>> >secondary server locations from this cookie that it can use to failover
>> >the
>> >request if the primary server fails. Clusters _DO NOT_ failover nor
>> >do they
>> >load balance, that's the job of your proxy, whether you're using the
>> >HTTPClusterServlet, WLS Plug-in or a more sophisticated hardware load
>> >balancer like Big IPs F5
>> >
>> >> jyothi
>> >>
>> >
>> >~RU
>> >
>> >
>>
>
>
-
How to open 2 HttpURLConnections in the same session
Dear,
I'm writing a client application that use HTTP GET request to get infomation from a web-server. Before getting any infomation, the web-client need to login.
When using the browser, I can't get infomation through these steps:
First, go to the URL login.jsp?username=myUser. This username will be keep in the http session variables. Then, I can get info through the page getinfo.jsp.
Now, I want to do these steps in my java client app. My code is as follow:
URL url = new URL("http://myhost:8080/test/login.jsp?username=myUser");
HttpURLConnection urlCon = (HttpURLConnection)url.openConnection();
url = new URL("http://myhost:8080/test/getinfo.jsp");
urlCon = (HttpURLConnection)url.openConnection();I known that the session variables were lost between two openConnection() method.
So, how can I keep my session variables? (I have no permission to change code of the server).
Please help me!
Thanks!Sorry - I missed the point about not having permissions on the server.
In that case, I would try working out how the site normally tracks the session. If it inserts a sessionId in to every link, you need to include that in your request to getInfo.jsp.
If it uses cookies, look at the headers for a field named "Set-Cookie":
for (int i=0; ; i++) {
String headerFieldKey = conn.getHeaderFieldKey(i);
if ("Set-Cookie".equalsIgnoreCase(headerFieldKey)) {
}Then use setRequestProperty() to send the same cookie (proably the username or a session id) to getInfo.jsp. I think that will work.
Make sure you ask the site owner if you are using this for harvesting content!
--Jon -
Define HTTP Session Attribute in a Custom Authenticator
Hello everyone I developed sucessefully a Custom Authenticator for WLS10 that interacts with a web service.
But now I need to provide an object to the web applications with the some user information.
I was wondering defining the object in the HTTP Session but I dont know how to do it via de LoginModule of the custom authenticator.
Can anyone provide me some tips?
thanks in advance.What kind of user information do you need to pass on to the webapplication ? username can be retrieved by request.getRemoteUser() (after successful login).
May be you need to clarify little bit more on what you want to achieve.
-Utpal -
Model session not in sync with Http Session
Hi All,
I have an application developed in JDev 11.1.1.4 and we are not using ADF Security for login.
The problem occurring is randomly some of the LOV on my home page are getting null (having no data). These LOVs are populated using the values passed as bind parameter from the login values (basically HTTP session values at web layer). So i added a method in all the task flow to set the session value at the model layer (default method) . Also on each call to the Am Impl call i am setting the value in the HTTP session and then invoking the method, but some how what happens is the Model level session value is not in sync with HTTP session and the list gets empty.
Any inputs what i can do to get out of this prblm ?
thnkIn this case you need to overwrite the activateState/passivateState method of your am and store/reads the values from the xml structure you get as parameters to this methods.
For more detailed information check the docs http://download.oracle.com/docs/cd/E12839_01/web.1111/b31974/bcstatemgmt.htm#sm0495
By the way, this is nothing you need to open an SR on as it's working as designed.
Timo -
How can I flag HTTP session attributes to not be replicated ?
WLS 5.1 SP8 - In memory replication of a stateful servlet. Is
there any way to flag data that has been, or is being, loaded into
a HTTP session so as to not be replicated ? It's a long story,
but we have some data loaded into a hashtable, more specifically
a Properties object, stored in our session. With the hastable
already loaded into the HTTP session, weblogic does not detect
when we add values to the table, and therefore does not replicate
the changes. Which is ok since WLS is working as designed. To
get around this we load the hashtable back into the session everytime
we add a value to the hashtable. Yup, I know that's ugly. Anyway,
what I'm trying to find out if is there is an attribute that we
can set to indicate, to not replicate this data or that data.
Something along the lines of a attribute on a per hastable value
basis. For example, I load value A into my hashtable, then I
need to put my hashtable into the session to get it replicated.
Next I load value B into the hastable, and again to get it replicated
I have to load the entire hashtable back into the session. The
problem here is that the entire table gets replciated. Does anyone
know if I can set an attribute on value A, when I'm adding value
B, so as to not replicate value A when I reload the table ? Of
course all goal is to not store so much data in the session, but
I'm trying to find a work around until that is completed.
Thanks,
David
Where can I find documentation on the details of how Weblogic decides what will
be replicated in the HTTPSession object (for example, it only replicates attributes
which are set or updated using "setAttribute()"?
Prasad Peddada <[email protected]> wrote:
>Robert,
>
> It is true that we replicate only when you call setAttribute in case
>of servlets.
>
>In case of EJB it is slightly different. EJB sends diff's across the
>wire. It doesn't
>replicate the entire state with every request.
>
>-- Prasad
>
>Chris Palmer wrote:
>
>> I think Viresh was referring to modifying part of one attribute causing
>the whole
>> of that attribute (i.e. the hashtable) to be replicated.
>>
>> Is it actually true though that the behaviour would be different in
>a stateful
>> session EJB? I had assumed that the WHOLE ejb state would be replicated
>each time
>> (i.e. after each invocation), without even the benefit of having a
>mechanism such
>> as setAttribute() to flag the attributes that had changed...
>>
>> Chris
>>
>> Robert Patrick wrote:
>>
>> ? Huh? Since when does it always replicate the entire HttpSession?
> We were
>> ? told that it uses a hook in the setAttribute() call to determine
>which
>> ? attributes have changed and only replicates those attributes. I
>know this to
>> ? be the case because if I retrieve a previously stored attribute from
>the
>> ? HttpSession and modify it, my changes do not get replicated unless
>I call
>> ? setAttribute again...
>> ?
>> ? Robert
>> ?
>> ? Viresh Garg wrote:
>> ?
>> ? ? Servlet sessions don't work on diffs, so no matter what you do,
>entire
>> ? ? Hashtable will be replicated. If you want the optimization for
>only
>> ? ? replicating the diff ( the stuff that has changed between 2 updates)
>,
>> ? ? consider using stateful session bean and having hashtable part
>of
>> ? ? conversational state of stateful session bean.
>> ? ?
>> ? ? The solution that you suggested on your own for your problem is
>not ugly
>> ? ? as the same solution is used by many customers that I know of.
>This is
>> ? ? particularly a problem for people that use Java Beans and use the
>set
>> ? ? Property directive of Java Bean in JSP. There also in our auto
>generated
>> ? ? code, we put the JavaBean back in HTTP Session, when a setter is
>called to
>> ? ? enforce replication.
>> ? ?
>> ? ? Keep in mind that whatever we do for replication, we want to support
>it
>> ? ? using ONLY standard servlet API and we don't want to introduce
>any WLS
>> ? ? specific API to achieve this, and so putting value back in session
>is the
>> ? ? only way.
>> ? ?
>> ? ? Viresh Garg
>> ? ? Principal Developer Relations Engineer
>> ? ? BEA Systems
>> ? ?
>> ? ? Dave Javu wrote:
>> ? ?
>> ? ? ? WLS 5.1 SP8 - In memory replication of a stateful servlet.
>Is
>> ? ? ? there any way to flag data that has been, or is being, loaded
>into
>> ? ? ? a HTTP session so as to not be replicated ? It's a long story,
>> ? ? ? but we have some data loaded into a hashtable, more specifically
>> ? ? ? a Properties object, stored in our session. With the hastable
>> ? ? ? already loaded into the HTTP session, weblogic does not detect
>> ? ? ? when we add values to the table, and therefore does not replicate
>> ? ? ? the changes. Which is ok since WLS is working as designed.
>To
>> ? ? ? get around this we load the hashtable back into the session everytime
>> ? ? ? we add a value to the hashtable. Yup, I know that's ugly.
>Anyway,
>> ? ? ? what I'm trying to find out if is there is an attribute that
>we
>> ? ? ? can set to indicate, to not replicate this data or that data.
>> ? ? ? Something along the lines of a attribute on a per hastable value
>> ? ? ? basis. For example, I load value A into my hashtable, then
>I
>> ? ? ? need to put my hashtable into the session to get it replicated.
>> ? ? ? Next I load value B into the hastable, and again to get it replicated
>> ? ? ? I have to load the entire hashtable back into the session. The
>> ? ? ? problem here is that the entire table gets replciated. Does
>anyone
>> ? ? ? know if I can set an attribute on value A, when I'm adding value
>> ? ? ? B, so as to not replicate value A when I reload the table ?
>Of
>> ? ? ? course all goal is to not store so much data in the session,
>but
>> ? ? ? I'm trying to find a work around until that is completed.
>> ? ? ? Thanks,
>> ? ? ? David
>
-
Use HTTP Session to pass Object from Web Dynpro for Java to JSP page
Is it possible to get a handle on the HTTP Session object from within a Web Dynpro application? I want to place a Java object in there that can be retrieved by a JSP page.
Thanks in advance.Hi Tom Cole,
You can try this. i am not sure if this will work or not.
HttpServletRequest request = ((IWebContextAdapter) WDWebContextAdapter.getWebContextAdapter()).getHttpServletRequest();
You can also try this.
IWDRequest mm_request = WDProtocolAdapter.getProtocolAdapter().getRequestObject();
HttpServletRequest request = (HttpServletRequest)mm_request.getProtocolRequest();
IWDRequest basically wraps the HttpServletRequest. if you are using NW04s then the getProtocolRequest() may not be available.
Regards,
Sanyev -
Hi,
I want to know how to work with the HTTP Session object in
Flex 2?
Piece of code is really appreciable.
Thanks,
-SameerCheck out the example from the docs:
http://livedocs.macromedia.com/flex/2/langref/mx/rpc/http/mxml/HTTPService.html#includeExa mplesSummary
That should get you started... -
HTTP Session caching possible using WL7 JAX-RPC ?
We're using WL7, and using the JAX-RPC API to access external webservices.
Basically, we create the appropriate 'stubs' from the target WSDL using
clientgen. Then we invoke the target method. Code looks something like this:
Client_Impl client = new Client_Impl; // implementation of target
ClientPort_Stub stub = client.getClientPort();
stub._setProperty(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY, url)
stub.invoke(args);
Now, when is the actual endpoint URL being created ? Is it when the invoke()
method is called ?
It cannot be during the constructor since I pass the target URL after that ...
My problem is that I have to call the 'invoke' method quite frequently, and hence
would like the HTTP session to be reused, rather than recreated each time. Right
now,
I construct the stub each time I have to call the target method, and I'm wondering
if
I just cache the stub and keep calling the target method each time, will the underlying
HTTP session be reused ? Any ideas ?
Currently, if I do netstat on my Sun Solaris box (where this runs), I see the
TCP
connection being recreated during each invocation ...
-johnHi John,
You can do multiple invokes on the same stub. There is no
need to create a new one for each invoke.
WLS 7.0 use HTTP 1.0 with keep alive. If the server respects
HTTP keep alive, then WLS will not create a new connection.
HTHs,
-manoj
"john" <[email protected]> wrote in message news:[email protected]..
>
We're using WL7, and using the JAX-RPC API to access external webservices.
Basically, we create the appropriate 'stubs' from the target WSDL using
clientgen. Then we invoke the target method. Code looks something likethis:
>
Client_Impl client = new Client_Impl; // implementation of target
ClientPort_Stub stub = client.getClientPort();
stub._setProperty(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY, url)
stub.invoke(args);
Now, when is the actual endpoint URL being created ? Is it when theinvoke()
method is called ?
It cannot be during the constructor since I pass the target URL after that...
My problem is that I have to call the 'invoke' method quite frequently,and hence
would like the HTTP session to be reused, rather than recreated each time.Right
now,
I construct the stub each time I have to call the target method, and I'mwondering
if
I just cache the stub and keep calling the target method each time, willthe underlying
HTTP session be reused ? Any ideas ?
Currently, if I do netstat on my Sun Solaris box (where this runs), I seethe
TCP
connection being recreated during each invocation ...
-john
Maybe you are looking for
-
Strange clicking noise from hard drive
My drive just started making this noise in my MBP today. Never heard this before. My drive has always been very quiet. Now ever couple to few seconds I'm hearing this click-like noise. No performance issues yet but I work on computers for a living an
-
How to use currency format set
Hi All, I have to use currency format set to mask the amount values to their respective currencies , i reviewed the Oracle XML Publisher Administration and Developer's Guide and followed all the steps mentioned there ,i m also quoting the same over h
-
3D Object in PDF (Reader for iOS)
I have an embedded U3D object in a PDF. When I open the PDF in Adobe Reader for iOS, the model is seen, but I cannot rotate it or zoom in on it. Are 3d models embedded in a PDF supported? Thanks!
-
How do I get a Download icon into my dock?
I used to be able to see a folder of Downloads in my dock. It isn't there anymore and I want to get it back. I tried to go into Applications and look for a Download icon to drag into the dock, but I didnt see anything called Downloads. Any suggest
-
Hello Gurus, I am getting error while executing vf01. The error says : Document # saved (no accounting document generated). I have checked billing document F2- Tcode VOFA,in which the number range is given as 19 for the year 2004, So I have created n