NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

package com.liferay.training.space.custom.jsp;

import com.liferay.portal.deploy.hot.CustomJspBag;
import com.liferay.portal.kernel.url.URLContainer;

import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;

/**
* @author Volgen
*/
@Component(
immediate = true,
property = {"context.id=SpaceCustomJspBag", "context.name=Space Terms of Use", "service.ranking:Integer=100"
// TODO enter required service properties
},
service = CustomJspBag.class
)
public class SpaceCustomJspBag implements CustomJspBag {

// TODO enter required service methods
/**
* Returns the directory path in the module JAR where the custom JSPs
* reside.
*
* @return the directory path in the module JAR where the custom JSPs reside
*/
@Override
public String getCustomJspDir() {
return "META-INF/jsps/";
}

/**
* Returns the custom JSP URL paths.
*
* @return the custom JSP URL paths
*/
@Override
public List<String> getCustomJsps() {
return _customJsps;
}

@Override
public URLContainer getURLContainer() {
return _urlContainer;
}

@Override
public boolean isCustomJspGlobal() {
return true;
}

/**
* Adds the URL paths for all custom core JSPs to a list when the module is
* activated.
*
* @param bundleContext the bundle context from which to get the custom
* JSP's bundle
*/
@Activate
protected void activate(BundleContext bundleContext) {
_bundle = bundleContext.getBundle();

_customJsps = new ArrayList<>();

Enumeration<URL> entries = _bundle.findEntries(
getCustomJspDir(), "*.jsp", true);

while (entries.hasMoreElements()) {
URL url = entries.nextElement();

_customJsps.add(url.getPath());
}
}

private Bundle _bundle;
private List<String> _customJsps;

private final URLContainer _urlContainer = new URLContainer() {

@Override
public URL getResource(String name) {
return _bundle.getEntry(name);
}

@Override
public Set<String> getResources(String path) {
Set<String> paths = new HashSet<>();

for (String entry : _customJsps) {
if (entry.startsWith(path)) {
paths.add(entry);
}
}

return paths;
}

};

}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.