-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from ist-dresden/feature/standalone-editor
Feature/standalone editor
- Loading branch information
Showing
48 changed files
with
1,193 additions
and
353 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
commons/bundle/src/main/java/com/composum/pages/commons/request/LocaleRequestWrapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.composum.pages.commons.request; | ||
|
||
import org.apache.sling.api.SlingHttpServletRequest; | ||
import org.apache.sling.api.wrappers.SlingHttpServletRequestWrapper; | ||
|
||
import java.util.Locale; | ||
|
||
/** | ||
* the rquest wrapper to declare the requets locale | ||
*/ | ||
public class LocaleRequestWrapper extends SlingHttpServletRequestWrapper { | ||
|
||
protected final Locale locale; | ||
|
||
public LocaleRequestWrapper(SlingHttpServletRequest wrappedRequest, Locale locale) { | ||
super(wrappedRequest); | ||
this.locale = locale; | ||
} | ||
|
||
@Override | ||
public Locale getLocale() { | ||
return locale; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
commons/bundle/src/main/java/com/composum/pages/commons/servlet/PagesStandaloneServlet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.composum.pages.commons.servlet; | ||
|
||
import com.composum.sling.core.BeanContext; | ||
import org.apache.sling.api.request.RequestDispatcherOptions; | ||
import org.apache.sling.api.servlets.HttpConstants; | ||
import org.apache.sling.api.servlets.ServletResolverConstants; | ||
import org.osgi.framework.Constants; | ||
import org.osgi.service.component.annotations.Component; | ||
|
||
import javax.servlet.Servlet; | ||
import java.util.regex.Pattern; | ||
|
||
import static com.composum.pages.commons.PagesConstants.PAGES_EDITOR_PATH; | ||
import static com.composum.pages.commons.PagesConstants.PAGES_EDITOR_SELECTOR; | ||
|
||
/** | ||
* The general hook (servlet) for the Pages edit stage; provides the path '/bin/edit.html/...'. | ||
*/ | ||
@Component(service = Servlet.class, | ||
property = { | ||
Constants.SERVICE_DESCRIPTION + "=Composum Pages Standalone Servlet", | ||
ServletResolverConstants.SLING_SERVLET_PATHS + "=" + PAGES_EDITOR_PATH, | ||
ServletResolverConstants.SLING_SERVLET_METHODS + "=" + HttpConstants.METHOD_GET | ||
}) | ||
public class PagesStandaloneServlet extends PagesFrameServlet { | ||
|
||
public static final Pattern PATH_PATTERN = Pattern.compile("^(" + PAGES_EDITOR_PATH + "(\\.[^/]+)?\\.html)(/.*)?$"); | ||
|
||
@Override | ||
protected String getServletPath(BeanContext context) { | ||
return PAGES_EDITOR_PATH; | ||
} | ||
|
||
@Override | ||
protected Pattern getPathPattern(BeanContext context) { | ||
return PATH_PATTERN; | ||
} | ||
|
||
@Override | ||
protected void prepareForward(BeanContext context, RequestDispatcherOptions options) { | ||
super.prepareForward(context, options); | ||
options.setReplaceSelectors(PAGES_EDITOR_SELECTOR); | ||
} | ||
|
||
@Override | ||
protected String getConsolePath(BeanContext context) { | ||
return null; | ||
} | ||
} |
Oops, something went wrong.