You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by George Christman <gc...@cardaddy.com> on 2014/10/28 07:30:45 UTC

Site wide 301 redirect to https from http

Hi guys, I'm in the process of migrating my entire site to https from http.
I need to do this with extreme caution or I risk losing my search rank.
Google recommends 301 redirects for every page being migrated, however when
securing the app like so,

public void contributeMetaDataLocator(MappedConfiguration<String, String>
configuration) {
        configuration.add(MetaDataConstants.SECURE_PAGE, "true");
}

it appears as if the redirects are happening automatically without a 301.
Does anybody know how I can accomplish this task?

When I move pages, I generally just use something like this.

Link link = linkSource.createPageRenderLinkWithContext(Signin.class);
        return new HttpStatusCode(HttpServletResponse.SC_MOVED_PERMANENTLY,
link);

Thanks,
George

-- 
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

Re: Site wide 301 redirect to https from http

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Tue, 28 Oct 2014 17:30:22 -0200, George Christman  
<gc...@cardaddy.com> wrote:

> nvm I got it, thanks guys. Also, is looking at the port the efficient way
> of doing this?
>         if (port == 8080) {

Instead of hardwiring the port number, you should check the  
SymbolConstants.HOSTPORT_SECURE or HOSTPORT symbol values. Other than  
that, I cannot suggest anything else. :) Secure and non-secure HTTP must  
use different ports, so I think this is the way to go.

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Site wide 301 redirect to https from http

Posted by George Christman <gc...@cardaddy.com>.
nvm I got it, thanks guys. Also, is looking at the port the efficient way
of doing this?

@Override
    public boolean dispatch(Request request, final Response response)
throws IOException {
        int port = request.getLocalPort();

        PageRenderRequestParameters parameters =
linkEncoder.decodePageRenderRequest(request);

        if (port == 8080) {
            Link link =
linkSource.createPageRenderLinkWithContext(parameters.getLogicalPageName(),
parameters.getActivationContext());
            link.setSecurity(LinkSecurity.SECURE);

            response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
            response.setHeader("Location",
response.encodeRedirectURL(link.toAbsoluteURI()));
            return true;
        }

        return false;
    }



On Tue, Oct 28, 2014 at 3:10 PM, George Christman <gc...@cardaddy.com>
wrote:

> Hi Kalle, would you still be setting the status header in the dispatcher?
>
> On Tue, Oct 28, 2014 at 2:30 PM, Kalle Korhonen <
> kalle.o.korhonen@gmail.com> wrote:
>
>> The problem is that the status header is rewritten - sendRedirect()
>> implicitly sets 302 by the spec. Set the headers yourself and flush to
>> commit:
>>
>>
>> servletResponse.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
>>         servletResponse.setHeader("Location",
>> servletResponse.encodeRedirectURL(requestUri));
>>         servletResponse.flushBuffer();
>>
>> Kalle
>>
>>
>> On Tue, Oct 28, 2014 at 11:18 AM, George Christman <
>> gchristman@cardaddy.com>
>> wrote:
>>
>> > I found componentRequestHandler in some tapestry code and when I removed
>> > it, no page. I guess I just needed to return false ;)
>> >
>> > Yup the code is definitely running, I can remove Secure_Page and the
>> page
>> > redirects without issue, however no matter what I setStatus too, it
>> > continues to provide a 302 response. If I sendError to a 301, it will
>> > redirect the browser to a 301 error like it should. Is setStatus the
>> > correct method to use?
>> >
>> > http://localhost:8080/etss/login
>> >
>> > GET /etss/login HTTP/1.1
>> > Host: localhost:8080
>> > User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:32.0) Gecko/20100101
>> > Firefox/32.0
>> > Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
>> > Accept-Language: en-US,en;q=0.5
>> > Accept-Encoding: gzip, deflate
>> > DNT: 1
>> > Cookie: shiroSavedRequest=/etss/
>> > Connection: keep-alive
>> >
>> > HTTP/1.1 302 Found
>> > Location: https://localhost/etss/login
>> > Content-Length: 0
>> > Server: Jetty(8.1.14.v20131031)
>> >
>> >
>> > On Tue, Oct 28, 2014 at 1:42 PM, Thiago H de Paula Figueiredo <
>> > thiagohp@gmail.com> wrote:
>> >
>> > > On Tue, 28 Oct 2014 15:11:13 -0200, George Christman <
>> > > gchristman@cardaddy.com> wrote:
>> > >
>> > >  Hi Thiago,
>> > >>
>> > >
>> > > Hi!
>> > >
>> > >  I'm assuming you mean something like this, but I'm not seeing
>> > >> the 301 response. Could you take a look and see if you can spot what
>> I'm
>> > >> doing wrong. Below is the response as well. Thank you.
>> > >>
>> > >
>> > > Are you sure your code was actually called?
>> > >
>> > >
>> > >>
>> > >> public class AccessController implements Dispatcher {
>> > >>
>> > >> @Override
>> > >>     public boolean dispatch(Request request, final Response response)
>> > >> throws IOException {
>> > >>         int port = request.getLocalPort();
>> > >>
>> > >>         PageRenderRequestParameters parameters =
>> > >> linkEncoder.decodePageRenderRequest(request);
>> > >>
>> > >>         if (port == 80) {
>> > >>             Link link =
>> > >> linkSource.createPageRenderLinkWithContext(parameters.
>> > >> getLogicalPageName(),
>> > >> parameters.getActivationContext());
>> > >>
>> >  response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
>> > >>             link.setSecurity(LinkSecurity.SECURE);
>> > >>             response.sendRedirect(link.toAbsoluteURI());
>> > >>             return true;
>> > >>         }
>> > >>
>> > >>         componentRequestHandler.handlePageRender(parameters);
>> > >>         return true;
>> > >>
>> > >
>> > > You should return false when a Dispatcher didn't provide a response,
>> so
>> > > the last line should return false, otherwise no page will ever be
>> > rendered.
>> > > I'm not sure why you've added the componentRequestHandler line.
>> > >
>> > >
>> > > --
>> > > Thiago H. de Paula Figueiredo
>> > > Tapestry, Java and Hibernate consultant and developer
>> > > http://machina.com.br
>> > >
>> > > ---------------------------------------------------------------------
>> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> > > For additional commands, e-mail: users-help@tapestry.apache.org
>> > >
>> > >
>> >
>> >
>> > --
>> > George Christman
>> > www.CarDaddy.com
>> > P.O. Box 735
>> > Johnstown, New York
>> >
>>
>
>
>
> --
> George Christman
> www.CarDaddy.com
> P.O. Box 735
> Johnstown, New York
>
>


-- 
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

Re: Site wide 301 redirect to https from http

Posted by George Christman <gc...@cardaddy.com>.
Hi Kalle, would you still be setting the status header in the dispatcher?

On Tue, Oct 28, 2014 at 2:30 PM, Kalle Korhonen <ka...@gmail.com>
wrote:

> The problem is that the status header is rewritten - sendRedirect()
> implicitly sets 302 by the spec. Set the headers yourself and flush to
> commit:
>
>
> servletResponse.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
>         servletResponse.setHeader("Location",
> servletResponse.encodeRedirectURL(requestUri));
>         servletResponse.flushBuffer();
>
> Kalle
>
>
> On Tue, Oct 28, 2014 at 11:18 AM, George Christman <
> gchristman@cardaddy.com>
> wrote:
>
> > I found componentRequestHandler in some tapestry code and when I removed
> > it, no page. I guess I just needed to return false ;)
> >
> > Yup the code is definitely running, I can remove Secure_Page and the page
> > redirects without issue, however no matter what I setStatus too, it
> > continues to provide a 302 response. If I sendError to a 301, it will
> > redirect the browser to a 301 error like it should. Is setStatus the
> > correct method to use?
> >
> > http://localhost:8080/etss/login
> >
> > GET /etss/login HTTP/1.1
> > Host: localhost:8080
> > User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:32.0) Gecko/20100101
> > Firefox/32.0
> > Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
> > Accept-Language: en-US,en;q=0.5
> > Accept-Encoding: gzip, deflate
> > DNT: 1
> > Cookie: shiroSavedRequest=/etss/
> > Connection: keep-alive
> >
> > HTTP/1.1 302 Found
> > Location: https://localhost/etss/login
> > Content-Length: 0
> > Server: Jetty(8.1.14.v20131031)
> >
> >
> > On Tue, Oct 28, 2014 at 1:42 PM, Thiago H de Paula Figueiredo <
> > thiagohp@gmail.com> wrote:
> >
> > > On Tue, 28 Oct 2014 15:11:13 -0200, George Christman <
> > > gchristman@cardaddy.com> wrote:
> > >
> > >  Hi Thiago,
> > >>
> > >
> > > Hi!
> > >
> > >  I'm assuming you mean something like this, but I'm not seeing
> > >> the 301 response. Could you take a look and see if you can spot what
> I'm
> > >> doing wrong. Below is the response as well. Thank you.
> > >>
> > >
> > > Are you sure your code was actually called?
> > >
> > >
> > >>
> > >> public class AccessController implements Dispatcher {
> > >>
> > >> @Override
> > >>     public boolean dispatch(Request request, final Response response)
> > >> throws IOException {
> > >>         int port = request.getLocalPort();
> > >>
> > >>         PageRenderRequestParameters parameters =
> > >> linkEncoder.decodePageRenderRequest(request);
> > >>
> > >>         if (port == 80) {
> > >>             Link link =
> > >> linkSource.createPageRenderLinkWithContext(parameters.
> > >> getLogicalPageName(),
> > >> parameters.getActivationContext());
> > >>
> >  response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
> > >>             link.setSecurity(LinkSecurity.SECURE);
> > >>             response.sendRedirect(link.toAbsoluteURI());
> > >>             return true;
> > >>         }
> > >>
> > >>         componentRequestHandler.handlePageRender(parameters);
> > >>         return true;
> > >>
> > >
> > > You should return false when a Dispatcher didn't provide a response, so
> > > the last line should return false, otherwise no page will ever be
> > rendered.
> > > I'm not sure why you've added the componentRequestHandler line.
> > >
> > >
> > > --
> > > Thiago H. de Paula Figueiredo
> > > Tapestry, Java and Hibernate consultant and developer
> > > http://machina.com.br
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > >
> > >
> >
> >
> > --
> > George Christman
> > www.CarDaddy.com
> > P.O. Box 735
> > Johnstown, New York
> >
>



-- 
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

Re: Site wide 301 redirect to https from http

Posted by Kalle Korhonen <ka...@gmail.com>.
The problem is that the status header is rewritten - sendRedirect()
implicitly sets 302 by the spec. Set the headers yourself and flush to
commit:

        servletResponse.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
        servletResponse.setHeader("Location",
servletResponse.encodeRedirectURL(requestUri));
        servletResponse.flushBuffer();

Kalle


On Tue, Oct 28, 2014 at 11:18 AM, George Christman <gc...@cardaddy.com>
wrote:

> I found componentRequestHandler in some tapestry code and when I removed
> it, no page. I guess I just needed to return false ;)
>
> Yup the code is definitely running, I can remove Secure_Page and the page
> redirects without issue, however no matter what I setStatus too, it
> continues to provide a 302 response. If I sendError to a 301, it will
> redirect the browser to a 301 error like it should. Is setStatus the
> correct method to use?
>
> http://localhost:8080/etss/login
>
> GET /etss/login HTTP/1.1
> Host: localhost:8080
> User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:32.0) Gecko/20100101
> Firefox/32.0
> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
> Accept-Language: en-US,en;q=0.5
> Accept-Encoding: gzip, deflate
> DNT: 1
> Cookie: shiroSavedRequest=/etss/
> Connection: keep-alive
>
> HTTP/1.1 302 Found
> Location: https://localhost/etss/login
> Content-Length: 0
> Server: Jetty(8.1.14.v20131031)
>
>
> On Tue, Oct 28, 2014 at 1:42 PM, Thiago H de Paula Figueiredo <
> thiagohp@gmail.com> wrote:
>
> > On Tue, 28 Oct 2014 15:11:13 -0200, George Christman <
> > gchristman@cardaddy.com> wrote:
> >
> >  Hi Thiago,
> >>
> >
> > Hi!
> >
> >  I'm assuming you mean something like this, but I'm not seeing
> >> the 301 response. Could you take a look and see if you can spot what I'm
> >> doing wrong. Below is the response as well. Thank you.
> >>
> >
> > Are you sure your code was actually called?
> >
> >
> >>
> >> public class AccessController implements Dispatcher {
> >>
> >> @Override
> >>     public boolean dispatch(Request request, final Response response)
> >> throws IOException {
> >>         int port = request.getLocalPort();
> >>
> >>         PageRenderRequestParameters parameters =
> >> linkEncoder.decodePageRenderRequest(request);
> >>
> >>         if (port == 80) {
> >>             Link link =
> >> linkSource.createPageRenderLinkWithContext(parameters.
> >> getLogicalPageName(),
> >> parameters.getActivationContext());
> >>
>  response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
> >>             link.setSecurity(LinkSecurity.SECURE);
> >>             response.sendRedirect(link.toAbsoluteURI());
> >>             return true;
> >>         }
> >>
> >>         componentRequestHandler.handlePageRender(parameters);
> >>         return true;
> >>
> >
> > You should return false when a Dispatcher didn't provide a response, so
> > the last line should return false, otherwise no page will ever be
> rendered.
> > I'm not sure why you've added the componentRequestHandler line.
> >
> >
> > --
> > Thiago H. de Paula Figueiredo
> > Tapestry, Java and Hibernate consultant and developer
> > http://machina.com.br
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> --
> George Christman
> www.CarDaddy.com
> P.O. Box 735
> Johnstown, New York
>

Re: Site wide 301 redirect to https from http

Posted by George Christman <gc...@cardaddy.com>.
I found componentRequestHandler in some tapestry code and when I removed
it, no page. I guess I just needed to return false ;)

Yup the code is definitely running, I can remove Secure_Page and the page
redirects without issue, however no matter what I setStatus too, it
continues to provide a 302 response. If I sendError to a 301, it will
redirect the browser to a 301 error like it should. Is setStatus the
correct method to use?

http://localhost:8080/etss/login

GET /etss/login HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:32.0) Gecko/20100101
Firefox/32.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
DNT: 1
Cookie: shiroSavedRequest=/etss/
Connection: keep-alive

HTTP/1.1 302 Found
Location: https://localhost/etss/login
Content-Length: 0
Server: Jetty(8.1.14.v20131031)


On Tue, Oct 28, 2014 at 1:42 PM, Thiago H de Paula Figueiredo <
thiagohp@gmail.com> wrote:

> On Tue, 28 Oct 2014 15:11:13 -0200, George Christman <
> gchristman@cardaddy.com> wrote:
>
>  Hi Thiago,
>>
>
> Hi!
>
>  I'm assuming you mean something like this, but I'm not seeing
>> the 301 response. Could you take a look and see if you can spot what I'm
>> doing wrong. Below is the response as well. Thank you.
>>
>
> Are you sure your code was actually called?
>
>
>>
>> public class AccessController implements Dispatcher {
>>
>> @Override
>>     public boolean dispatch(Request request, final Response response)
>> throws IOException {
>>         int port = request.getLocalPort();
>>
>>         PageRenderRequestParameters parameters =
>> linkEncoder.decodePageRenderRequest(request);
>>
>>         if (port == 80) {
>>             Link link =
>> linkSource.createPageRenderLinkWithContext(parameters.
>> getLogicalPageName(),
>> parameters.getActivationContext());
>>             response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
>>             link.setSecurity(LinkSecurity.SECURE);
>>             response.sendRedirect(link.toAbsoluteURI());
>>             return true;
>>         }
>>
>>         componentRequestHandler.handlePageRender(parameters);
>>         return true;
>>
>
> You should return false when a Dispatcher didn't provide a response, so
> the last line should return false, otherwise no page will ever be rendered.
> I'm not sure why you've added the componentRequestHandler line.
>
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

Re: Site wide 301 redirect to https from http

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Tue, 28 Oct 2014 15:11:13 -0200, George Christman  
<gc...@cardaddy.com> wrote:

> Hi Thiago,

Hi!

> I'm assuming you mean something like this, but I'm not seeing
> the 301 response. Could you take a look and see if you can spot what I'm
> doing wrong. Below is the response as well. Thank you.

Are you sure your code was actually called?

>
>
> public class AccessController implements Dispatcher {
>
> @Override
>     public boolean dispatch(Request request, final Response response)
> throws IOException {
>         int port = request.getLocalPort();
>
>         PageRenderRequestParameters parameters =
> linkEncoder.decodePageRenderRequest(request);
>
>         if (port == 80) {
>             Link link =
> linkSource.createPageRenderLinkWithContext(parameters.getLogicalPageName(),
> parameters.getActivationContext());
>             response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
>             link.setSecurity(LinkSecurity.SECURE);
>             response.sendRedirect(link.toAbsoluteURI());
>             return true;
>         }
>
>         componentRequestHandler.handlePageRender(parameters);
>         return true;

You should return false when a Dispatcher didn't provide a response, so  
the last line should return false, otherwise no page will ever be  
rendered. I'm not sure why you've added the componentRequestHandler line.

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Site wide 301 redirect to https from http

Posted by George Christman <gc...@cardaddy.com>.
Hi Thiago, I'm assuming you mean something like this, but I'm not seeing
the 301 response. Could you take a look and see if you can spot what I'm
doing wrong. Below is the response as well. Thank you.


public class AccessController implements Dispatcher {

@Override
    public boolean dispatch(Request request, final Response response)
throws IOException {
        int port = request.getLocalPort();

        PageRenderRequestParameters parameters =
linkEncoder.decodePageRenderRequest(request);

        if (port == 80) {
            Link link =
linkSource.createPageRenderLinkWithContext(parameters.getLogicalPageName(),
parameters.getActivationContext());
            response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
            link.setSecurity(LinkSecurity.SECURE);
            response.sendRedirect(link.toAbsoluteURI());
            return true;
        }

        componentRequestHandler.handlePageRender(parameters);
        return true;
    }

AppModule.class

public void contributeMasterDispatcher(OrderedConfiguration<Dispatcher>
configuration,
            @InjectService("AccessController") Dispatcher accessController)
{
        configuration.add("AccessController", accessController,
"before:PageRender");
    }

public void contributeMetaDataLocator(MappedConfiguration<String, String>
configuration) {
        configuration.add(MetaDataConstants.SECURE_PAGE, "true");
    }


http://localhost/etss

GET /etss HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:32.0) Gecko/20100101
Firefox/32.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
DNT: 1
Referer: http://localhost/
Connection: keep-alive

HTTP/1.1 302 Found
Location: http://localhost/etss/
Content-Length: 0
Server: Jetty(8.1.14.v20131031)
----------------------------------------------------------
http://localhost/etss/

GET /etss/ HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:32.0) Gecko/20100101
Firefox/32.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
DNT: 1
Referer: http://localhost/
Connection: keep-alive

HTTP/1.1 302 Found
Set-Cookie: shiroSavedRequest=/etss/;Path=/etss
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Location: http://localhost/etss/login
Content-Length: 0
Server: Jetty(8.1.14.v20131031)
----------------------------------------------------------
http://localhost/etss/login

GET /etss/login HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:32.0) Gecko/20100101
Firefox/32.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
DNT: 1
Referer: http://localhost/
Connection: keep-alive

HTTP/1.1 302 Found
Location: https://localhost/etss/login
Content-Length: 0
Server: Jetty(8.1.14.v20131031)
----------------------------------------------------------
https://localhost/etss/login

GET /etss/login HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:32.0) Gecko/20100101
Firefox/32.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
DNT: 1
Referer: http://localhost/
Connection: keep-alive

HTTP/1.1 200 OK
Content-Type: text/html;charset=UTF-8
Content-Encoding: gzip
Transfer-Encoding: chunked
Server: Jetty(8.1.14.v20131031)

On Tue, Oct 28, 2014 at 6:53 AM, Thiago H de Paula Figueiredo <
thiagohp@gmail.com> wrote:

> On Tue, 28 Oct 2014 04:30:45 -0200, George Christman <
> gchristman@cardaddy.com> wrote:
>
>  it appears as if the redirects are happening automatically without a 301.
>> Does anybody know how I can accomplish this task?
>>
>> When I move pages, I generally just use something like this.
>>
>> Link link = linkSource.createPageRenderLinkWithContext(Signin.class);
>>         return new HttpStatusCode(HttpServletResponse.SC_MOVED_
>> PERMANENTLY,
>> link);
>>
>
> Write a Dispatcher and contribute it before the other ones. Use
> ComponentEventLinkEncoder.decodePageRender() to know what page and
> activation context then use PageRenderLinkSource to create the URL to
> redirect.
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

Re: Site wide 301 redirect to https from http

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Tue, 28 Oct 2014 04:30:45 -0200, George Christman  
<gc...@cardaddy.com> wrote:

> it appears as if the redirects are happening automatically without a 301.
> Does anybody know how I can accomplish this task?
>
> When I move pages, I generally just use something like this.
>
> Link link = linkSource.createPageRenderLinkWithContext(Signin.class);
>         return new  
> HttpStatusCode(HttpServletResponse.SC_MOVED_PERMANENTLY,
> link);

Write a Dispatcher and contribute it before the other ones. Use  
ComponentEventLinkEncoder.decodePageRender() to know what page and  
activation context then use PageRenderLinkSource to create the URL to  
redirect.

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Site wide 301 redirect to https from http

Posted by Chris Mylonas <ch...@opencsta.org>.
Do u have httpd in front of?

I just found some form stuff to work on for redirects, on phone now but can
suss more later/2moz

Cm
On 28/10/2014 5:32 pm, "George Christman" <gc...@cardaddy.com> wrote:

> Hi guys, I'm in the process of migrating my entire site to https from http.
> I need to do this with extreme caution or I risk losing my search rank.
> Google recommends 301 redirects for every page being migrated, however when
> securing the app like so,
>
> public void contributeMetaDataLocator(MappedConfiguration<String, String>
> configuration) {
>         configuration.add(MetaDataConstants.SECURE_PAGE, "true");
> }
>
> it appears as if the redirects are happening automatically without a 301.
> Does anybody know how I can accomplish this task?
>
> When I move pages, I generally just use something like this.
>
> Link link = linkSource.createPageRenderLinkWithContext(Signin.class);
>         return new HttpStatusCode(HttpServletResponse.SC_MOVED_PERMANENTLY,
> link);
>
> Thanks,
> George
>
> --
> George Christman
> www.CarDaddy.com
> P.O. Box 735
> Johnstown, New York
>