URL Redirection from portal component
I have created portal component. I want to
How to redirect request from jsp to external url
Following is my jsp code
<%
String url = "http://abc.com/";
url = url + componentRequest.getComponentSession().getValue("loginid").toString();
%>
<%= url %>
i am able to see the url getting printed on the iview with
http://abc.com<loginid>
how do i forward request to the said url from the jsp page.
Hi,
here is a simple Code sample to achieve this (as stated by Praveen Gudapati I use response.sendRedirect):
<%@ page language="java" %>
<%
String redirectURL = request.getParameter ("redirectURL");
response.sendRedirect (redirectURL);
%>
In this sample you can even pass the redirectURL as URL Parameter. If you don't want that just define
a static String for redirectURL.
If you use this within a portal component and want to call a "local" JSP I'd prefer to use a forward. This is faster and your Clients won't have to initiate a new request:
Here's some sample code:
public class MyPortalComponent extends AbstractPortalComponent
private static final String PATH_INDEX_JSP = "jsp/index.jsp";
* Forward the request to the corresponding JSP.
* @param request The request.
* @param response The response.
private final void forwardToJSP(IPortalComponentRequest request, IPortalComponentResponse response, String jspPath)
// get the JSP as resource object and include it in the response
IResource jspResource = request.getResource(IResource.JSP, jspPath);
response.include(request, jspResource);
public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
forwardToJSP(request, response,PATH_INDEX_JSP);
So when you have more than one JSP you just use a URL Parameter and switch Case in doContent to call the appropriate JSP:
Example:
public class MyPortalComponent extends AbstractPortalComponent
private static final String PATH_INDEX_JSP = "jsp/index.jsp";
private static final String PATH_SECOND_JSP = "jsp/second.jsp";
private static final String PATH_THIRD_JSP = "jsp/third.jsp";
private final int getRequestAction(IPortalComponentRequest request) {
int value = 0;
String param = request.getParameter("request_action");
if (param != null) {
try {
value = Integer.parseInt(param);
} catch (NumberFormatException e) {
value = 0;
return value;
public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
// get the requested action
int request_action = getRequestAction(request);
switch (request_action) {
case 0 :
forwardToJSP(request, response,PATH_INDEX_JSP);
break;
case 1 :
forwardToJSP(request, response,PATH_SECOND_JSP);
break;
case 2 :
forwardToJSP(request, response,PATH_THIRD_JSP);
break;
default :
forwardToJSP(request, response, PATH_INDEX_JSP);
break;
Hope this helps
(Reward Points for helpful answers are appreciated )
Cheers
Similar Messages
-
How to access a web service(.wsdl) from portal component.
Hi ,
Is there any document/tutorial available on how to access a webservice from portal component ?
I have found this linkhttps://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/ep/g-i/how to access a web service.htm...
but the urls in the link are not working...
i want to know the steps to access webs service and sample code if some body has already done that..
Thanks for the help.
LakshmiHi Lakshmi,
See the links below:
http://help.sap.com/saphelp_nw04/helpdata/en/f0/581140d72dc442e10000000a1550b0/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/a3/918340d990ce62e10000000a155106/content.htm
Hope this helps.
Regards,
Pooja. -
How to catch URL parameter from Portal URL in Web Dynpro iView
Hi All,
I have a web dynpro application running as a portal iView successfully. Now the client wants to make it internationalized with 7 languages. Currently they access the portal - and via role assignment they get to the portal tab with the wd iView. Now they want to send a parameter for the language key with the portal URL. So when they are typing in http://myportal.mydomain.com now they want to type in http://myportal.mydomain.com?sap-locale=de or so. My question is how can I catch this parameter in the WD application when it is running inside a portal iView? Is it at all possible?
I have written a very small application which is trying to catch a URL parameter named PARAM. The code I have written is the default one as below:
String paramValue = WDWebContextAdapter.getWebContextAdapter().getRequestParameter("PARAM");
When I run the application standalone and add the PARAM=something in last of the URL I can catch it. But when I create an iView and while previewing it I add the same PARAM value it is coming as null all the time. Same when I add this iView to a role and show it via role assignment in protal. Please help to let me know how to achieve this. I think if I can read the parameter value from Portal URL in the WD iView - then I can set it as the default locale of the application and then show language specific file to achieve internationalization.
Your urgent help will be highly appreciated.
Warm Regards,
ShubhoHi Shubhadip
Even if you get the parameters, how do you internationalize your application? Are you not following the standard way as described in the following link. In this case you never need to capture any such parameter. This is done by the WD runtime automatically .
<a href="http://help.sap.com/saphelp_erp2005/helpdata/en/f4/d95664da179b4db731e21c2e470b72/frameset.htm">Internationalization of WD projects</a>
You can retrieve application parameters specified at the creation of iview by "adding parameters(with the same name as in iview application parameters) to the default plug of the Component Interface View of the WD application". "onDefaultPlug" method of the interface view controller you get these values as parameters, which you can save in the context node of component controller for later use.This is guaranteed to work.
But again this is not what you want exactly. You want the user to specify the value at runtime. If you have just 7 languages, you can create 7 set of iviews with different application parameter value indicating language key, and assign to 7 different set of roles, each representing one set of users with common language.
I hope you find a solution.
Regards
kk -
Getting URL redirects from Google's "I'm Feeling Lucky" Search
Hello all! I'm working on my final project for my intermediate programming class but I've hit a bit of a snag. This project is a "do whatever interests you, as long as it incoporates what we've learned this semester" type of project. (My personal favorite type of programming project!) I have a significant amount of code already complete, but here's my problem:
To put it simply, my program:
1) Takes a list of movie names
2) Gets the movie poster from Wikipedia
3) Saves the poster images to a folder
4) Creates an HTML file, so I can see a visual representation of every movie on the list (btw, how do you like my idea?).
I'm using (what I think to be) a very clever system of searching with Google's "I'm Feeling Lucky" search (using detailed search terms such as "air+force+one+movie+wikipedia" that will, more than likely, always take me to the right page (if it exists))...
Basically, my getPic(String url) method is now throwing an exception when I try to search the page that Google redirects me to, and I'm guessing it might be because the code is trying to search the "I'm Feeling Lucky" redirect page, instead of the page it is supposed to redirect to.
I get the following error:
10000 BC
A connection to http://www.google.com/search?btnI=1&q=10000+bc+movie+wiki could not be established.
java.io.IOException: Server returned HTTP response code: 403 for URL: http://www.google.com/search?btnI=1&q=10000+bc+movie+wiki
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.URL.openStream(Unknown Source)
at GetWikiPiki.getPic(GetWikiPiki.java:44)
at MovieList.makeMovieList(MovieList.java:109)
at MakeMovieList.main(MakeMovieList.java:13)(Etc, with all the movies giving the same exception.)
If my guess is correct, could someone please inform me on how to either:
a) Follow the redirection from Google to the Wikipedia page or
b) Obtain the URL which the Google search will redirect me to.
Preferably b, so I can program it not to need to recreate each movie search every time the program runs.
Or if you have another idea of what it could be, please feel free to make suggestions.
Thanks a lot,
DerekWhen I tried printing the source of, for example, http://www.google.com/search?btnI=1&q=10000+bc+movie+wiki it gave me the source code to the Wikipedia 10,000 BC page with no errors at all.
Does this mean that it could be something wrong in my code and not Google?
Here is the code I'm using in the particular section that throws an exception:
* Gets the image address of a movie poster from Wikipedia via
* parsing the passed-in URL.
* @param url The website address (URL) of a Wikipedia article containing a movie poster.
* @return The first occurrence, in "picture_name.jpg" format, of an
* image whose address contains "http://" and ".jpg".
public String getPic(String url) {
try {
URL connection = new URL(url);
InputStream in = connection.openStream();
Scanner console = new Scanner(in);
while(console.hasNext()) {
String temp = console.next();
if(temp.contains("http://") && temp.contains(".jpg")) {
String temp2 = temp.replace("src", "").replace("=", "").replace("\"", "");
return temp2;
catch(IOException e) {
System.out.println("A connection to " + url + " could not be established.");
e.printStackTrace();
return null;
}{code}
Edited by: NovellTerminator on Apr 8, 2009 2:36 AM
Edited by: NovellTerminator on Apr 8, 2009 2:40 AM (Included JavaDoc) -
Trigger Navigation an iView/Page from Portal component
All,
I am writing AbstractPortalComponent and after performing some logic, I have to forward the control to a iView/Page. Please let me know how I can trigger navigation to a iView/Page from within AbstractPortalComponent.
Thanks,
PrasadHi Reddy,
You can use EPCF Navigation API in response.write.
response.write("<html>");
response.write("<script language='javascript'>");
response.write("EPCM.doNavigate('ROLES://<pcd location of the iview or page>');");
response.write("</script>");
response.write("</html>");
Or you can use request.redirect(url) for this depending on your requirement. For request.redirect check this link.
http://help.sap.com/saphelp_nw2004s/helpdata/en/b7/60b54066ea8531e10000000a1550b0/frameset.htm
Regards,
Vaishali -
URL redirect - how to switch from https to http
Hi, all.
We have some requirement that the portal session be switched to https on some iviews while the rest of the contents are in http. I am thinking of using url redirect on the web dispatcher.
What I found is that the url redirect from http to https works great. Now if I want to switch back to http, the redirect doesn't work. Note that the http port is 80 and https port is 443 on the web dispatcher. To test, here is the parameter I did to switch from http to https. This works and transforms the url from http://ozonehomeep3.xxxxxxxxx/irj/portal/zsap_xxxxx to https://ozonehomeep3.xxxxxxxxx/irj/portal/zsap_xxxxxxxxxxxx
icm/HTTP/redirect_0 = PREFIX=/, FROM=/irj/portal/zsap_, FOR=ozonehomeep3, FROMPROT=http, PROT=https, HOST=ozonehomeep3.XXXXXX
If I flip it back the other way:
icm/HTTP/redirect_0 = PREFIX=/, FROM=/irj/portal/zsap_, FOR=ozonehomeep3, FROMPROT=https, PROT=http, HOST=ozonehomeep3.XXXXXX
When I connect using the url https://ozonehomeep3.xxxxxxxxx/irj/portal/zsap_xxxxxxxxxxxx, it ignores the parameter and the redirect to http did not happen.
What is wrong?
Thanks,
Jonathan.Hello,
I've had a similar problem for one of my customers.
I've tried to do it on a root level, just Https://FQDN:port_https/ to http://FQDN:Port_http/
I've used this parameter to solve it:
icm/HTTP/redirect_0 = PREFIX=/, FOR=FQDN, FROMPROT=HTTPS, HOST=FQDN, PORT=80, PROT=http
maby you should try:
icm/HTTP/redirect_0 = PREFIX=/, FROM=/irj/portal/zsap_, FOR=FQDN, FROMPROT=HTTPS, HOST=FQDN, PORT=80, PROT=http, TO=/irj/portal/zsap_
You should also verify that the standard http port (80) are open in the firewall from the outside, just take a telnet session to FQDN and port 80
to quickly determined if the firewall policy are right.
Good luck!
Kind Regards
Håvard Fjukstad. -
Portal Component receives GET from other app out of the Enterprise Portal?
Hello.
I want to design a portal component, to which i can send GET-Parameters via URL.
The sending application runs out of the enterprise Portal and has a simple HTML-form (The portal component generates HTML and JAVA-Script for a Flex Application in the Enterprise Portal which should point to a specific document named in the params. The params will be written into the generated HTML document after calling).
Is this possible without authetification and how would the URL looks like, which is used to call the enterprise portal?
Pls help me.
With best regards
Edited by: Björn Karpenstein on Aug 15, 2008 11:02 AM
Edited by: Björn Karpenstein on Aug 15, 2008 11:03 AM
Edited by: Björn Karpenstein on Aug 15, 2008 11:05 AMHi Björn,
you can access request parameters with the following code in the standard methods of your Portal Component:
// IPortalComponentRequest request;
request.getServletRequest().getParameter("ParamName");
The direct URL of your Portal Component without a specific iView is:
http://
If your component should be directly accessable without authentication you must add the following property in your portalapp.xml in the the component-profile section:
<component-profile>
<property name="AuthScheme" value="anonymous"></property>
</component-profile>
Best regards,
Stefan Brauneis -
Passing value from Portal Development component to Webdynpro component
Hi experts
how to pass a value from portal component to a webdynpro component , is it possible, i have both portal and webdynpro --- development components on diffrent tracks,
Regards
Govardanpage 8.
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c2fad86f-0401-0010-91ac-bdb38595a735?QuickLink=events&overridelayout=true&5003637509947
any event you named. -
ISE CWA FLEXCONNECT - No url redirect
Hi,
I'm setting up a LAB environment for CWA with ISE(1.2.1), vWLC(8.0.100), ASA5505(9.1.X) and a 2602 AP in flexconnect mode.
Unfortunately I'm running into problems.
The AP, WLC and ISE is all running in vlan 1 which terminates in the 5505 as a inside interface.
Vlan 2 is a guest network terminating on a separate interface in the ASA.
The problem that I'm facing is that the url-redirect from the ISE dosent' work. If i check the client summery on the vWLC I can see that the client get applyes the redirect flexconnect ACL and that the URL is present. I've verified that it's not a DNS issue and I'm able to manually connect to ISE so there is no ACL blocking me. The client just dosen't get the redirect. I've tired with multiple devices (windows,ios,android) and it's all the same.
I've followed the following guides:
http://www.drchaos.com/flexconnect-local-switching-guestbyod/
http://www.cisco.com/c/en/us/support/docs/security/identity-services-engine/116087-configure-cwa-wlc-ise-00.html#anc11
Currently I'm at work but I can provide some debug output later.
Have anyone seen this behavior before?It is possible that you are hitting the following bug:
https://tools.cisco.com/bugsearch/bug/CSCue68065
One thing this bug does not mention is that there is another resolution outside of disabling local switching. The alternative is:
1. Create a standar ACL on the controller that is named exactly as the FlexConnect ACLs
2. The standard ACL does not have to have any ACE in it
I have ran into this issue before and the above workaround has worked for me. The issue was supposed be addressed in version 8.x of the WLC but I think it is still worth giving it a try.
Thank you for rating helpful posts! -
ACE: URL redirect - not working
Hi,
I've to do url redirection from port 80 to port 443. I've following configured:
rserver redirect url.test.com-rd
webhost-redirection https://url.test.com/
inservice
serverfarm redirect url.test.com:80
description url.test.com - port 80 redirect ***
rserver url.test.com-rd
inservice
class-map match-any url.test.com:80
2 match virtual-address 192.168.1. tcp eq www
policy-map type loadbalance first-match url.test.com:80
class class-default
serverfarm url.test.com:80
policy-map multi-match LOAD_BALANCE
class url.test.com:80
loadbalance vip inservice
loadbalance policy url.test.com:80
loadbalance vip icmp-reply active
===
with above configuration, ACE is redirection port 80 to port 443 but it also rewrites the header. i.e. ACE send me to
"https://url.test.com/" if I type "http://url.test.com/abc" in the browser. It should have redirected to "https://url.test.com/abc" ( it shouldn't have removed "/abc")
could you advice how to accomplish it.
Thanks in advance...Hi,
thanks pablo. but that isn't expected response. redirected url shows the load balanced server. i.e. for the following serverfarm of port 443:
serverfarm host url.test.com:443
description url.test.com - Port 7777 ***
failaction purge
probe url.test.com:7777
rserver server1.test.com 7777
inservice
redirected url comes as "http://server1.test.com:7777/abc/" ...instead of what I expect .i.e. i expect "
https://url.test.com/abc/" -
Complete URL of an iView Component !!
Environment : EP 6.0 Sp2
Following is the complete url of an iview ...
http://<servername>:<port>/irj/servlet/prt/portal/prtroot/<componentName>.default
I am using the following code to get the url ...
IPortalUrlGenerator portalGen = null;
IUrlGeneratorService urlGen = (IUrlGeneratorService)componentRequest.getService(IUrlGeneratorService.KEY);
ISpecializedUrlGenerator specUrlGen2 = urlGen.getSpecializedUrlGenerator(IPortalUrlGenerator.KEY);
if (specUrlGen2 instanceof IPortalUrlGenerator)
portalGen = (IPortalUrlGenerator) specUrlGen2;
String strUrl = new String();
if (portalGen != null)
strUrl = portalGen.generatePortalComponentUrl(componentRequest, "ComponentName.default");
with the above code, the url I am getting ( in strUrl vaiable) is ...
"/irj/servlet/prt/portal/prtroot/<componentName>.default"
How can I get the url part "<servername>:<port>" so that I append it to the above string to get the complete url of the portal component or is there any other way to get a complete URL of a component ??
I appreciate your help !!Use the HttpServletRequest object to get the bits you need:
String strUrl = "/blah/blah";
HttpServletRequest srq = componentRequest.getServletRequest();
String url = srq.getScheme()+"://" +
srq.getServerName() + ":" +
srq.getServerPort() ;
response.write (url + strUrl); -
Getting exception while accessing External WebServices from Portal Componen
Hi,
We are using one external Temperature WebService and calling it from the proxy which is called by a Portal Component. My proxy name is TempService and portal component name is TempComponent.While calling the web service from portal component we are getting the exception. When I checked with log file, I got that invokeMethod() is failing and following exception is occuring :
Caused by: com.sap.engine.services.webservices.jaxm.soap.accessor.NestedSOAPException: IOError while working with the message. Check the nested Exception.
at com.sapportals.portal.prt.service.soap.SOAPService.call(SOAPService.java:197)
at com.sapportals.portal.prt.service.soap.PRTSOAPCall.invokeMethod(PRTSOAPCall.java:209)
at com.sap.portal.tutorial.translation.TempService.getTemp(TempService.java:158)
at com.sap.portal.tutorial.TempComponent.TempComponent.doContent(TempComponent.java:18)
Can some one help us to resolve it.
Thanks in advance,
ajayAs far as I know, webservices are working pretty well from SP2 Patch4. On patch3 hf2 I've had problems creating the proxy classes (especially for consuming .net webservices) and also gotten some runtime exception (cannot remember what they were).
Suggest you open an OSS against SAP with your specific problem. -
Redirecting to external website from abstract portal component?
Hi,
I have developed an abstract portal component and trying to be redirected to an external website ex : www.google.com
here is the code...
public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
HttpServletRequest req = request.getServletRequest();
String queryString = req.getQueryString();
String redirectURL = queryString.substring(queryString.indexOf("=")+1);
HttpServletResponse resp = request.getServletResponse(true);
resp.sendRedirect(redirectURL);
OR
RequestDispatcher rd = req.getRequestDispatcher("www.google.com");
rd.forward(req, resp);
But couldn't able to redirect in either ways ..
exception was ... iView not found: www.google.com.
Any help?
Thanks
MMKHi Mohan,
When you do a redirect you need to provide a URL. From javadocs
Sends a temporary redirect response to the client using the specified redirect location URL. This method can accept relative URLs; the servlet container will convert the relative URL to an absolute URL before sending the response to the client.
Thus when you provide just "www.google.com" the converted complete URL will be something like http://portalserver/irj....www.google.com whcih of course does not exist as a portal component. Thus you get the error iview not found.
Hence you need to give a full URL and not a relative URL.
Akhilesh -
Redirecting from an abstract portal component
Hi,
I'm trying to redirect from an abstract portal component to a quicklink. I do it like told in this thread:
Redirecting to external website from abstract portal component?
private void redirectUrl(String target, IPortalComponentRequest request) {
try {
HttpServletResponse resp = request.getServletResponse(true);
resp.sendRedirect("../../../../portal/" + target);
} catch (IOException e) {}
It works, but the content of my target-URL is still in the Portal-Frame. So I've two time the Portal-Framework-Navigation. Something like this:
| Welcome |
| Welcome |
| content |
| |
| |
| |
My goal is to redirect the whole page, not only the frame.
Thanks for any help...
Regards, MarkusPerhaps I can do it with
public void doOnNodeReady(IPortalComponentRequest request){
request.redirect("http://www.google.de");
But like in this Tread, it didn't work AbstractPortalComponent and doOnNodeReady -
Call jspdynpage or Abstract Portal Component from SAPUI5
Hi,
I am new to SAPUI5, so might ask basic and dumb questions.
I am trying to develop an application in sapui5 which should have the functionality to read and write a file to the server. It is different from file upload as the user wont be selecting any file, rather the data in the form should be written to a file in the server on a click of a button. After doing some research I figured out that sapui5 doesn't give an option to read/write a file to the server.
So, as an alternative I thought of developing a service, an SAP portal application (jspdynpage, WDJ, abstract portal component - or if you can suggest any other app) that can be called from the sapui5 for reading/writing purpose. The data can be received/sent as an xml, and in the sapui5 application I can parse the data and do the needful.
Now my question is how to call the portal application (that would be a url) without redirecting, and pass the necessary parameter? Sapui5 should just call that url and data should be passed or received as a parameter. I am not sure if OData model call will work, as I am getting an exception. Can you please provide a solution to this?
Ps: We are on SAP EP 7.3 and would like to stick to SAP apps, and no additional database etc.
Regards,
Piyush.Hi All,
I found a way to do that. I created an Abstract Portal Component application that accepts data through url parameters. Used the regular java APIs to read/write files to the server.
Now the challenge, at least to me, was to call this application from SAPUI5 application. I used ajax call.
var response = $.ajax ({
url: "<url>",
type: "POST"
Next, will also try to find if I could use any of the models provided by SAPUI5 to call the portal application.
Note: Make sure both your sapui5 app and the portal application is deployed on the same server, else it wont be able to authenticate (SSO wont work) and you may receive exceptions.
Regards,
Piyush.
Maybe you are looking for
-
Indesign slow with Bridge -Photoshop-Illustrator
Hello there, First, sorry for my english i'm French. One of my collegue is experiencing issue with CS6 indesign. Installed in a PC with Intel core i7 370 2.93/2.93 gHZ, 16 GB RAM. Windows seven 64 bits. Once he open a files of more than 10 Mb in Ind
-
How to Install and apply the Diagnostic Pack for Fusion Middleware on EM
Hi we have installed ADF Runtime along with Enterprise Manager on IBM-AIX-64-BIT-7.1 version. now, we are planning to install the Diagnostic pack for fusion middleware inorder to monitor the ADF Application deployed on weblogic 10.3.6 server from Ent
-
I am an exchange student for the year and I would like to by an iphone that i can use in France also, so I need an unlocked one but i don't want to pay to much for it... What should I do?
-
Standard IDOC/BAPI to create work order in CRM from ECC PS
Hello Guys, Any input on any standard IDOC/BAPI I could use to create a work order in SAP CRM based on the data feed from SAP ECC (Project systems)? Any help on this would be really appreciated.
-
I just took a class for dreamweaver but it was useless, cause they didn't mention anything I needed help with. So i was wondering if anyone knew any good sites to learn on how to use css2. I need to use it very minimaly, as all I'm trying to figure o