Liferay Friendly URL struts action not fired - liferay

Please help me to implement Friendly URL
My source URL
http://localhost:8080/web/guest/myshop? p_p_id=225_INSTANCE_08MX& p_p_lifecycle=0 &p_p_state=normal& p_p_mode=view& p_p_col_id=column-1&
p_p_col_count=1 &_225_INSTANCE_08MX_struts_action=%2Fproduct%2Fview_product
&_225_INSTANCE_08MX_redirect=http%3A%2F%2Flocalhost%3A8080%2Fweb%2Fguest%2Fprodu­ct%3Fp_p_id%3D25_INSTANCE_08MX%26p_p_lifecycle%3D0%26p_p_state%3Dnormal%26p_p_mo­de%3Dview%26p_p_col_id%3Dcolumn-1%26p_p_col_count%3D1%26_225_INSTANCE_08MX_%252F­%3D&_225_INSTANCE_08MX_productId=25414
Please can some one help me to write route file.
Thanks
Tania

Related

Codeigniter Controller class login form : 404 page not found

Im trying to combine several tutorials about Codeigniter and bootstrap and understand per codes so i can integrate it in my project. What i am trying to do right now is create a login form using the two framework.
And i setup my View according to the turotial included in Codeigniter 'user_guide/tutorial/static_pages.html' which my landing page is named as 'home.php' is inside the folder 'pages' and header.php, and footer.php is inside the 'templates' folder. I created also a controller: Page.php.
I also use .htaccess to hide 'index.php'. Now i follow this tutorial how to create a login page:
http://learnjquerybootstrap.blogspot.com/2015/01/login-session-using-codeigniter-and-bootstrap.html?m=1
-the only difference is this since i use htaccess:
<?php echo form_open(clogin/index); ?>
But when I try to submit the page i receive a: 404 page not found.
My navbar links are working fine. I understand that the codeigniter works like this:
http://localhost/myfolder/index.php/class/function/
so when i submit my form the url that show up is:
http://localhost/myfolder/clogin/index
and gives me: 404 page not found.
Question:
What is wrong with it?
is there something wrong with the tutorial that i am using? i check other tutorials and the controller structure is just the same, like on this link:
http://www.kodingmadesimple.com/2014/08/how-to-create-login-form-codeigniter-mysql-twitter-bootstrap.html
do i need to include clogin.php in route.php?
or is it about the htaccess? my
uri_protocol
is configured as
'REQUEST_URI'
in config.php. i tried other options but still the same.
Don't need include to route.
I recommented ready auth library.
If you use DevTools in your browser maybe "Network" tab of devtools can help you to why you get 404 error.
i already firgured it out.The mistake was in the route.php, since i tried to combine two examples.. i realized that the wildcard route that i included from the Codeigniter user guide will not work with the Clogin.php.
Since it was set as
$route['(:any)']='pages/view/$1';
So the url works as
http://localhost/myfolder/pages/view/clogin
instead of
http://localhost/myfolder/clogin.
I removed it and now it is working.

How would i create a custom dynamic url in codeigniter

I hate the codeigniter custom urls where it's: domain.com/controller/action/username
How can I have it like a normal website like: domain.com/username
Please give me a suggestion.
You try this in routes.php
$route['(:any)'] = "controller/action/$1";
Here is the routing documentation : routing
Please refer http://ellislab.com/codeigniter/user-guide/general/routing.html. You can do this by URL routing

Where is a SiteLogoUrl in CSOM?

I found SPWeb.SiteLogoUrl and expected this property in CSOM and REST. But I didn't find it. How can I get a SiteLogoUrl using CSOM or REST?
SP.js
Microsoft.SharePoint.Client.dll
It was moved to the POST request that SharePoint creates while redirecting via appredirect.aspx. So, the only one way to get Site Logo Url is to handle appredirect POST request.
To initiate redirect you should use this code snippet:
Response.Redirect(TokenHelper.GetAppContextTokenRequestUrl(sharePointHostUrl, Server.UrlEncode(targetUrl)));
ContextToken, SiteLogo, Url, Title and so on can be found in the POST FormData.

Routes in Codeigniter

I want to have a clean URL in CodeIgniter based application for User's Profile Information.
Please Take a look at URL formats below.
Actual URL : http://www.mydomain.com/index.php/users/profile/user1
I'm expecting users to have Personal URL's like
http://www.mydomain.com/user1
http://www.mydomain.com/user2
http://www.mydomain.com/user3
URL http://www.mydomain.com/user1 should process http://www.mydomain.com/index.php/users/profile/user1 in background execution.
I will be removing index.php from URL using Route library.
Thanks in advance for any sort of help.
Have a look at https://www.codeigniter.com/user_guide/general/routing.html.
$route['user(:num)'] = "users/profile/user/$1";
If you mean you want /anyusername to route to the users controller, you would have to put:
$route['(:any)'] = "users/profile/$1";
At the bottom of routes.php and every non user-URL above it. Otherwise every URL would be routed there, obviously. You will need to implement some mechanism in the users-controller to throw 404-errors, since you are routing all requests not catched in the routing rules above.
IN config/routes.php
add this line
$route['user(:num)'] = "users/profile/$1";

web site scraping through Jsoup

I have spent few hours on signing in to web site by using jsoup. But it always gives same login page. To clarify the issue I tried with facebook site. It also gives same result.
Below I mentioned my code
String url ="http://www.facebook.com/";
Document doc;
doc = Jsoup.connect(url)
.data("email","abc#gmail.com","pass","xyz")
.userAgent("Mozilla").post();
System.out.println(doc);
can anybody point me where I made a mistake and how can i fix this issue?
In data portion "email" and "pass" are input field id of facebook login page.
Thank you.
Try this:
String url ="http://www.facebook.com/";
Document doc;
doc = Jsoup.connect(url)
.data("email","abc#gmail.com")
.data("pass","xyz")
.userAgent("Mozilla")
.post();
Anyway, Jsoup is not bad at all, you only need how to use it properly, but also you need to keep in mind that Facebook is expecting a lot more parameters to make a successfull login via POST emulating a web page navigation.
By example:
charset_test
default_persistent
lgnjs
lgnrnd
locale
lsd
pass
persistent
timezone
If you need to authenticate and get proper data I suggest that you must give a try to a Facebook SDK for Android:
https://github.com/facebook/facebook-android-sdk/

Resources